// *** CROSS-BROWSER COMPATIBILITY ***

var isDOM = (document.getElementById ? true : false); 
var isIE = (document.all ? true : false);
var isIE4 = ((isIE && !isDOM) ? true : false);
var isNS4 = (document.layers ? true : false);
var isNS6 = (isDOM && !isIE);
var isDyn = (isDOM || isIE4 || isNS4);


// ********************* Menu *******************


var	lastMenu = null;


function findPos(obj)
{
	var curleft = curtop = 0;
	if (obj.offsetParent)
	{
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent)
		{
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}

function resetMenuItems(menuName)
{
	document.getElementById('studieMenuItem').className = "menuItem";
	document.getElementById('nabidkaMenuItem').className = "menuItem";
	document.getElementById('spolecnostMenuItem').className = "menuItem";
	document.getElementById('kontaktMenuItem').className = "menuItem";
	document.getElementById('individualMenuItem').className = "menuItem";

	document.getElementById(menuName).className = "activeMenuItem";
}

function resetPictureIcons(menuName)
{
	document.getElementById('pictureIcon1').className = "pictureIcon";
	document.getElementById('pictureIcon2').className = "pictureIcon";
	document.getElementById('pictureIcon3').className = "pictureIcon";
	document.getElementById('pictureIcon4').className = "pictureIcon";
	document.getElementById('pictureIcon5').className = "pictureIcon";
	document.getElementById('pictureIcon6').className = "pictureIcon";
	document.getElementById('pictureIcon7').className = "pictureIcon";
	document.getElementById(menuName).className = "activePictureIcon";
}

function resetProjectIcons(menuName)
{
	document.getElementById('projectIcon1').className = "pictureIcon";
	document.getElementById('projectIcon2').className = "pictureIcon";
	if (document.getElementById('projectIcon3') != null)
	{
		document.getElementById('projectIcon3').className = "pictureIcon";
	}
	if (document.getElementById('projectIcon3') != null)
	{
		document.getElementById('projectIcon4').className = "pictureIcon";
	}
	document.getElementById(menuName).className = "activePictureIcon";
}

function showMenu(menuName, srclink)
{
	if (lastMenu != null)
	{
		lastMenu.style.visibility="hidden";
		lastMenu = null;
	}
	var	menuElement;
	if (document.getElementById)
	{
		menuElement = document.getElementById(menuName);
		resetMenuItems(menuName+"Item");
	}
	else if (document.layers)
	{
		menuElement = document.layers[menuName];
	}
	else
	{
		menuElement = document.all[menuName];
	}
	//menuElement.style.top=107;
	linkPos = findPos(srclink);
	menuElement.style.left=(linkPos[0]-6)+"px";
	menuElement.style.top=(linkPos[1]+srclink.offsetHeight+10)+"px";
	menuElement.style.visibility="visible";
	lastMenu = menuElement;
}


function hideMenu()
{
	if (lastMenu != null)
	{
		lastMenu.style.visibility="hidden";
		lastMenu = null;
	}
}
// ********************* Rollovers *******************

// check if the browser is Navigator 3 or higher:
agent = navigator.userAgent;
browserVer = 2;
if (agent.substring(0,7) == "Mozilla")
{
    if (parseInt(agent.substring(8,9)) >= 3) {browserVer = 1;}
}


function hiLite(imgDocID,imgObjName) 
{
// manages mouseOver animations
//   imgDocID - the name or number of the document image to be replaced
//   imgObjName - the name of the image object to be swapped in

	if (browserVer == 1) 
	{
		document.images[imgDocID].src = eval(imgObjName + ".src")
	}
}

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}


function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
if (document.images) {
	preloadFlag = true;
}

//******************************************

function newWindowPosouzeni()
{
	popWind = window.open('posouzeni.html', 'posouzeni', 'directories=no,height=400,width=600,top=120,left=300,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no');
	popWind.focus();
	popWind.contArea = window.frames["content"];
}

function newWindowPrizemi()
{
	popWind = window.open('prizemi.html', 'prizemi', 'directories=no,height=400,width=600,top=120,left=300,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no');
	popWind.focus();
	popWind.contArea = window.frames["content"];
}
function newWindowPoschodi()
{
	popWind = window.open('poschodi.html', 'poschodi', 'directories=no,height=400,width=600,top=120,left=300,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no');
	popWind.focus();
	popWind.contArea = window.frames["content"];
}
function newWindowVarianty()
{
	popWind = window.open('varianty.html', 'varianty', 'directories=no,height=400,width=600,top=120,left=300,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no');
	popWind.focus();
	popWind.contArea = window.frames["content"];
}


