
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(408762.376119,354710.658402, 4000);
        if (index == 2)
        map.zoomScale(409142.234244,354303.765292, 4000);	
        if (index == 3)
        map.zoomScale(410354.176659,353088.611995, 4000);	
        if (index == 4)
        map.zoomScale(409042.683211,352631.414585, 4000);	
      
}

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 service_on_off(which_service)
{
	var map = getMap();
	var layergroup = map.getMapLayerGroup("THJONUSTA");
	if (layergroup == null)
		alert ("Þjónusta 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 waterpipes_layer()
{
	var map = getMap();
	map.setAutoRefresh(false);
	map.getMapLayerGroup("FRAVEITA").setVisibility(false);
	map.getMapLayer("Skolpbrunnar").setVisibility(false);
	map.getMapLayer("Skolp").setVisibility(false);
	map.getMapLayerGroup("REGNVATN").setVisibility(false);
 	map.getMapLayer("Regnvatn").setVisibility(false);
	map.getMapLayerGroup("HITAVEITA").setVisibility(false);
	map.getMapLayer("Hitav_st").setVisibility(false);
 	map.getMapLayer("Hitav_heim").setVisibility(false);
	map.getMapLayer("Hitav_brunnar").setVisibility(false);
	
	map.getMapLayerGroup("VATNSVEITA").setVisibility(true);
	map.getMapLayer("Vatnslagnir").setVisibility(true);
	map.getMapLayer("Lokar").setVisibility(true);
	map.getMapLayer("Brunahanar").setVisibility(true);
	
	map.getMapLayerGroup("SIMALAGNIR").setVisibility(false);
	map.getMapLayer("Simalagnir").setVisibility(false);
	map.getMapLayer("Simap").setVisibility(false);
	map.getMapLayerGroup("RAFVEITA").setVisibility(false);
	map.getMapLayer("Raflagnir").setVisibility(false);
	
	map.setAutoRefresh(true);
	map.refresh();
}

function sewerpipes_layer()
{
	var map = getMap();
	map.setAutoRefresh(false);
	map.getMapLayerGroup("FRAVEITA").setVisibility(true);
	map.getMapLayer("Skolpbrunnar").setVisibility(true);
	map.getMapLayer("Skolp").setVisibility(true);
 	
 	map.getMapLayerGroup("REGNVATN").setVisibility(false);
 	map.getMapLayer("Regnvatn").setVisibility(false);
	map.getMapLayerGroup("HITAVEITA").setVisibility(false);
	map.getMapLayer("Hitav_st").setVisibility(false);
 	map.getMapLayer("Hitav_heim").setVisibility(false);
	map.getMapLayer("Hitav_brunnar").setVisibility(false);
	map.getMapLayerGroup("VATNSVEITA").setVisibility(false);
	map.getMapLayer("Vatnslagnir").setVisibility(false);
	map.getMapLayer("Lokar").setVisibility(false);
	map.getMapLayer("Brunahanar").setVisibility(false);
	map.getMapLayerGroup("SIMALAGNIR").setVisibility(false);
	map.getMapLayer("Simalagnir").setVisibility(false);
	map.getMapLayer("Simap").setVisibility(false);
	map.getMapLayerGroup("RAFVEITA").setVisibility(false);
	map.getMapLayer("Raflagnir").setVisibility(false);
	
	map.setAutoRefresh(true);
	map.refresh();
 }
 
 function warmwaterpipes_layer()
 {
 	var map = getMap();
 	map.setAutoRefresh(false);
 	map.getMapLayerGroup("FRAVEITA").setVisibility(false);
 	map.getMapLayer("Skolpbrunnar").setVisibility(false);
 	map.getMapLayer("Skolp").setVisibility(false);
 	map.getMapLayerGroup("REGNVATN").setVisibility(false);
 	map.getMapLayer("Regnvatn").setVisibility(false);
 	
 	map.getMapLayerGroup("HITAVEITA").setVisibility(true);
 	map.getMapLayer("Hitav_st").setVisibility(true);
 	map.getMapLayer("Hitav_heim").setVisibility(true);
 	map.getMapLayer("Hitav_brunnar").setVisibility(true);
	
 	map.getMapLayerGroup("VATNSVEITA").setVisibility(false);
 	map.getMapLayer("Vatnslagnir").setVisibility(false);
 	map.getMapLayer("Lokar").setVisibility(false);
 	map.getMapLayer("Brunahanar").setVisibility(false);
 	map.getMapLayerGroup("SIMALAGNIR").setVisibility(false);
 	map.getMapLayer("Simalagnir").setVisibility(false);
 	map.getMapLayer("Simap").setVisibility(false);
 	map.getMapLayerGroup("RAFVEITA").setVisibility(false);
 	map.getMapLayer("Raflagnir").setVisibility(false);
 	
 	map.setAutoRefresh(true);
 	map.refresh();
 }

function daywaterpipes_layer()
 {
 	var map = getMap();
 	map.setAutoRefresh(false);
 	map.getMapLayerGroup("FRAVEITA").setVisibility(false);
 	map.getMapLayer("Skolpbrunnar").setVisibility(false);
 	map.getMapLayer("Skolp").setVisibility(false);
 	
 	map.getMapLayerGroup("REGNVATN").setVisibility(true);
 	map.getMapLayer("Regnvatn").setVisibility(true);
 	
 	map.getMapLayerGroup("HITAVEITA").setVisibility(false);
 	map.getMapLayer("Hitav_st").setVisibility(false);
 	map.getMapLayer("Hitav_heim").setVisibility(false);
 	map.getMapLayer("Hitav_brunnar").setVisibility(false);
 	map.getMapLayerGroup("VATNSVEITA").setVisibility(false);
 	map.getMapLayer("Vatnslagnir").setVisibility(false);
 	map.getMapLayer("Lokar").setVisibility(false);
 	map.getMapLayer("Brunahanar").setVisibility(false);
 	map.getMapLayerGroup("SIMALAGNIR").setVisibility(false);
 	map.getMapLayer("Simalagnir").setVisibility(false);
 	map.getMapLayer("Simap").setVisibility(false);
 	map.getMapLayerGroup("RAFVEITA").setVisibility(false);
 	map.getMapLayer("Raflagnir").setVisibility(false);
 	
 	map.setAutoRefresh(true);
 	map.refresh();
 }

function electricity_layer()
 {
 	var map = getMap();
 	map.setAutoRefresh(false);
 	map.getMapLayerGroup("FRAVEITA").setVisibility(false);
 	map.getMapLayer("Skolpbrunnar").setVisibility(false);
 	map.getMapLayer("Skolp").setVisibility(false);
 	map.getMapLayerGroup("REGNVATN").setVisibility(false);
 	map.getMapLayer("Regnvatn").setVisibility(false);
 	map.getMapLayerGroup("HITAVEITA").setVisibility(false);
 	map.getMapLayer("Hitav_st").setVisibility(false);
 	map.getMapLayer("Hitav_heim").setVisibility(false);
 	map.getMapLayer("Hitav_brunnar").setVisibility(false);	
 	map.getMapLayerGroup("VATNSVEITA").setVisibility(false);
 	map.getMapLayer("Vatnslagnir").setVisibility(false);
 	map.getMapLayer("Lokar").setVisibility(false);
 	map.getMapLayer("Brunahanar").setVisibility(false);
 	map.getMapLayerGroup("SIMALAGNIR").setVisibility(false);
 	map.getMapLayer("Simalagnir").setVisibility(false);
 	map.getMapLayer("Simap").setVisibility(false);
 	
 	map.getMapLayerGroup("RAFVEITA").setVisibility(true);
 	map.getMapLayer("Raflagnir").setVisibility(true);
 	
 	map.setAutoRefresh(true);
 	map.refresh();
 }

function telephone_layer()
 {
 	var map = getMap();
 	map.setAutoRefresh(false);
 	map.getMapLayerGroup("FRAVEITA").setVisibility(false);
 	map.getMapLayer("Skolpbrunnar").setVisibility(false);
 	map.getMapLayer("Skolp").setVisibility(false);	
 	map.getMapLayerGroup("REGNVATN").setVisibility(false);
 	map.getMapLayer("Regnvatn").setVisibility(false);
 	map.getMapLayerGroup("HITAVEITA").setVisibility(false);
 	map.getMapLayer("Hitav_st").setVisibility(false);
 	map.getMapLayer("Hitav_heim").setVisibility(false);
 	map.getMapLayer("Hitav_brunnar").setVisibility(false);
 	map.getMapLayerGroup("VATNSVEITA").setVisibility(false);
 	map.getMapLayer("Vatnslagnir").setVisibility(false);
 	map.getMapLayer("Lokar").setVisibility(false);
 	map.getMapLayer("Brunahanar").setVisibility(false);
 	
 	map.getMapLayerGroup("SIMALAGNIR").setVisibility(true);
 	map.getMapLayer("Simalagnir").setVisibility(true);
 	map.getMapLayer("Simap").setVisibility(true);
 	
 	map.getMapLayerGroup("RAFVEITA").setVisibility(false);
 	map.getMapLayer("Raflagnir").setVisibility(false);
 	
 	map.setAutoRefresh(true);
 	map.refresh();
 }
 
function mainplan_on_off()
{
	var map = getMap();
	var layer = map.getMapLayerGroup("ADALSKIPULAG");
	if (layer == null)
		alert ("Aðalskipulag 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("VEGMANNVIRKI").setVisibility(true);
	map.getMapLayer("Gotur").setVisibility(true);
	map.getMapLayer("Gotur-Grunnframkvaemdir").setVisibility(false);
	
	map.setAutoRefresh(true);
	map.refresh();
}

function streets_construction_layer()
{
	var map = getMap();
	map.setAutoRefresh(false);
	
	map.getMapLayerGroup("VEGMANNVIRKI").setVisibility(true);
	map.getMapLayer("Gotur").setVisibility(false);
	map.getMapLayer("Gotur-Grunnframkvaemdir").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-Grunnframkvaemdir").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.getMapLayer("Gotur-Grunnframkvaemdir").setVisibility(false);
		
	map.setAutoRefresh(true);
	map.refresh();
}