window.name = 'mainwindow';

function set_target ( fname) {


fname.target = '';
fname.action = 'vkaart.phtml';

    if (fname.clicktype[3].checked && mapclicked) {
// alert('siin');
//	mapclicked = false;
	updatePopup(450,350, '', 'info','resizable=1,scrollbars=yes,scrollbars=1,scrolling=yes,');
	fname.action='vkaart_info.phtml';
	fname.target='info';
//	return true;
    }
    
mapclicked = false;

return true;
}

function set_mapclick ( vrtus) {
	mapclicked = vrtus;
}

  // Teeme kindlaks , milline on kasutatav ekraanilahutus ...
  if(screen.width > 800) {
	var mapwidth = 1;
  } else {
	var mapwidth = 0;
  }
  var mapclicked = false;


var LastWindowOpened = "";

function closePopup() {

  if (LastWindowOpened != "") {
    if (eval("self." + LastWindowOpened)) {
      if (!(eval("self." + LastWindowOpened + ".closed"))) {
        eval ("self." + LastWindowOpened + ".close()");
      }
    }
  }
}

function openPopup(thisWidth,thisHeight,thisDocument,thisWindowName,windowtools) {

  OpenThisWindow = true;
  if (eval("self." + thisWindowName)){
    if (!(eval("self." + thisWindowName + ".closed"))) {
      eval ("self." + thisWindowName + ".focus()");
      OpenThisWindow = false;
    }
  }

  if (OpenThisWindow){
    if (LastWindowOpened != thisWindowName) {
      closePopup()
    }
     
    if (windowtools == null) {           
      var windowtools = "toolbar=0,location=0,directories=0,status=1,scrollbars=1,resizable=1,alwaysRaised=1,";
    }

    eval(thisWindowName + " = window.open(\"" + thisDocument + "\",\"" + thisWindowName + "\",\"" + windowtools + "width=" + thisWidth + ",height=" + thisHeight + ",top=10,left=10,screeny=25,screenx=50\")");
    LastWindowOpened = thisWindowName;
  }

}

function updatePopup(wWidth,wHeight,thisDocument,thisWindowName,windowtools) {

  OpenThisWindow = true;
  if (eval("self." + thisWindowName)){
    if (!(eval("self." + thisWindowName + ".closed"))) {
      eval ("self." + thisWindowName + ".focus()");
      eval ("self." + thisWindowName + ".location = \"" + thisDocument + "\"");
      OpenThisWindow = false;
    }
  }

  if (OpenThisWindow){
    if (LastWindowOpened != thisWindowName) {
      closePopup()
    }
                
    if (windowtools == null) {           
      var windowtools = "toolbar=0,location=0,directories=0,status=1,scrollbars=1,resizable=1,alwaysRaised=1,";
    }

    eval(thisWindowName + " = window.open(\"" + thisDocument + "\",\"" + thisWindowName + "\",\"" + windowtools + "width=" + wWidth + ",height=" + wHeight + ",top=10,left=10,screeny=25,screenx=50\")");
    LastWindowOpened = thisWindowName;
  }

}

function naitapl( kood) {
		window.location.href = 'atlas.phtml?menu_id=plan&plankood='+kood;
}

