var activeMenu = "",ver = 0;

	  imageObj = new Array();
      images = new Array();
      images[0] = "mudron";
      images[1] = "samorin";
      images[2] = "vub";
      images[3] = "kopernica";
      images[4] = "lucky";
      images[5] = "hodzovo";
      images[6] = "ev_nitra";
      images[7] = "dlhediely";
      images[8] = "nbs";
      images[9] = "teplicka";
      images[10] = "byt";
      images[11] = "jt";
      images[12] = "podkrovie";
      images[13] = "irb";
      images[14] = "nabytok";
      images[15] = "rdslov";
      images[16] = "unilever";
      images[17] = "drhotel";
      images[18] = "domkol";
      images[19] = "cac";
      images[20] = "metropol";
      images[21] = "rdmh";
      images[22] = "cacbb";
      images[23] = "domde";
      images[24] = "awt";
      images[25] = "trnavska";
      images[26] = "raca";
      images[27] = "ruzinov";
      images[28] = "klzava";
      images[29] = "az";
      images[30] = "vlckova";
      images[31] = "slsp";
      images[32] = "podhradie";
      images[33] = "coop";
      images[34] = "mvila";
      images[35] = "staromestska";
      images[36] = "zahbystrica";
	  images[37] = "tatracity";
	  images[38] = "ska";
	  images[39] = "domde2";
	  images[40] = "ncc";
  	  images[41] = "cassovar";
   	  images[42] = "zuckermandel";
       for(i=0; i<=42; i++) {
        imageObj[i] = new Image();
       	imageObj[i].src = "http://" + document.domain + "/images/" + images[i] + "/preview.jpg";
       	         }
		imageBack = new Image();
		imageBack.src = "http://" + document.domain + "/images/backmenu.jpg";
		imageTopBack = new Image();
		imageTopBack.src = "http://" + document.domain + "/images/backtop.jpg";

function showSubMenu(object) {
	mainString = document.all[object].style.left;
	numString = mainString.substring(0,mainString.length-2);
	mainWidth = (document.body.clientWidth - 700)/2;
	if (mainWidth < 0) mainWidth = 0;
	leftWidth = 1*numString + 1*mainWidth;
	setWidth = leftWidth + "px";
	document.all[object].style.left = setWidth;
	if (document.getElementById && document.getElementById(object) != null)
		node = 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 + "top";
	popismenu = object + "mnu";
	if(object != "menuPhoneNumbers"){
				document.getElementById(popis).style.backgroundColor = "#949494";
				document.getElementById(popismenu).style.color = "#ffffff";
				document.getElementById(popis).style.backgroundImage = "url(images/backtop.jpg)";
				}
	activeMenu = object;
}

function hideSubMenu(object) {
	if (document.getElementById && document.getElementById(object) != null)
		node = 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.all[object].style.left = mainString;
	popis = object + "top";
	popismenu = object + "mnu";
	if(object != "menuPhoneNumbers"){
				document.getElementById(popis).style.backgroundColor = "#ffffff";
				document.getElementById(popismenu).style.color = "#000000";
				document.getElementById(popis).style.backgroundImage = "none";
				}
	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 openDWF(drawing) {
	options = "resizable,width=720,height=560";
	windowName = "WinDWF" + Math.round(100000*Math.random());
	opener = window.open("",windowName,options);
	opener.document.open();
	opener.document.write('<html><head><title>..::DWF::..</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2"></head><body topmargin="0" leftmargin="0" scroll="no">');
	opener.document.write('<object id="viewer" classid="clsid:A662DA7E-CCB7-4743-B71A-D817F6D575DF" codebase="http://www.autodesk.com/global/dwfviewer/installer/DwfViewerSetup.cab" ');
	opener.document.write('width="100%" height="100%"><param name="src" value="'+ drawing +'"><param name="PaperVisible" value="false"><br><b>Váš prehliadač nepodporuje zobrazenie DWF objektov!<br><br>Your browser do not support DWF object!</b></object></body></html>');
	opener.document.close();
}

function browserWrite(stringtowrite){
var badBrowser = false;
var ver = 100;
var typ = window.navigator.userAgent;
var msie = typ.indexOf("MSIE ");
	if(msie > 0) ver = parseInt(typ.substring(msie+5,typ.indexOf( ".",msie)));
	if(ver < 7) badBrowser = true;
	if(!badBrowser)document.write(stringtowrite);
}

function showGoogleMaps(location,language){
	//document.write('<a href="?id=189"><img valign="middle" align="right" src="images\\googlemaps.png" border="0" title="');
	document.write('<a href="http://maps.google.com/maps?q=' + location + '&hl=' + language + '" target="_blank"><img valign="top" align="right" src="images\\googlemaps.png" border="0" title="');
	if (language != "en") document.write('Zobraziť projekt na mape');
		else document.write('View the project on map');
	document.write('"></a>');
}

function showPreview(imageName){ 
		document.all.preview.src = "images/" + imageName + "/preview.jpg";
		document.all.preview.style.borderStyle = "solid"; }

function hidePreview(){ 
		document.all.preview.src = "images/blank.jpg";
		document.all.preview.style.borderStyle = "dotted"; }

function showThumb(imageName){ 
		document.all.thumb.src = "images/" + imageName + "/preview.jpg";
		document.all.thumb.style.borderStyle = "solid"; }

function hideThumb(){ 
		document.all.thumb.src = "images/blank.jpg";
		document.all.thumb.style.borderStyle = "dotted"; }
