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;
}

function setClass(object, classname) {
 object.className = classname;
 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;
  newWindow.resizeTo(newWidth,newHeight);
  newWindow.focus();
}

// imgWindow procedure (makes image popup window and resizes it to match the image dimentions) (c) 2006 Boian Georgiev
var popImg
function imgWindow(imgURL, imgWidth, imgHeight) {
 var options;
 if (imgWidth && imgHeight) {
  options = 'width=' + imgWidth + ', height=' + imgHeight + ', scrollbars=no, resizable=no';
 } else {
  options = 'width=500, height=500, scrollbars=no, resizable=no';
 }
  var output = "";
  output += "<html>\n";
  output += "<head>\n";
  output += "<title>image</title>\n";
  output += "</head>\n";
  output += "<script type='text/javascript' language='JavaScript'>\n";

  output += "function setSize() {\n";
  output += " var pic = document.getElementById('pic');\n";
  output += " var loading = document.getElementById('loading');\n";
  output += " window.resizeTo(500, 500);\n";
  output += " lostWidth = 500 - document.body.clientWidth;\n";
  output += " lostHeight = 500 - document.body.clientHeight;\n";
  output += " wndWidth = pic.width + lostWidth;\n";
  output += " wndHeight = pic.height + lostHeight;\n";
  output += " window.resizeTo(wndWidth,wndHeight);\n";
//  output += " loading.style.display = 'none';\n";
//  output += " pic.style.display = '';\n";
  output += " window.moveTo((screen.width-wndWidth)/2,(screen.height-wndHeight)/2);";
  output += "}\n";

  output += "</script>\n";
  output += "<body style='overflow: hidden;' scrolling='no' onload='javascript: setSize();' marginwidth=0 marginheight=0 topmargin=0 leftmargin=0>\n";
  output += "<a href='javascript: self.close();'>\n";
//  output += "<img style='position: absolute; display: none;' id='pic' src='"+imgURL+"'";
  output += "<img id='pic' src='"+imgURL+"'";
  if (imgWidth && imgHeight) {
   output += "width="+imgWidth+" height="+imgHeight
  }
  output += " border=0 alt='close'></a>\n";
//  output += "<span style='position: absolute;' id='loading'><h1>Loading image...</h1></span>\n";
  output += "</body>\n";
  output += "</html>\n";

  if (popImg && popImg.focus && !popImg.closed) {
   popImg.focus();
  } else {
   popImg = window.open('', 'iPortVN', options);
   if (!popImg) { alert ('Please disable your pop-up killer!'); return; }
   popImg.focus();
  }
  popImg.document.write(output)
  popImg.document.close()
}

// SendMailTo procedure (avoid SPAM) (c) 2004 Boian Georgiev
function ePismo(suf, adr, dom, name) {
 if (name) {
 	window.location = "mail"+"to:"+name+"<"+adr+"@"+dom+"."+suf+">";
 } else {
 	window.location = "mail"+"to:"+adr+"@"+dom+"."+suf;
 }
}

