
function getMap()
{
	if (navigator.appName == "Netscape")
		return parent.mapframe.document.map;
	else
		return parent.MyMapFrame.MyMap;
}

function getMap()
{
	if (navigator.appName == "Netscape")
		return parent.mapframe.document.map;
	else
		return parent.MyMapFrame.MyMap;
}

function gotoLocation(index)
{
	var map = getMap();
   	
   	if (index == 1)
        map.zoomScale(375523.049607,330980.857551, 11000);

}

function help(lang)
{	
    window.open('help_'+lang+'.pdf')
}

function layersView_on_off()
{
   var lvWidth = getMap().LayersViewWidth;
   if(lvWidth == 220)
   	getMap().LayersViewWidth = 0;
   else
   {
   	getMap().LayersViewWidth = 220;
   }
}

function FindArea()
{
    // Digitize polyline
    if (navigator.appName == "Netscape")
      getMap().digitizePolygonEx(parent.MyMapFrame.document.obs);
    else
      getMap().digitizePolygon();
}

function polygonSel()
{
   var MyMap = parent.MyMapFrame.document.MyMap;
   var MapScale = MyMap.getScale();
   {
	   parent.MyMapFrame.document.MyMap.selectPolygonMode();
   }
}

function radiusSel()
{
   var MyMap = parent.MyMapFrame.document.MyMap;
   var MapScale = MyMap.getScale();
   {
	   top.MyMapFrame.document.MyMap.selectRadiusMode();
   }
}

function withinSel()
{
   var MyMap = parent.MyMapFrame.document.MyMap;
   var MapScale = MyMap.getScale();
   {
   	parent.MyMapFrame.document.MyMap.selectWithinDlg();
   }
}

function clearSelection()
{
   var MyMap = parent.MyMapFrame.document.MyMap;
   var MyMapSel = MyMap.getSelection();
   MyMapSel.clear();
}

function waterpipes_layer()
{
	var map = getMap();
	map.setAutoRefresh(false);

	map.getMapLayerGroup("REGNVATN").setVisibility(false);
	map.getMapLayerGroup("VATNSLAGNIR").setVisibility(true);
	map.getMapLayer("Regnvatn").setVisibility(false);
	map.getMapLayer("Regnvatnsbrunnar").setVisibility(false);
	map.getMapLayer("Vatnslokar").setVisibility(true);
	map.getMapLayer("Brunahanar").setVisibility(true);
	map.getMapLayer("Vatnslagnir").setVisibility(true);
	
	map.setAutoRefresh(true);
	map.refresh();
}

function sewerpipes_layer()
{
	var map = getMap();
	map.setAutoRefresh(false);
	
	map.getMapLayerGroup("REGNVATN").setVisibility(false);
	map.getMapLayerGroup("VATNSLAGNIR").setVisibility(false);
	map.getMapLayer("Regnvatn").setVisibility(false);
	map.getMapLayer("Regnvatnsbrunnar").setVisibility(false);
	map.getMapLayer("Vatnslokar").setVisibility(false);
	map.getMapLayer("Brunahanar").setVisibility(false);
	map.getMapLayer("Vatnslagnir").setVisibility(false);
	
	map.setAutoRefresh(true);
	map.refresh();
 }
 
function daywaterpipes_layer()
{
	var map = getMap();
	map.setAutoRefresh(false);
	
	map.getMapLayerGroup("REGNVATN").setVisibility(true);
	map.getMapLayerGroup("VATNSLAGNIR").setVisibility(false);
	map.getMapLayer("Regnvatn").setVisibility(true);
	map.getMapLayer("Regnvatnsbrunnar").setVisibility(true);
	map.getMapLayer("Vatnslokar").setVisibility(false);
	map.getMapLayer("Brunahanar").setVisibility(false);
	map.getMapLayer("Vatnslagnir").setVisibility(false);
	
	map.setAutoRefresh(true);
	map.refresh();
 }

function warmwaterpipes_layer()
{
	var map = getMap();
	map.setAutoRefresh(false);

	map.getMapLayerGroup("REGNVATN").setVisibility(false);
	map.getMapLayerGroup("VATNSLAGNIR").setVisibility(false);

	map.setAutoRefresh(true);
	map.refresh();
 }
 
 function electricity_layer()
 {
 	var map = getMap();
 	map.setAutoRefresh(false);
 
 	map.getMapLayerGroup("REGNVATN").setVisibility(false);
	map.getMapLayerGroup("VATNSLAGNIR").setVisibility(false);
 
 	map.setAutoRefresh(true);
 	map.refresh();
 }

 function telephone_layer()
 {
 	var map = getMap();
 	map.setAutoRefresh(false);
 
 	map.getMapLayerGroup("REGNVATN").setVisibility(false);
	map.getMapLayerGroup("VATNSLAGNIR").setVisibility(false);
 
 	map.setAutoRefresh(true);
 	map.refresh();
 } 
 
function mainplan_on_off()
{
	var map = getMap();
	var layer = map.getMapLayer("Adalskipulag - thettbyli");
	if (layer == null)
		alert ("Adalskipulag layer not found");
	else
	{
		var isLayerOn = layer.getVisibility();
		if (isLayerOn == true)
		{
			layer.setVisibility(false);
			
		}
		else
		{
			layer.setVisibility(true);
			
		}
	}
	
	map.refresh();
}

function highfly_on_off(which_fly)
{
	var map = getMap();
	var layergroup = map.getMapLayerGroup("LOFTMYNDIR");
	if (layergroup == null)
		alert ("Loftmyndir layer not found");
	else
	{
		var layer = map.getMapLayer(which_fly)
		var isLayerOn = layer.getVisibility();
		if (isLayerOn == true)
			layer.setVisibility(false); 
		else
		{
			layer.setVisibility(true);
		}
	}
	map.refresh();
}

function streets_info_layer()
{
	var map = getMap();
	map.setAutoRefresh(false);
		
	map.getMapLayerGroup("Vegir").setVisibility(true);
	map.getMapLayerGroup("SLITLOG").setVisibility(false);
	map.getMapLayer("Gotur_grunnframkvaemd").setVisibility(false);
	
	map.setAutoRefresh(true);
	map.refresh();
}

function streets_construction_layer()
{
	var map = getMap();
	map.setAutoRefresh(false);
	
	map.getMapLayerGroup("Vegir").setVisibility(true);
	map.getMapLayerGroup("SLITLOG").setVisibility(false);
	map.getMapLayer("Gotur_grunnframkvaemd").setVisibility(true);
	
	map.setAutoRefresh(true);
	map.refresh();
}

function streets_paving_layer()
{
	var map = getMap();
	map.setAutoRefresh(false);
	
	map.getMapLayerGroup("Vegir").setVisibility(true);
	map.getMapLayerGroup("SLITLOG").setVisibility(true);
	map.getMapLayer("Gotur_grunnframkvaemd").setVisibility(false);
	
	map.setAutoRefresh(true);
	map.refresh();
}

function streets_paving_layerToggle(layerName)
{
	var map = getMap();
	map.setAutoRefresh(false);
	
	var layer = map.getMapLayer(layerName)
	var isLayerOn = layer.getVisibility();
	if (isLayerOn == true)
		layer.setVisibility(false); 
	else
	{
		layer.setVisibility(true);
	}
	
	map.setAutoRefresh(true);
	map.refresh();
}

function area_layer()
{
	var map = getMap();
	map.setAutoRefresh(false);
		
	map.getMapLayerGroup("VEGMANNVIRKI").setVisibility(true);
	map.getMapLayerGroup("SLITLOG").setVisibility(false);
	map.getMapLayer("Gotur_grunnframkvaemd").setVisibility(false);
		
	map.setAutoRefresh(true);
	map.refresh();
}