function init()
{
svgMainDoc = document.svg_main.getSVGDocument();
svgLegDoc = document.svg_legend.getSVGDocument();
svgArrowDoc = document.svg_arrows.getSVGDocument();
layer = new Array;

//  Disable layers on startup with 'OFF'
layer[0] = 'ON';					//Council Districts 2007
layer[1] = 'ON';					//Water
layer[2] = 'ON';					//Airportrunway
layer[3] = 'ON';					//Creeks
layer[4] = 'ON';					//Railroad
layer[5] = 'ON';					//Road Network
layer[6] = 'ON';					//text
// ***************************************

for (i=0;i<layer.length;i++) {
if (layer[i]=='OFF') {
layeroff = svgMainDoc.getElementById(i);
glist = layeroff.getElementsByTagName('g');
layeroff.setAttribute('style','visibility:hidden');
for (j=0;j<glist.length;j++) {
legoff = svgLegDoc.getElementById('cbx'+i+'_'+j);
legoffstyle = legoff.getStyle();
legoffstyle.setProperty('fill','white');
}
}
}
legrect = svgLegDoc.getElementById('all');
textid = svgArrowDoc.getElementById('idObj').getFirstChild();
textscale = svgArrowDoc.getElementById('scale').getFirstChild();
origscale = 7027;
}
function onoff(cbx,theme)
{
mainobj = svgMainDoc.getElementById(theme);
mainstyle = mainobj.getStyle();
mainvis = mainstyle.getPropertyValue('visibility');
legobj = svgLegDoc.getElementById(cbx);
legstyle = legobj.getStyle();
legstylefill = legstyle.getPropertyValue('fill');
if (legstylefill == 'yellow')
{
legstyle.setProperty('fill','white');
mainstyle.setProperty('visibility','hidden');
}
else
{
legstyle.setProperty('fill','yellow');
mainstyle.setProperty('visibility','visible');
}
}
function zooming()
{
scalefactor = svgMainDoc.getDocumentElement().getCurrentScale();
mapscale = Math.round(origscale / scalefactor);
textscale.setData(mapscale);
}
function navclick(id)
{
leg = svgLegDoc.getElementById('leg');
legViewBox = leg.getAttribute('viewBox');
field = legViewBox.split(' ');
newY = parseFloat(field[1]);
newHeight = parseFloat(field[3]);
switch(id){
case 'down': newY = newY + 0.1*newHeight;
if (newY > (450.00-newHeight)){
newY = 450.00-newHeight;
}
if (newY < 0){
newY = 0;
}
break;
case 'up': newY = newY - 0.1*newHeight;
if (newY < 0){
newY = 0;
}
break;
}
newViewBox = field[0]+' '+newY+' '+field[2]+' '+field[3];
leg.setAttribute('viewBox',newViewBox);
}
function NewWin(targetURL)
{
nw = window.open('./data/'+targetURL,'new','width=300,height=300,locationbar=yes,menubar=no,scrollbars=yes,status=no,resizable=yes,screenX=700,screenY=330');
nw.focus();
}
function Triple(id,maptip)
{
textid.setData(maptip);
svgObj = svgMainDoc.getElementById(id);
svgStyle = svgObj.getStyle();
svgStyle.setProperty('fill-opacity','0.5');
}
function Out(id)
{
textid.setData(' ');
svgObj = svgMainDoc.getElementById(id);
svgStyle = svgObj.getStyle();
svgStyle.setProperty('fill-opacity','1.0')
}
