function fMapOnOff(obj) {
 var map = document.getElementById('mapimg');
 var id = obj.id;
 if (map.className == 'map_base') {
  map.className = id;
 } else {
  map.className = 'map_base';
 }
}

function hRow(theRow, theColor) {
    var theCells = null;
    if (theColor == '' || typeof(theRow.style) == 'undefined') {
        return false;
    }
    if (typeof(document.getElementsByTagName) != 'undefined') {
        theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        theCells = theRow.cells;
    }
    else {
        return false;
    }

    var rowCellsCnt  = theCells.length;
    // Opera does not return valid values with "getAttribute"
    if (typeof(window.opera) == 'undefined') {
        for (var c = 0; c < rowCellsCnt; c++) {
            theCells[c].setAttribute('bgcolor', theColor, 0);
        } // end for
    }
    else {
        for (var c = 0; c < rowCellsCnt; c++) {
            theCells[c].style.backgroundColor = theColor;
        }
    }
    return true;
}

var newWindow
function popWindow(TheURL, newWidth, newHeight, ShowMenu, Name) {
  var output = ''
  var options
  options = 'width=' + newWidth + ',height=' + newHeight
  if (ShowMenu == 1) {
  	ShowMenu = 'yes';
  	newHeight = newHeight + 60
  };
  if (ShowMenu == 0) {
  	ShowMenu = 'no';
  	newHeight = newHeight + 30
  };
  options = options + ',menubar='+ShowMenu+',toolbar=no,scrollbars=yes,resizable=yes,status=no'

  if (newWindow && newWindow.focus && !newWindow.closed) {
    newWindow.focus();
    newWindow.resizeTo(newWidth,newHeight);
  } else {
    newWindow = window.open('', Name, options);
    if (!newWindow) { alert ('Please disable your pop-up killer!'); return; }
    newWindow.resizeTo(newWidth,newHeight);
  }
  newWindow.moveTo((screen.width-newWidth-10)/2,(screen.height-newHeight-100)/2);
  newWindow.document.location = TheURL;
//  if (newWidth > 50) {
   newWindow.resizeTo(newWidth,newHeight);
   newWindow.focus();
//  } else {
//   newWindow.close();
//  }
}

function imgWindow(imgSource, ttl, alt) {
 if (!ttl || ttl == '') { ttl = 'image'; }
 if (!alt || alt == '') { alt = 'Затвори'; }
 var output = "";
 var options;
// options = 'width=' + imgWidth + ',height=' + imgHeight + ',scrollbars=no, resizable=no';
 options = 'width=100,height=100,scrollbars=no, resizable=no';

 var imgWin = window.open("", ttl, options);
 output += "<html>\n";
 output += "<head>\n";
 output += "<title>"+ttl+"</title>\n";
 output += "<script type='text/javascript' language='JavaScript'>\n";
 output += "var iWidth, iHeight;\n";
 output += "function fitImage() {\n";
 output += " var o_image=document.getElementById('theImg');\n";
 output += " window.resizeTo(o_image.width,o_image.height);\n";
 output += " getWindowSize();\n";
 output += " window.resizeTo(o_image.width+(o_image.width-iWidth),o_image.height+(o_image.height-iHeight));\n";
 output += "}\n";
 output += "function getWindowSize() {\n";
 output += " if (window.innerWidth) {\n";
 output += "  iWidth = window.innerWidth;\n";
 output += "  iHeight = window.innerHeight;\n";
 output += " } else {\n";
 output += "  iWidth = document.body.clientWidth;\n";
 output += "  iHeight = document.body.clientHeight;\n";
 output += " }\n";
 output += "}\n";
 output += "</script>\n";
 output += "</head>\n";
 output += "<body marginwidth=0 marginheight=0 topmargin=0 leftmargin=0 onLoad='fitImage();'>\n";
 output += "<a href='javascript: window.close()'><img id='theImg' src='"+imgSource+"'";
 output += " border='0' alt='"+alt+"' title='"+alt+"'></a>\n";
 output += "</body>\n";
 output += "</html>";

 imgWin.document.write(output);
 imgWin.document.close();
}

// SendMailTo procedure (avoid SPAM)
function ePismo(suf, adr, dom, name) {
 if (name) {
 	window.location = "mail"+"to:"+name+"<"+adr+"@"+dom+"."+suf+">";
 } else {
 	window.location = "mail"+"to:"+adr+"@"+dom+"."+suf;
 }
}

