	var activeMenu = "",ver = 0,engine = null;
	var cOption = 2;
	var cDomain = document.domain;

	  var previewImages = new Array("mudron","samorin","vub","kopernica","lucky","hodzovo","ev_nitra","dlhediely","nbs","teplicka",
	  "byt","jt","podkrovie","irb","nabytok","rdslov","unilever","drhotel","domkol","cac",
	  "metropol","rdmh","cacbb","domde","awt","trnavska","raca","ruzinov","klzava","az",
	  "vlckova","slsp","podhradie","coop","mvila","staromestska","zahbystrica","tatracity","ska","domde2",
	  "ncc","cassovar","zuckermandel","krb","vystava","vystavapraha","pancity");
       var menuImages = new Array("ArchitektEN","ArchitektENsel","ArchitektSK","ArchitektSKsel","BonusEN","BonusENsel","BonusSK",
      "BonusSKsel","KancelEN","KancelENsel","KancelSK","KancelSKsel","ProjektyEN","ProjektyENsel",
      "ProjektySK","ProjektySKsel","RealEN","RealENsel","RealSK","RealSKsel","SKsel","ENsel");
	imageMnu = new Array();
		for(j=0; j<=21; j++) { imageMnu[j] = new Image();
			imageMnu[j].src = "http://" + cDomain + "/images/menu" + menuImages[j] + ".png"; }
	imageObj = new Array();
		for(i=0; i<=46; i++) { imageObj[i] = new Image();
			imageObj[i].src = "http://" + cDomain + "/images/" + previewImages[i] + "/preview.jpg"; }
		imageBack = new Image();
		imageBack.src = "http://" + cDomain + "/images/backmenu.jpg";
		imageTopBack = new Image();
		imageTopBack.src = "http://" + cDomain + "/images/backtop.jpg";

function showSubMenu(object) {
	objWidth = document.all.mainWindow.width;
	mainString = document.getElementById(object).style.left;
	numString = mainString.substring(0,mainString.length-2);
	mainWidth = (document.body.clientWidth - objWidth)/2;
	if (mainWidth < 0) mainWidth = 0;
	if(object != "menuReal") { leftWidth = getPosX(document.getElementById(object+"Img")); }
		else { leftWidth = 1*numString + 1*mainWidth; }
	setWidth = leftWidth + "px";
	document.getElementById(object).style.left = setWidth;
	if (document.getElementById && document.getElementById(object) != null)
		document.getElementById(object).style.display="inline";
		else if (document.layers && document.layers[object] != null)
			document.layers[object].display = "inline";
		else if (document.all)
			document.all[object].style.display = "inline";
	popis = object + "Img";
	popismenu = object + "mnu";
	if(getQueryVariable("lg"))lang = getQueryVariable("lg");
		else { if(cDomain.indexOf(".eu") < 0)lang = "sk";
				else lang = "en"; }
	document.getElementById(popis).src = "images/" + object + lang + "Sel.png";
	activeMenu = object;
}

function hideSubMenu(object) {
	if (document.getElementById && document.getElementById(object) != null)
		document.getElementById(object).style.display = "none";
		else if (document.layers && document.layers[object] != null)
			document.layers[object].display = "none";
		else if (document.all)
			document.all[object].style.display = "none";
	document.getElementById(object).style.left = mainString;
	popis = object + "Img";
	popismenu = object + "mnu";
	if(getQueryVariable("lg"))lang = getQueryVariable("lg");
		else { if(cDomain.indexOf(".eu") < 0)lang = "sk";
				else lang = "en"; }
	document.getElementById(popis).src = "images/" + object + lang + ".png";
	activeMenu = "";
}

onload = function(){
  document.onkeypress = function(e){
    if(window.event) e = window.event;
    var keycode = (e.keyCode)?e.keyCode:e.which;
	if(keycode == 27 && activeMenu != ""){
		hideSubMenu(activeMenu);
		activeMenu = "";
		}
	}
}

function showPreview(imageName,target){
		document.getElementById(target).src = "images/" + imageName + "/preview.jpg";
		document.getElementById(target).style.borderStyle = "solid"; }
function hidePreview(target){ 
		document.getElementById(target).src = "images/blank.jpg";
		document.getElementById(target).style.borderStyle = "dotted"; }

function setVar(name,value,expdays) {
		var expdate = new Date();
		expdate.setDate(expdate.getDate() + expdays);
		var cvalue = escape(value) + ((expdays==null) ? "" : "; expires=" + expdate.toUTCString());
		document.cookie = name + "=" + cvalue; }

function getVar(name) {
		var i,x,y,ARRcookies = document.cookie.split(";");
		for (i=0;i<ARRcookies.length;i++) {
			x = ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
			y = ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
			x = x.replace(/^\s+|\s+$/g,"");
			if(x == name) { return unescape(y); }
		}}

function delVar(name) { document.cookie = name + "=; expires=Thu, 01-Jan-70 00:00:01 GMT;"; }

function getiever() {
  var rv = -1;
  if (navigator.appName == "Microsoft Internet Explorer")
  { var ua = navigator.userAgent;
    var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
    if (re.exec(ua) != null)
      rv = parseFloat( RegExp.$1 );  }
  return rv; }

function changeMainContent(option){
	var z = new Array("ulica","mapa","galeria");
if(option!= cOption) {
	document.getElementById("mainContent").innerHTML = innerSource[option];

		if(option == 2) {
				document.getElementById("mainContent").style.borderColor = "#000000";
				initGallery();
				}
			else document.getElementById("mainContent").style.borderColor = "#a0a0a0";
	document.getElementById(z[cOption]).src = "images/" + z[cOption] + ".png";
	document.getElementById(z[option]).src = "images/" + z[option] + "Sel.png";
	cOption = option;
	}
}

function initGallery(){
if(document.getElementById("gallery")){
	Galleria.loadTheme("themes/classic/galleria.classic.min.js");
	$("#gallery").galleria({width:690,height:420});
	}
}

if (window.navigator.appName == "Microsoft Internet Explorer")
{
   if (document.documentMode) engine = document.documentMode;
   else   {
      engine = 5;
      if (document.compatMode)
      {
         if (document.compatMode == "CSS1Compat") engine = 7;
      }
   }
}

function getPosX(obj)
  {
    if (navigator.appName == "Opera") var curleft = 0;
    else var curleft = 1;
    if(obj.offsetParent)
        while(1) 
        {
          curleft += obj.offsetLeft;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
    return curleft;
  }

  function getPosY(obj)
  {
    if (navigator.appName == "Opera") var curtop = 0;
    else var curtop = 1;
    if(obj.offsetParent)
        while(1)
        {
          curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;
    return curtop;
  }
  
function getQueryVariable(variable) { 
  var query = window.location.search.substring(1); 
  var vars = query.split("&"); 
  for (var i=0;i<vars.length;i++) { 
    var pair = vars[i].split("="); 
    if (pair[0] == variable) { 
      return pair[1]; 
    } 
  } 
  return null; 
}

