
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(565103.007243,590615.788319, 9000);
        
        if (index == 2)
        map.zoomScale(573391.773078,596347.426578, 9000);
      
}

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("HITAVEITA").setVisibility(false);
	map.getMapLayerGroup("VATNSVEITA").setVisibility(true);
	map.getMapLayerGroup("FRAVEITA").setVisibility(false);
	map.getMapLayer("Hitalagnir").setVisibility(false);
	map.getMapLayer("Brunnar_hiti").setVisibility(false);
	map.getMapLayer("Borholur").setVisibility(false);
	map.getMapLayer("Daelustodvar").setVisibility(false);
	
	map.getMapLayer("Lokar").setVisibility(true);
	map.getMapLayer("Brunnar").setVisibility(true);
	map.getMapLayer("Lindir").setVisibility(true);
	map.getMapLayer("Vatnslagnir").setVisibility(true);
	
	map.getMapLayer("Nidurfoll").setVisibility(false);
	
	
	map.setAutoRefresh(true);
	map.refresh();
}

function sewerpipes_layer()
{
	var map = getMap();
	map.setAutoRefresh(false);
	
	map.getMapLayerGroup("HITAVEITA").setVisibility(false);
	map.getMapLayerGroup("VATNSVEITA").setVisibility(true);
	map.getMapLayerGroup("FRAVEITA").setVisibility(true);
	map.getMapLayer("Hitalagnir").setVisibility(false);
	map.getMapLayer("Brunnar_hiti").setVisibility(false);
	map.getMapLayer("Borholur").setVisibility(false);
	map.getMapLayer("Daelustodvar").setVisibility(false);
		
	map.getMapLayer("Lokar").setVisibility(false);
	map.getMapLayer("Brunnar").setVisibility(false);
	map.getMapLayer("Lindir").setVisibility(false);
	map.getMapLayer("Vatnslagnir").setVisibility(false);
		
	map.getMapLayer("Nidurfoll").setVisibility(true);
	
	map.setAutoRefresh(true);
	map.refresh();
 }
 
function daywaterpipes_layer()
{
	var map = getMap();
	map.setAutoRefresh(false);
	
	map.getMapLayerGroup("HITAVEITA").setVisibility(false);
	map.getMapLayerGroup("VATNSVEITA").setVisibility(false);
	map.getMapLayerGroup("FRAVEITA").setVisibility(true);
	map.getMapLayer("Hitalagnir").setVisibility(false);
	map.getMapLayer("Brunnar_hiti").setVisibility(false);
	map.getMapLayer("Borholur").setVisibility(false);
	map.getMapLayer("Daelustodvar").setVisibility(false);
		
	map.getMapLayer("Lokar").setVisibility(false);
	map.getMapLayer("Brunnar").setVisibility(false);
	map.getMapLayer("Lindir").setVisibility(false);
	map.getMapLayer("Vatnslagnir").setVisibility(false);
		
	map.getMapLayer("Nidurfoll").setVisibility(true);
	
	map.setAutoRefresh(true);
	map.refresh();
 }


function warmwaterpipes_layer()
{
	var map = getMap();
	map.setAutoRefresh(false);

	map.getMapLayerGroup("HITAVEITA").setVisibility(true);
	map.getMapLayerGroup("VATNSVEITA").setVisibility(false);
	map.getMapLayerGroup("FRAVEITA").setVisibility(false);
	map.getMapLayer("Hitalagnir").setVisibility(true);
	map.getMapLayer("Brunnar_hiti").setVisibility(true);
	map.getMapLayer("Borholur").setVisibility(true);
	map.getMapLayer("Daelustodvar").setVisibility(true);
		
	map.getMapLayer("Lokar").setVisibility(false);
	map.getMapLayer("Brunnar").setVisibility(false);
	map.getMapLayer("Lindir").setVisibility(false);
	map.getMapLayer("Vatnslagnir").setVisibility(false);
		
	map.getMapLayer("Nidurfoll").setVisibility(false);

	map.setAutoRefresh(true);
	map.refresh();
 }
 
 function electricity_layer()
 {
 	var map = getMap();
 	map.setAutoRefresh(false);
 
 	map.getMapLayerGroup("HITAVEITA").setVisibility(false);
	map.getMapLayerGroup("VATNSVEITA").setVisibility(false);
	map.getMapLayerGroup("FRAVEITA").setVisibility(false);
	map.getMapLayer("Hitalagnir").setVisibility(false);
	map.getMapLayer("Brunnar_hiti").setVisibility(false);
	map.getMapLayer("Borholur").setVisibility(false);
	map.getMapLayer("Daelustodvar").setVisibility(false);
			
	map.getMapLayer("Lokar").setVisibility(false);
	map.getMapLayer("Brunnar").setVisibility(false);
	map.getMapLayer("Lindir").setVisibility(false);
	map.getMapLayer("Vatnslagnir").setVisibility(false);
			
	map.getMapLayer("Nidurfoll").setVisibility(false);
 
 	map.setAutoRefresh(true);
 	map.refresh();
 }

 function telephone_layer()
 {
 	var map = getMap();
 	map.setAutoRefresh(false);
 
 	map.getMapLayerGroup("HITAVEITA").setVisibility(false);
	map.getMapLayerGroup("VATNSVEITA").setVisibility(false);
	map.getMapLayerGroup("FRAVEITA").setVisibility(false);
	map.getMapLayer("Hitalagnir").setVisibility(false);
	map.getMapLayer("Brunnar_hiti").setVisibility(false);
	map.getMapLayer("Borholur").setVisibility(false);
	map.getMapLayer("Daelustodvar").setVisibility(false);
			
	map.getMapLayer("Lokar").setVisibility(false);
	map.getMapLayer("Brunnar").setVisibility(false);
	map.getMapLayer("Lindir").setVisibility(false);
	map.getMapLayer("Vatnslagnir").setVisibility(false);
			
	map.getMapLayer("Nidurfoll").setVisibility(false);
 
 	map.setAutoRefresh(true);
 	map.refresh();
 } 
 
function mainplan_on_off()
{
	var map = getMap();
	var layer = map.getMapLayerGroup("Adalskipulag");
	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 localplan_on_off()
{
	var map = getMap();
	var layer = map.getMapLayerGroup("Deiliskipulag");
	if (layer == null)
		alert ("Deiliskipulag layer not found");
	else
	{
		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("VEGMANNVIRKI").setVisibility(true);
	map.getMapLayer("Gotur").setVisibility(true);
	map.getMapLayer("Gotur - Grunnframkv").setVisibility(false);
	
	map.setAutoRefresh(true);
	map.refresh();
}

function streets_construction_layer()
{
	var map = getMap();
	map.setAutoRefresh(false);
	map.getMapLayer("Gotur").setVisibility(true);
	map.getMapLayer("Gotur - Grunnframkv").setVisibility(true);
	
	
	map.setAutoRefresh(true);
	map.refresh();
}

function streets_paving_layer()
{
	var map = getMap();
	map.setAutoRefresh(false);
	
	map.getMapLayerGroup("VEGMANNVIRKI").setVisibility(true);
	map.getMapLayer("Gotur").setVisibility(true);
	map.getMapLayer("Gotur - Grunnframkv").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 service_on_off(which_service)
{
	var map = getMap();
	var layergroup = map.getMapLayerGroup("THJONUSTA");
	if (layergroup == null)
		alert ("THJONUSTA layer not found");
	else
	{
		var layer = map.getMapLayer(which_service)
		var isLayerOn = layer.getVisibility();
		if (isLayerOn == true)
			layer.setVisibility(false); 
		else
		{
			layer.setVisibility(true);
		}
	}
	map.refresh();
}

function service_and_path_on_off(path, service)
{
	var map = getMap();
	map.setAutoRefresh(false);
	var layergroup = map.getMapLayer("Vegir");
	if (layergroup == null)
		alert ("Vegir layer not found");
	else
	{
		var layer = map.getMapLayer(path)
		var isLayerOn = layer.getVisibility();
		if (isLayerOn == true)
			layer.setVisibility(false); 
		else
		{
			layer.setVisibility(true);
		}
	}
	
	var layergroup = map.getMapLayerGroup("THJONUSTA");
	if (layergroup == null)
		alert ("THJONUSTA layer not found");
	else
	{
		var layer = map.getMapLayer(service)
		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.getMapLayer("Gotur").setVisibility(true);
	map.getMapLayer("Gotur - Grunnframkv").setVisibility(false);
		
	map.setAutoRefresh(true);
	map.refresh();
}

function service_layer()
{
	var map = getMap();
	map.setAutoRefresh(false);
		
	map.getMapLayerGroup("RAFVEITA").setVisibility(true);
	map.getMapLayer("Raflinur").setVisibility(true);


		
	map.setAutoRefresh(true);
	map.refresh();
}