[Geoserver-devel] Getting Geoclient to work with GeoServerLite - Please help

Hi, I would appreciate someone could help me on this
issue. I have been trying to trace what is the problem
for the past few weeks.

I am trying out getting geoclient to work with
geoserverlite. Using apache server ver. 1.3.31 and php
version 4.3.6
Inserted mySQL database using the Java converter
(found @http://www.mycgiserver.com),through a dump
file. All my files (*.php,*.svg,*.js) are in one
directory "geoclient" under one single directory
(...\htdocs\geoclient\). I have tried different
shapefiles but still encounter the same error. Please
help.

I have attached the whole source code of
capabilities.php,simple_wfs.php,and client.svg.
Please enlighten me. Thank you. Sally

Followed instructions to edit the GetFeature
capability to point to GeoServerLite.

Capbilities.php

<GetFeature>
<ResultFormat>
<GML2/>
:
:
<Post
onlineResource="http://127.0.0.1/geoclient/simple_wfs.php&quot;/&gt;
:
:

-------------
simple_wfs.php
Replaced the original HTTP_RAW_POST_DATA source code
line with php://input
because I have the error which indicates
HTTP_RAW_POST_DATA undefined index,
though I had set the always_populate_raw_post_data and
register_globals to On
in the php.ini file.

//$data = $GLOBALS["HTTP_RAW_POST_DATA"]; //orig
$data=file_get_contents("php://input"); //debug //24
May 2004

-------------

Despite these modifications, I have the following
error
Microsoft JScript runtime error
'bboxinit' is undefined, line:541, column:4
After clicked the ok button of the error box,
I could only see the list of menu bar above, but there
is no map and
legend is empty.

-------------------

Source Codes...
###############################
capabilities.php - Source Code
###############################
<?
print '<?xml version="1.0" encoding="UTF-8"?>';
?>
<WFS_Capabilities version="0.0.14">
   <Service>
      <Name>SimpleWebFeatureServer</Name>
      <Title>Simple Feature Server</Title>
      <Abstract>Open source simple web feature server
- GeoServerLite</Abstract>
     
<OnlineResource>http://127.0.0.1/geoclient/simple_wfs.php&lt;/OnlineResource&gt;
   </Service>
   <Capability>
      <Request>
         <GetCapabilities>
            <DCPType>
               <HTTP>
                  <Post
onlineResource="<?=$thePath?>"/>
               </HTTP>
            </DCPType>
         </GetCapabilities>
         <DescribeFeatureType>
            <SchemaDescriptionLanguage>
               <XMLSCHEMA/>
            </SchemaDescriptionLanguage>
            <DCPType>
               <HTTP>
                  <Post
onlineResource="<?=$thePath?>"/>
               </HTTP>
            </DCPType>
         </DescribeFeatureType>
         <GetFeature>
            <ResultFormat>
               <GML2/>
            </ResultFormat>
            <DCPType>
               <HTTP>
                  <Post
onlineResource="http://127.0.0.1/geoclient/simple_wfs.php&quot;/&gt;
               </HTTP>
            </DCPType>
         </GetFeature>
         <Transaction>
            <DCPType>
               <HTTP>
                  <Post
onlineResource="<?=$thePath?>"/>
               </HTTP>
            </DCPType>
         </Transaction>
      </Request>
      <VendorSpecificCapabilities>
         <GetExtendedProjectDescriptor>
            <DCPType>
               <HTTP>
                  <Post
onlineResource="<?=$thePath?>"/>
               </HTTP>
            </DCPType>
         </GetExtendedProjectDescriptor>
         <GetStyledLayerDescriptor>
            <DCPType>
               <HTTP>
                  <Post
onlineResource="<?=$thePath?>"/>
               </HTTP>
            </DCPType>
         </GetStyledLayerDescriptor>
         <GetExtendedLayerDescriptor>
            <DCPType>
               <HTTP>
                  <Post
onlineResource="<?=$thePath?>"/>
               </HTTP>
            </DCPType>
         </GetExtendedLayerDescriptor>
      </VendorSpecificCapabilities>
   </Capability>
<?
    //debug//added in to solve writeTag undefined
issue
    include('convertgeom.php');
    include('connect.php');
    //?=$thePath? for the above...
    //debug
    
    $depth=1;
   
writeTag("open",null,"FeatureTypeList",null,True,True);
    $depth++;
    //$sql="SELECT TableName FROM Layers ORDER BY
LayerID DESC";//orig
    $sql="SELECT TableName FROM Layers ORDER BY
LayerID DESC";
    //print($sql);//debug //21 May 2004
    $result = mysql_query($sql,$db);
    
      while ($myrow = mysql_fetch_array ($result)) {
      $TableName=$myrow["TableName"];
     
writeTag("open",null,"FeatureType",null,True,True);
      $depth++;
      writeTag("open",null,"Name",null,True,False);
      //echo $TableName;
      writeTag("close",null,"Name",null,False,True);
      $depth--;
     
writeTag("close",null,"FeatureType",null,True,True);
    }
    $depth--;
   
writeTag("close",null,"FeatureTypeList",null,True,True);
?>
</WFS_Capabilities>

###############################
simple_wfs.php - Source Code
###############################

<?
//added NR
ob_start("ob_gzhandler");
include('connect.php');
include('convertgeom.php');

//$data = $GLOBALS["HTTP_RAW_POST_DATA"]; //orig
$data=file_get_contents("php://input"); //debug //24
May 2004

//print_r($GLOBALS);//debug //20 May 2004
$thePath= "http://".$SERVER_NAME.$PHP_SELF;
//echo $thePath; //debug
$server="http://".$SERVER_NAME;
//echo $server; //debug

$BBox=null;
//added NR
$disjoints=array();
$NotDisjoints=array();
$disjointCoords=array();
$notDisjointCoords=array();
//end added
$currentTable=null;
$currentTag=null;
$gen=array();
$gen[0]="";
$level=0;
$depth=0;
$tables=array();
$fields=array();
$wheres=array();
$limits=array();

function startElement($parser, $name, $attrs) {
  global $BBox;
  global $currentTag;
  global $currentTable;
  global $gen;
  global $level;
  global $depth;
  global $tables;
  global $fields;
  global $limits;
  $level++;
  $currentTag = $name;
  $gen[$level]=$currentTag;
  if($level>0){
    if
(($gen[($level)-1]=="Insert")||($gen[($level)-1]=="Update")){
      $tables=$currentTag;
    }
  }
  switch($currentTag){
    case "GetExtendedProjectDescriptor":
       getExtendedProjectDescriptor();
       break;
    case "GetStyledLayerDescriptor":
       getStyledLayerDescriptor();
       break;
    case "GetExtendedLayerDescriptor":
       getExtendedLayerDescriptor();
       break;
    case "GetCapabilities":
      getCapabilities();
      break;
    case "GetFeature":
      if (sizeof($attrs)) {
        while (list($k, $v) = each($attrs)) {
          if ($k=="maxFeatures"){
            $limits[$currentTable]=$v;
          }
        }
      }
     
writeTag("open","gml","featureCollection",null,True,True);
      $depth++;
      break;
    case "Query":
      if (sizeof($attrs)) {
        while (list($k, $v) = each($attrs)) {
          if ($k=="typeName"){
            $currentTable=$v;
            $tables=$currentTable;
            $fields[$currentTable]=array();
          }
        }
      }
      break;
  }
}

function endElement($parser, $name) {
  global $currentTag;
  global $fields;
  global $fieldCount;
  global $level;
  global $depth;
  $currentTag=$name;
  switch($currentTag){
    case "GetFeature":
      doQuery("Select");
      $depth--;
     
writeTag("close","gml","featureCollection",null,True,False);
      break;
//added NR
    case "DescribeFeatureType":
      getXSD();
      break;
//end added NR
    case "Query":
      break;
    case "Insert":
      doQuery("Insert");
      $fields=null;
      break;
    case "Update":
      doQuery("Update");
      $fields=null;
      break;
    case "Delete":
      doQuery("Delete");
      $fields=null;
      break;
  }
  $level--;
  $currentTag = null;
  }

// process data between tags
function characterData($parser, $data) {
  global $currentTable;
  global $currentTag;
//added NR
  global $tables;
//end added NR
  global $fields;
  global $gen;
  global $level;
  global $depth;
  global $BBox;
//added NR
  global $disjointCoords;
  global $notDisjointCoords;
//end added
// echo "currenttag: '".$currentTag."' gen-2:
'".$gen[$level-2]."' gen-3: '".$gen[$level-3]."' data:
".$data. " ";

  $pos=strpos($currentTag, "coordi");

  if(!(empty($pos))){
      switch($gen[$level-2]){
        case "BBOX":
          $BBox=$data;
          break;
        case "Disjoint":
// echo "disjoint: ".$data;
          if($gen[$level-3]=="Not"){
// echo "not";
            $notDisjointCoords=$data;
          }
          else{
            $disjointCoords=$data;
          }
          break;
        default:
          break;
      }
  }
  switch ($currentTag) {
//added NR
    case "PropertyName":
      switch($gen[$level-1]){
        case "Disjoint":
          if($gen[$level-2]=="Not"){
            disjoint($data,true);
          }
          else{
            disjoint($data,false);
          }
          break;
        default:
          break;
      }
      break;
//end added NR
    case "TypeName":
      if($gen[$level-1]=="DescribeFeatureType"){
        $tables=$data;
      }
      break;

    case "PropertyName":
      $fields[$currentTable]=$data;
      break;
    default:
      break;
  }
}

function getCapabilities(){
  global $thePath;
  global $db;
  include('capabilities.php');
}

//end added NR
function intersects($Box){
  $Box=str_replace (","," ", $Box);
  $coords = explode(" ", $Box);
  $XMin=$coords[0];
  $YMin=$coords[1];
  $XMax=$coords[2];
  $YMax=$coords[3];
  return "((XMin BETWEEN $XMin AND $XMax ) AND
(YMin BETWEEN $YMin AND $YMax )) OR ((XMin BETWEEN
$XMin AND $XMax ) AND (YMax BETWEEN $YMin AND
$YMax )) OR ((XMax BETWEEN $XMin AND $XMax ) AND
(YMin BETWEEN $YMin AND $YMax )) OR ((XMax BETWEEN
$XMin AND $XMax ) AND (YMax BETWEEN $YMin AND
$YMax )) OR ((XMin < $XMin ) AND (YMin < $YMin )
AND (XMax > $XMax ) AND (YMax > $YMax )) OR ((XMin
BETWEEN $XMin AND $XMax ) AND (YMin < $YMin ) AND
(YMax > $YMax )) OR ((XMax BETWEEN $XMin AND $XMax
) AND (YMin < $YMin ) AND (YMax > $YMax )) OR ((YMin
BETWEEN $YMin AND $YMax ) AND (XMin < $XMin ) AND
(XMax > $XMax )) OR ((YMax BETWEEN $YMin AND $YMax
) AND (XMin < $XMin ) AND (XMax > $XMax ))";
}

function getExtendedProjectDescriptor(){
  global $thePath;
  global $depth;
  global $db;
  include('EPD.php');
}

function getStyledLayerDescriptor(){
  global $thePath;
  global $depth;
  global $db;
  include('SLD.php');
}

function getExtendedLayerDescriptor(){
  global $thePath;
  global $depth;
  global $db;
  include('ELD.php');
}

//added NR
function getXSD(){
  global $server;
  global $depth;
  global $db;
  global $tables;
  include('XSD.php');
}
//end added NR

function doQuery($queryType){
  global $currentTag;
  global $BBox;
  global $tables;
  global $fields;
  global $values;
  global $wheres;
  global $limits;
//added NR
  global $disjoints;
  global $notDisjoints;
  global $disjointCoords;
  global $notDisjointCoords;
//end added
  switch ($queryType) {
    case "Select":
      foreach($tables as $table){
        $sql="SELECT ";
        if (!(empty($fields[$table]))){
          foreach ($fields as $field){
            $sql = $sql. $field.",";
          }
        }
        else {
          $sql .= " * ";
        }
        $sql2 = "SELECT Min(XMin) AS TXMin,Max(XMax)
AS TXMax, Min(YMin) AS TYMin,Max(YMax) AS TYMax ";
        $from = " FROM ".$table;
        if
((!(empty($BBox)))||(sizeof($wheres))||(sizeof($disjointCoords))||(sizeof($notDisjointCoords))){
          $from .= " WHERE ";
        }
        if (!(empty($BBox))){
          $from .= intersects($BBox)." AND ";
        }
        if (sizeof($notDisjoints)){
          for($i=0;$i<sizeof($notDisjoints);$i++){
            foreach($notDisjoints[$i] as
$notDisjoint){
              if($notDisjoint==$table){
                $from .= "
(".intersects($notDisjointCoords[$i]).") AND ";
                break;
              }
            }
          }
        }
        if (sizeof($disjoints)){
          for($i=0;$i<sizeof($disjoints);$i++){
            foreach($disjoints[$i] as $disjoint){
              if($disjoint==$table){
                $from .= "
(NOT(".intersects($disjointCoords[$i]).")) AND ";
                break;
              }
            }
          }
        }
        if (sizeof($wheres)) {
          while (list($k, $v) = each($wheres)) {
            //note: incomplete: needs test for data
type of field
            $from .= " (" . $k . "=" . $v . ") AND ";
          }
        }
        if
((!(empty($BBox)))||(sizeof($wheres))||(sizeof($disjointCoords))||(sizeof($notDisjointCoords))){
          $from=dropLastChrs($from,4);
        }
        if (!(empty($limits[$table]))){
          $from .= " LIMIT " . $limits[$table];
        }
        doSelect($table,$sql,$sql2,$from);
      }
      break;
    case "Insert":
      $sql="INSERT INTO " . $table;
      echo $sql;
      break;
    default:
      break;
  }
}

//added NR
function disjoint($data,$Not){
  global $disjoints;
  global $notDisjoints;
  $posOr = strpos($data, "|");
  if($Not==true){
    $num=count($notDisjoints);
    $notDisjoints[$num]=array();
    if(!(empty($posOr))){
      $tables = explode("|", $data);
      foreach($tables as $table){
        $posSlash = strpos($table, "/");
        $table = substr($table, 0, $posSlash);
        $notDisjoints[$num]=$table;
      }
    }
    else{
      $posSlash = strpos($data, "/");
      $table = substr($data, 0, $posSlash);
      $notDisjoints[$num]=$table;
    }
  }
  else{
    $num=count($disjoints);
    $disjoints[$num]=array();
    if(!(empty($posOr))){
      $tables = explode("|", $data);
      foreach($tables as $table){
        $posSlash = strpos($table, "/");
        $table = substr($table, 0, $posSlash);
        $disjoints[$num]=$table;
      }
    }
    else{
      $posSlash = strpos($data, "/");
      $table = substr($data, 0, $posSlash);
      $disjoints[$num]=$table;
    }
  }
}

function genBBox($XMin,$YMin,$XMax,$YMax){
  global $depth;
  global $tables;
  global $db;
  writeTag("open","gml","boundedBy",null,True,True);
  $depth++;
  writeTag("open","gml","Box",null,True,True);
  $depth++;

writeTag("open","gml","coordinates",null,True,False);
  print $XMin.",".$YMin." ".$XMax.",".$YMax;

writeTag("close","gml","coordinates",null,False,True);
  $depth--;
  writeTag("close","gml","Box",null,True,True);
  $depth--;
  writeTag("close","gml","boundedBy",null,True,True);
}

function doSelect($table,$sql,$sql2,$from){
  global $db;
  global $depth;
  $sql.=$from;
  $sql2.=$from;
// echo $sql;
// echo $sql2;
  $result = mysql_query($sql2,$db);
  while ($myrow = mysql_fetch_array($result)){
    if(!(empty($myrow["TXMin"]))){
//added NR
     
genBBox($myrow["TXMin"],$myrow["TYMin"],$myrow["TXMax"],$myrow["TYMax"]);
    }
    else{
      return;
    }
  }
  $result = mysql_query($sql,$db);
  while ($myrow = mysql_fetch_array($result)){
     
writeTag("open","gml","featureMember",null,True,True);
      $depth++;
      writeTag("open",null,$table,null,True,True);
      $depth++;
      for ($i=0;($i < mysql_num_fields ($result))
;$i++) {
        $FieldName=mysql_field_name($result, $i);
        $FieldValue=$myrow[$FieldName];
        if (!(empty($FieldValue))){
          if
(($FieldName!="Geometry")&&($FieldName!="TXMin")&&($FieldName!="TYMin")&&($FieldName!="TXMax")&&($FieldName!="TYMax")){
           
writeTag("open",null,$table.".".$FieldName,null,True,False);
            echo $FieldValue;
           
writeTag("close",null,$table.".".$FieldName,null,False,True);
          }
          else{
           
writeTag("open",null,$table.".".$FieldName,null,True,True);
            $depth++;
            convertGeom($FieldValue);
            $depth--;
           
writeTag("close",null,$table.".".$FieldName,null,True,True);
          }
        }
      }
      $depth--;
      writeTag("close",null,$table,null,True,True);
      $depth--;
     
writeTag("close","gml","featureMember",null,True,True);
  }
}

function dropLastChrs($str,$no) {
  $strLen=strlen($str);
  return (substr($str,0,($strLen)-$no));
}

// initialize parser
$xml_parser = xml_parser_create();

// set callback functions
xml_set_element_handler($xml_parser, "startElement",
"endElement");
xml_set_character_data_handler($xml_parser,
"characterData");
xml_parser_set_option($xml_parser,
XML_OPTION_CASE_FOLDING, 0);
    
if(!xml_parse($xml_parser, $data))
{
  echo "XML error:
".xml_error_string(xml_get_error_code($parser))." at
line ". xml_get_current_line_number($parser);
}

// clean up
xml_parser_free($xml_parser);

?>

###############################
geoclient.svg - Source Code
###############################
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd&quot;&gt;
<?AdobeSVGViewer save="snapshot"?>

<!--
This is an open source project (see definition at
http://www.opensource.org/docs/definition_plain.html).
and is distributed under the GNU General Public
License (see http://www.gnu.org/copyleft/gpl.html).
GeoClient is part of the GeoServer project, see
http://geoserver.sourceforge.net
-->

<svg id="thesvg"
onload="init(evt);arrangeSVG(evt,0.8);initzp(evt)"
     xmlns="http://www.w3.org/2000/svg&quot;
     xmlns:gml="http://www.opengis.org/gml&quot;
     xmlns:xlink="http://www.w3.org/1999/xlink&quot;&gt;

<script xlink:href="geoclient.js"/>
<script xlink:href="legend.js"/>
<script><![CDATA[
var showCalls=null;
//uncomment these next two lines to avoid the two
initial prompts when application loads
//wfsPath="simple_wfs.php"; //orig
//showCalls=false;
if(showCalls==null){
  showCalls=confirm("Display requests and
responses?");
}
var svgdoc;
var theLayers= new Array();
var wfsPath;
//added NR
var pathadder=null;
var pathadder2;
var zoomer;
var panner;
var startNew=false;
var origX;
var origY;
var newX;
var newY;
var startX;
var startY;
var oldX;
var oldY;
//added NR
//global variable for bounding box, if set through url
var bbox=null;
var currentMapScale;
var maxScales=new Array();
var minScales=new Array();
//read any url-encoded variables
function readVars(){
/*
//commented out because not working in NS 4
  str=unescape(location.search.substring(1));
  if (str){
    ampIndex=str.indexOf("&");
    if(ampIndex!=-1){
      var strPairs=str.split("&");
    }
    else{
      var strPairs=new Array();
      strPairs[0]=str;
    }
    for(i=0;i<strPairs.length;i++){
      strVars = strPairs[i].split("=");
      switch(strVars[0]){
        case "bbox":
          bbox=strVars[1];
          ext=getExtent(bbox);
          createExtent(ext);
          break;
        case "wfsPath":
          wfsPath=strVars[1];
          break;
      }
    }
*/
}
//end added NR

function init(evt){
//added NR
  readVars();
//end added NR
  svgdoc = evt.getTarget().getOwnerDocument();
  getCapabilities();
}

function getCapabilities(){
  statusText("request","capabilities");
  theCall=svgdoc.createElement("GetCapabilities");
  nodeText=printNode(theCall);
  if(showCalls==true){
    alert(nodeText);
  }
//added NR
  if(wfsPath==null){
//end added NR
    wfsPath=prompt("Enter path to web feature
server","simple_wfs.php");
//added NR
  }
//end added NR

result=postURL(wfsPath,nodeText,parseCapabilities,"text/plain",null);//orig
}

function getExtent(ext){
  reComma=new RegExp(",", "g");
  ext=ext.replace(reComma," ");
  return ext.split(" ");
}

function createExtent(extent){
  xmin = extent[0];
  ymin = extent[1];
  width= extent[2] - extent[0];
  height= extent[3] - extent[1];
  height2= ((extent[3]) - (-1*(extent[1])));
//added NR
//so that events will be captured on <svg id="map">
element
  backgr=svgdoc.getElementById("bg");
  backgr.setAttribute("x",xmin);
  backgr.setAttribute("y",ymin);
  backgr.setAttribute("width",width);
  backgr.setAttribute("height",height);
//end added NR

svgdoc.getElementById('map').setAttribute("viewBox",xmin+"
" +ymin+" "+width+" "+height);

svgdoc.getElementById('keyMap').setAttribute("viewBox",xmin+"
" +ymin+" "+width+" "+height);
  matrix="matrix(1 0 0 -1 0 "+height2+")";
  mapLayers = svgdoc.getElementById("mapLayers");
  mapLayers.setAttribute("transform",matrix);
  keyMapLayers =
svgdoc.getElementById("keyMapLayers");
  keyMapLayers.setAttribute("transform",matrix);
}

function statusText(type,content){
  switch(type){
    case "request":
      window.status="Requesting "+content+" from
server...";
      break;
    case "response":
      window.status="Parsing "+content+"...";
      break;
  }
}

function dropNS(str,ns){
  reNS=new RegExp(ns+":", "g");
  str=str.replace(reNS,"");
  return str;
}

//added NR

function addNS(str,ns,elt){
  reNS=new RegExp(elt, "g");
  str=str.replace(reNS,ns+":"+elt);
  return str;
}

//end added NR

function trimHeader(str){
  strlen=str.length;
  endindex=str.indexOf("?>"); //debug
  if(endindex!=-1){ //if ==-1 means the srch string is
not found
    str = (str.substring(endindex+2,strlen));
   }
  return str;
}

function trimLastCh(str){
  strlen=str.length;
  str = (str.substring(0,strlen-1));
  return str;
}

function parseCapabilities(res){

  statusText("response","capabilities");
  text=res.content;
  if(text==""){
    alert("Empty response from server.");
  }
  else{
    genFeatLater=false;
    
    text=trimHeader(text);

    var thenode =
svgdoc.getElementById("capabilities");
  
    newNode = parseXML( text, svgdoc );

    if(showCalls==true){
      prompt("Capabilities response:
",printNode(newNode));
    }
    subnode=newNode.firstChild;
    thenode.appendChild (subnode);
//added NR
   
if((text.indexOf("GetExtendedProjectDescriptor"))!=-1){
      alert("getEPD after append child");//debug
      getEPD();
    }
//end added NR
   
if((text.indexOf("GetStyledLayerDescriptor"))!=-1){
      getSLD();
    }
   
if((text.indexOf("GetExtendedLayerDescriptor"))!=-1){
      getELD();
      genFeatLater=true;
    }
//edited NR
    if((text.indexOf("DescribeFeatureType"))!=-1){
      getXSD();
    }
//end edited NR
    if(genFeatLater==false){
      genFeatureList();
    }
  }
}

//also added <g id="xsd"> to svg element
function getXSD(){
  statusText("request","XML schema");
  theCall=svgdoc.createElement("DescribeFeatureType");
  theCall.setAttribute("outputFormat","XMLSCHEMA");
  var thenode = svgdoc.getElementById("capabilities");
//added NR

path=thenode.getElementsByTagName("DescribeFeatureType").item(0).getElementsByTagName("Post").item(0).getAttribute("onlineResource");
//end added NR

theFeatureTypes=thenode.getElementsByTagName('FeatureType');
  for (i=0;i<theFeatureTypes.length;i++){
   
name=theFeatureTypes.item(i).getElementsByTagName('Name').item(0).firstChild.nodeValue;
    text=svgdoc.createTextNode(name);
    typeName=svgdoc.createElement("TypeName");
    typeName.appendChild(text);
    theCall.appendChild(typeName);
  }
  nodeText=printNode(theCall);
  if(showCalls==true){
    alert(nodeText);
  }
//edited NR (wfsPath to path)

result=postURL(path,nodeText,parseXSD,"text/plain",null);
//end edited NR
}

function parseXSD(res){
  statusText("response","XML schema");
  text=res.content;
  if((text=="")||(text==null)){
    alert("Empty response from server.");
  }
  else{
    text=dropNS(text,"gml");
    text=dropNS(text,"xsd");
    text=trimHeader(text);
    var thenode = svgdoc.getElementById("xsd");
    newNode = parseXML( text, svgdoc );
    if(showCalls==true){
      prompt("XMLSchema response:
",printNode(newNode));
// prompt("XMLSchema response: ",text);
    }
    subnode=newNode.firstChild;
    thenode.appendChild (subnode);
    listFields();
  }
}

function listFields(){
  text="";
  var thenode = svgdoc.getElementById("xsd");

theComplexTypes=thenode.getElementsByTagName('complexType');
  for (i=0;i<theComplexTypes.length;i++){
   
table=theComplexTypes.item(i).getAttribute('name');
    nameLength=table.length;
    typeIndex=table.indexOf("_Type");
    if(typeIndex!=-1){
      table =
(table.substring(0,nameLength-typeIndex+1));
    }
    text += "table "+i+": "+table+" ";
   
theElements=theComplexTypes.item(i).getElementsByTagName('element');
    for(j=0;j<theElements.length;j++){
     
fieldName=theElements.item(j).getAttribute("name");
      fieldNameLength=fieldName.length;
      periodIndex=fieldName.indexOf(".");
      if(periodIndex!=-1){
        fieldName =
(fieldName.substring(periodIndex,fieldNameLength));
      }
      text += "field "+j+": "+fieldName+" ";
    }
  }
  if(showCalls==true){
    alert(text);
  }
}

//added NR
//also added <g id="epd"> to svg element
function getEPD(){
  statusText("request","extended project descriptor");

theCall=svgdoc.createElement("GetExtendedProjectDescriptor");
  nodeText=printNode(theCall);
  if(showCalls==true){
    alert(nodeText);
  }
//added NR

path=svgdoc.getElementById("capabilities").getElementsByTagName("GetExtendedProjectDescriptor").item(0).getElementsByTagName("Post").item(0).getAttribute("onlineResource");
//end added NR

result=postURL(path,nodeText,parseEPD,"text/plain",null);
}

var scaleFactor=null;
function parseEPD(res){
  statusText("response","extended project
descriptor");
  text=res.content;
  if(text==""){
    alert("Empty response from server.");
  }
  else{
    text=trimHeader(text);
    var thenode = svgdoc.getElementById("epd");
    newNode = parseXML( text, svgdoc );
    subnode=newNode.firstChild;
    if(showCalls==true){
      prompt("EPD response: ",printNode(subnode));
    }
    thenode.appendChild (subnode);
   
theEPD=svgdoc.getElementsByTagName("ExtendedProjectDescriptor").item(0);
    theSFnl =
theEPD.getElementsByTagName("ScaleFactor");
    theSFnl.length==0 ? scaleFactor =null :
scaleFactor = theSFnl.item(0).firstChild.nodeValue;
    if(bbox==null){
      theBBnl = theEPD.getElementsByTagName("BBox");
      bboxinit = theBBnl.item(0).firstChild.nodeValue;
      ext=getExtent(bboxinit);
      createExtent(ext);
    }
    calcScale();
  }
}

//global variable scale of map at initial load
var baseScale=null;
function calcScale(){

  mapv=svgdoc.getElementById("map");
  mapW = parseFloat(mapv.getAttribute('width'));

  mvb=mapv.getAttribute("viewBox").split(" ");

  mapGW=(parseFloat(mvb[2]))-(parseFloat(mvb[0]));
  baseScale=mapGW/(mapW*scaleFactor);
  currentMapScale=baseScale;
}

//end added NR

function getSLD(){
  statusText("request","styled layer descriptor");

theCall=svgdoc.createElement("GetStyledLayerDescriptor");
  nodeText=printNode(theCall);
  if(showCalls==true){
    alert(nodeText);
  }

result=postURL(wfsPath,nodeText,parseSLD,"text/plain",null);
}

function parseSLD(res){
  statusText("response","styled layer descriptor");
  text=res.content;
  if(text==""){
    alert("Empty response from server.");
  }
  else{
    text=trimHeader(text);
    var thenode = svgdoc.getElementById("sld");
    newNode = parseXML( text, svgdoc );
    if(showCalls==true){
      prompt("SLD response: ",printNode(newNode));
    }
    subnode=newNode.firstChild;
    thenode.appendChild (subnode);
  }
}

function getELD(){
  statusText("request","extended layer descriptor");

theCall=svgdoc.createElement("GetExtendedLayerDescriptor");
  nodeText=printNode(theCall);
  if(showCalls==true){
    alert(nodeText);
  }

result=postURL(wfsPath,nodeText,parseELD,"text/plain",null);
}

function parseELD(res){
  statusText("response","extended layer descriptor");
  text=res.content;
  if(text==""){
    alert("Empty response from server.");
  }
  else{
    text=trimHeader(text);
    var thenode = svgdoc.getElementById("eld");
    newNode = parseXML( text, svgdoc );
    subnode=newNode.firstChild;
    if(showCalls==true){
      prompt("ELD response: ",printNode(subnode));
    }
    thenode.appendChild (subnode);
  }
//added NR
  setScaleThresholds();
  genFeatureList();
//end added NR
}

//added NR

function setScaleThresholds(){

theELD=svgdoc.getElementsByTagName("ExtendedLayerDescriptor").item(0);
  theELDNL =theELD.getElementsByTagName("NamedLayer");
  for(i=0;i<theELDNL.length;i++){
    enlnod=theELDNL.item(i);
    theName=enlnod.getAttribute("name");
    theMaxnl =
enlnod.getElementsByTagName("MaxScale");
    theMaxnl.length==0 ? maxScales[theName] =null :
maxScales[theName] =
theMaxnl.item(0).firstChild.nodeValue;
    theMinnl =
enlnod.getElementsByTagName("MinScale");
    theMinnl.length==0 ? minScales[theName] =null :
minScales[theName] =
theMinnl.item(0).firstChild.nodeValue;
  }
}

//end added NR
function genFeatureList(){
  var thenode = svgdoc.getElementById("capabilities");

theFeatureTypes=thenode.getElementsByTagName('FeatureType');
  for (i=0;i<theFeatureTypes.length;i++){
   
theLayers[i]=theFeatureTypes.item(i).getElementsByTagName('Name').item(0).firstChild.nodeValue;
    writeLayer(theLayers[i],i);
  }
//added NR
  addExtras();
//end added NR
  var sld = svgdoc.getElementById("sld");
  if(sld.hasChildNodes()==true){
    layerNodes=sld.getElementsByTagName("NamedLayer");
    for(i=0;i<layerNodes.length;i++){
     
itemName=layerNodes.item(i).getAttribute("name");
     
childs=layerNodes.item(i).getElementsByTagName("UserStyle").item(0).childNodes;
      for(j=0;j<childs.length;j++){
       
if((childs.item(j).nodeName=="PolygonSymbol")||(childs.item(j).nodeName=="LineStringSymbol")||(childs.item(j).nodeName=="PointSymbol")){
          atts=childs.item(j).childNodes;
          break;
        }
      }
      layerStyle =
svgdoc.getElementById("l"+itemName).getStyle();
      for(k=0;k<atts.length;k++){
        switch(atts.item(k).nodeName){
          case "FillColor":
           
layerStyle.setProperty("fill",atts.item(k).firstChild.nodeValue);
            break;
          case "StrokeColor":
           
layerStyle.setProperty("stroke",atts.item(k).firstChild.nodeValue);
            break;
          default:
            break;
        }
      }
    }
  }
  else{
    for (i=0;i<theFeatureTypes.length;i++){
     
layerStyle=svgdoc.getElementById("l"+theFeatureTypes.item(i).getElementsByTagName('Name').item(0).firstChild.nodeValue).getStyle();
      layerStyle.setProperty("stroke","black");
    }
  }
//edited NR
  if(bbox==null){
    getFeatureInit();
  }
  else{
    getFeature();
  }
//end edited NR
}

function writeLayer(layer,index){
  theMapLayer=svgdoc.createElement("g");
  theMapLayer.setAttribute("id","l"+layer);
  mapNode = svgdoc.getElementById("mapLayers");
  mapNode.appendChild(theMapLayer);
}

//changed function name NR
function getFeatureInit(){
  statusText("request","features");
  theCall=svgdoc.createElement("GetFeature");
  theCall.setAttribute("maxFeatures", "1000" );
  for(i=0;i<theLayers.length;i++){
    if(baseScale!=null){
      if(isDisplayed(theLayers[i],baseScale,true)){
        theQuery=svgdoc.createElement("Query");
       
theQuery.setAttribute("typeName",theLayers[i]);
        theQuery=theCall.appendChild(theQuery);
      }
    }
    else{
      theQuery=svgdoc.createElement("Query");
      theQuery.setAttribute("typeName",theLayers[i]);
      theQuery=theCall.appendChild(theQuery);
    }
  }
  queries=svgdoc.getElementById("queries");
  queries.appendChild(theCall);
  nodeText=printNode(theCall);
  if(showCalls==true){
    alert("Request: "+nodeText);
  }

result=postURL(wfsPath,nodeText,parseFeatureMembers,"text/plain",null);
}

function parseFeatureMembers(res){
  statusText("response","features");
  text=res.content;
//prompt("FeatureMembers result: ",text);
  if(text==""){
    alert("Empty response from server.");
  }
  else{
    text=dropNS(text,"gml");
    text=trimHeader(text);
    node = parseXML( text, svgdoc );
    subnode=node.firstChild;
    if(showCalls==true){
      prompt("FeatureMembers result:
",printNode(subnode));
    }
   
featureCollections=svgdoc.getElementById("featureCollections");
    featureCollections.appendChild(subnode);
//added/changed NR
    if((bbox==null)&&(bboxinit==null)){
     
boundedBy=subnode.getElementsByTagName("boundedBy").item(0);
     
bboxinit=boundedBy.getElementsByTagName("coordinates").item(0).firstChild.nodeValue;
      ext=getExtent(bboxinit);
      createExtent(ext);
    }
//end added/changed NR
   
features=subnode.getElementsByTagName("featureMember");
  var prevlayer = "";
  var idxxx=1;
    for (i=0;i<features.length;i++){
      childs=features.item(i).childNodes;
      for(j=0;j<childs.length;j++){
        theNodeName=childs.item(j).nodeName;
        if(theNodeName!="#text"){
          layer=theNodeName;
          break;
        }
      }
    layer==prevlayer ? idxxx+=1 : idxxx=1;
      genFeature(layer,features.item(i),idxxx);
    prevlayer = layer;
    }
  }
//modified NR
//test if panbox already created...
  pbExists=false;
  rects=svgdoc.getElementsByTagName("rect");
  if(rects.length>0){
    for(i=0;i<rects.length;i++){
      if(rects.item(i).getAttribute("id")=="panBox"){
        pbExists=true;
        break;
      }
    }
  }
  if(!pbExists){
    addEvents();
    addPanBox();
  }
//to adjust circle radii on any newly created points
  resetSymbols();
//end modified NR
}

function genFeature(layer,node,idxxx){
  coords=node.getElementsByTagName("coordinates");
  //if there is only one point, assume that it is a
point layer

if((coords.length==1)&&(coords.item(0).firstChild.nodeValue.indexOf("
")==-1)){
   
geom=coords.item(0).firstChild.nodeValue.split(",");
    cx=geom[0];
    cy=geom[1];
    addPoint(layer,cx,cy,idxxx);
  }
  //otherwise, begin generating a path
  else{
    d="";
    for (j=0;j<coords.length;j++){
    itemx=coords.item(j).firstChild.nodeValue;
      reSpace=new RegExp(" ", "g");
      reComma=new RegExp(",", "g");
      itemx=itemx.replace(reSpace," L ");
      itemx=itemx.replace(reComma," ");
      d += "M "+itemx;
    }
    addPath(layer,d,idxxx);
  }
}

function addPath(layer,d,idxxx) {
  var newnodea=svgdoc.createElement("path");
  newnodea.setAttribute('d', d);
  newnodea.setAttribute('id', "l"+layer+"f"+idxxx);
  var mapNode = svgdoc.getElementById("l"+layer);
  mapNode.appendChild(newnodea);
}

var oldlayer=""; //these two global variables to make
sure we recalculate only when the layer change
var rsize=0;
function addPoint(layer,cx,cy,idxxx) {
  var newnodea=svgdoc.createElement("circle");
  newnodea.setAttribute('cx', cx);
  newnodea.setAttribute('cy', cy);
  newnodea.setAttribute('id', "l"+layer+"f"+idxxx);
//changed nr
  if (oldlayer!=layer) rsize =
calcSize(layer,"SymbolSize");
//end changed nr
  newnodea.setAttribute('r', rsize);
  var mapNode = svgdoc.getElementById("l"+layer);
  mapNode.appendChild(newnodea);
  oldlayer = layer;
}

//added AR : to calculate the marker size relative to
viewBox; strokeWidth calculated on Legend functions
function calcSize(theLayer,setting){
    eld =
svgdoc.getElementsByTagName("ExtendedLayerDescriptor").item(0);
    eldnl = eld.getElementsByTagName("NamedLayer");
    for (ix=0;ix<eldnl.length;ix++){
    eldnli=eldnl.item(ix);
    if (eldnli.getAttribute('name')==theLayer) {
//changed nr
      ssz = eldnli.getElementsByTagName(setting);
//end changed nr
      thesize =
parseFloat(ssz.item(0).firstChild.nodeValue);
    }
  }
//changed NR
  return getSize(thesize);
}
//added NR
function getSize(thesize){
  map = svgdoc.getElementById("map");
  mapWd = parseFloat(map.getAttribute('width'));
  screenWd = parseFloat(screen.width);
  mapVb = map.getAttribute('viewBox').split(' ');
  vbWd = parseFloat(mapVb[2]);
  resultsize = parseFloat(thesize*vbWd/screenWd);
  return resultsize;
}

function doZoom(){
  SetStaticZP();
  resetSymbols();
  if(baseScale!=null){
    getFeature();
  }
}

function doScroll(){
  SetStaticZP();
if(baseScale!=null){
// getFeature();
}
}

//this function will send a GetFeature request
//for layers set to display at (new) current scale
function getFeature(){

currentMapScale=baseScale/(svgDocument.documentElement.currentScale);
//first, test if there is at least one layer to load
  load = false;
  for(i=0;i<theLayers.length;i++){
   
if(isDisplayed(theLayers[i],currentMapScale,false)==true){
      load = true;
      break;
    }
  }
  if(load==true){
  mapR = svgdoc.rootElement;
  mapv=svgdoc.getElementById("map");

  mvb=mapv.getAttribute("viewBox").split(" ");
  mcs=mapR.currentScale;

  minX=parseFloat(mvb[0])+mapR.currentTranslate.x;
  minY=parseFloat(mvb[1])+mapR.currentTranslate.y;
  maxX=minX+(parseFloat(mvb[2])*mcs);
  maxY=minY+(parseFloat(mvb[3])*mcs);

  statusText("request","features");
  theCall=svgdoc.createElement("GetFeature");
  theCall.setAttribute("maxFeatures", "1000" );
  for(i=0;i<theLayers.length;i++){
   
if(isDisplayed(theLayers[i],currentMapScale,false)==true){
      theQuery=svgdoc.createElement("Query");
      theQuery.setAttribute("typeName",theLayers[i]);
      theQuery=theCall.appendChild(theQuery);
    }
  }
  theFilter=svgdoc.createElement("Filter");
  theNot=svgdoc.createElement("Not");
  theDisjoint=svgdoc.createElement("Disjoint");

thePropertyName=svgdoc.createElement("PropertyName");
  nodeText="";
  for(i=0;i<theLayers.length;i++){
   
if(isDisplayed(theLayers[i],currentMapScale,false)==true){
     
nodeText+=theLayers[i]+"/"+theLayers[i]+".the_geom|";
    }
  }
  nodeText=trimLastCh(nodeText);
  theTextNode=svgdoc.createTextNode(nodeText);
  thePropertyName.appendChild(theTextNode);
  theDisjoint.appendChild(thePropertyName);
  theBox=svgdoc.createElementNS("gml","box");

theCoordinates=svgdoc.createElementNS("gml","coordinates");
  theTextNode=svgdoc.createTextNode(minX+","+minY+"
"+maxX+","+maxY);
  theCoordinates.appendChild(theTextNode);
  theBox.appendChild(theCoordinates);
  theDisjoint.appendChild(theBox);
  theNot.appendChild(theDisjoint);
  theFilter.appendChild(theNot);
  logNode = svgdoc.getElementById("viewboxLog");
  entries=logNode.getElementsByTagName("entry");
  if(entries.length>0){
    for(i=0;i<entries.length;i++){
      entry=entries.item(i);
     
scale=parseFloat(entry.getElementsByTagName('scale').item(0).firstChild.nodeValue);
     
viewbox=entry.getElementsByTagName('coordinates').item(0).firstChild.nodeValue;
      disjoint=false;
      for(j=0;j<theLayers.length;j++){
       
if((isDisplayed(theLayers[j],currentMapScale,false)==true)&&(isDisplayed(theLayers[j],scale,false)==true)){
          disjoint=true;
          break;
        }
      }
      if(disjoint==true){
        theDisjoint=svgdoc.createElement("Disjoint");
       
thePropertyName=svgdoc.createElement("PropertyName");
        nodeText="";
        for(j=0;j<theLayers.length;j++){
         
if((isDisplayed(theLayers[j],currentMapScale,false)==true)&&(isDisplayed(theLayers[j],scale,false)==true)){
           
nodeText+=theLayers[j]+"/"+theLayers[j]+".the_geom|";
          }
        }
        nodeText=trimLastCh(nodeText);
        theTextNode=svgdoc.createTextNode(nodeText);
        thePropertyName.appendChild(theTextNode);
        theDisjoint.appendChild(thePropertyName);
        theBox=svgdoc.createElementNS("gml","box");
       
theCoordinates=svgdoc.createElementNS("gml","coordinates");
        theTextNode=svgdoc.createTextNode(viewbox);
        theCoordinates.appendChild(theTextNode);
        theBox.appendChild(theCoordinates);
        theDisjoint.appendChild(theBox);
        theFilter.appendChild(theDisjoint);
      }
    }
  }
  theCall.appendChild(theFilter);
  queries=svgdoc.getElementById("queries");
  queries.appendChild(theCall);
  nodeText=printNode(theCall);
  nodeText=addNS(nodeText,"gml","box");
  nodeText=addNS(nodeText,"gml","coordinates");
// if(showCalls==true){
    alert("Request: "+nodeText);
// }

result=postURL(wfsPath,nodeText,parseFeatureMembers,"text/plain",null);
  theEntry = svgdoc.createElement("entry");
  theCoordsNode=svgdoc.createElement("coordinates");
  theCoords=svgdoc.createTextNode(minX+","+minY+"
"+maxX+","+maxY);
  theCoordsNode.appendChild(theCoords);
  theEntry.appendChild(theCoordsNode);
  theScaleNode=svgdoc.createElement("scale");
  theScale=svgdoc.createTextNode(currentMapScale);
  theScaleNode.appendChild(theScale);
  theEntry.appendChild(theScaleNode);
  logNode.appendChild (theEntry);
  }
}

//this function to test if the given layer should be
displayed
//at the current scale--checks MaxScale and MinScale
loaded with
//extended layer descriptor

function isDisplayed(layer,scale,isinit){
  if((bbox==null)&&(isinit==false)){
    if
(!(((baseScale>minScales[layer])||(minScales[layer]==0))
&&
((baseScale<maxScales[layer])||(maxScales[layer]==0)))
&& (((scale>minScales[layer])||(minScales[layer]==0))
&& ((scale<maxScales[layer])||(maxScales[layer]==0))))
{
      return true;
    }
    else{
      return false;
    }
  }
  else{
   
if(((scale>minScales[layer])||(minScales[layer]==0))
&& ((scale<maxScales[layer])||(maxScales[layer]==0))){
      return true;
    }
    else{
      return false;
    }
  }
}

function
getSetting(layer,settingType,dataType,setting){
  theSetting=null;
    ld =
svgdoc.getElementsByTagName(settingType).item(0);
    ldnl = ld.getElementsByTagName("NamedLayer");
    for (ix=0;ix<eldnl.length;ix++){
    ldnli=ldnl.item(ix);
    if (ldnli.getAttribute('name')==layer) {
      settingNode = ldnli.getElementsByTagName(setting);
      settingNode.length==0 ? theSetting =null:theSetting
=settingNode.item(0).firstChild.nodeValue;
      if(dataType=="number"){
        theSetting=parseFloat(theSetting);
      }
    }
  }
  return theSetting;
}

function resetSymbols(){
  for (i=0;i<theLayers.length;i++){
   
type=getSetting(theLayers[1],"ExtendedLayerDescriptor","string","Shape");
    if((type=="line") || (type=="polygon")){
      node=svgdoc.getElementById("l"+theLayers[i]);
     
strokeWid=getSetting(theLayers[i],"StyledLayerDescriptor","string","StrokeWidth");
     
node.getStyle().setProperty("stroke-width",strokeWid);
    }
    else{
     
thePoints=svgdoc.getElementById("l"+theLayers[i]).getElementsByTagName("circle");
      if(thePoints.length>0){
        for(p=0;p<thePoints.length;p++){
          rsize =
calcSize(theLayers[i],"SymbolSize")/svgDocument.documentElement.currentScale;
          thePoints.item(p).setAttribute('r', rsize);
        }
      }
    }
  }
  resetExtras();
}

function addExtras(){
  theMapLayer=svgdoc.createElement("g");
  theMapLayer.setAttribute("id","extras");
  theExt=svgdoc.createElement("rect");

  mapNode = svgdoc.getElementById("mapLayers");
  mapNode.appendChild(theMapLayer);
}
function resetExtras(){
  wid=getSize(1);
  pa=svgdoc.getElementById("pathadder");
  pa.getStyle().setProperty("stroke-width",wid);
  pa2=svgdoc.getElementById("pathadder2");
  pa2.getStyle().setProperty("stroke-width",wid);
  zm=svgdoc.getElementById("zoomer");
  zm.getStyle().setProperty("stroke-width",wid);
  pm=svgdoc.getElementById("panner");
  pm.getStyle().setProperty("stroke-width",wid);
}
//added NR

function addFeature(evt){
  var crtsc = svgdoc.rootElement.currentScale;
  var crttr = svgdoc.rootElement.currentTranslate;
  var mapnod = svgdoc.getElementById("map");
  var mlvb = mapnod.getAttribute("viewBox").split(" ");
  var xfac = parseFloat(mlvb[2]) /
parseFloat(mapnod.getAttribute("width")) / crtsc;
  var yfac = parseFloat(mlvb[3]) /
parseFloat(mapnod.getAttribute("height")) / crtsc;
  crdx=parseFloat(mlvb[0]) + crttr.x +
xfac*(evt.clientX);
  crdy=((parseFloat(mlvb[1]) + crttr.y) +
yfac*(parseFloat(mapnod.getAttribute("height"))-evt.clientY));
  newX=crdx;
  newY=crdy;
xoff=mapnod.getAttribute("x");
yoff=mapnod.getAttribute("y");
alert("xoff: "+xoff+" yoff: "+yoff);
//alert("x: "+evt.clientX+" y: "+evt.clientY+ " wid:
"+parseFloat(mapnod.getAttribute('width'))+" height:
"+parseFloat(mapnod.getAttribute('height')));

    if( pathadder==null )
      {
        pathadder = svgdoc.getElementById("pathadder");
        pathadder2 = svgdoc.getElementById("pathadder2");

        pathadder2.getStyle().setProperty("visibility",
"visible");
        startX=newX;
        startY=newY;
        pathadder.setAttribute("d", "M " + startX+ " " +
startY + " ");
      }
      else
      {

        var newpath=pathadder.getAttribute("d");
        if (startNew==true)
        {
          startX=newX;
          startY=newY;
          newpath=newpath+" M " + startX + " " + startY + "
";
          startNew=false;
        }
        else
        {
          newpath=newpath+" L " + newX + " " + newY + " ";
        }
        if((oldX==newX)&&(oldY==newY))
        {

          startNew=true;
        }
        else
        {
          oldX=newX;
          oldY=newY;
        }
        pathadder.setAttribute("d",newpath);
        pathadder2.setAttribute("d", newpath );
      }

}

function addFeaturePoint(evt) {
  var crtsc = svgdoc.rootElement.currentScale;
  var crttr = svgdoc.rootElement.currentTranslate;
  var mapnod = svgdoc.getElementById("map");
  var mlvb = mapnod.getAttribute("viewBox").split(" ");
  var xfac = parseFloat(mlvb[2]) /
parseFloat(mapnod.getAttribute("width")) / crtsc;
  var yfac = parseFloat(mlvb[3]) /
parseFloat(mapnod.getAttribute("height")) / crtsc;
  crdx=parseFloat(mlvb[0]) + crttr.x +
xfac*(evt.clientX);
  crdy=((parseFloat(mlvb[1]) + crttr.y) +
yfac*(parseFloat(mapnod.getAttribute("height"))-(evt.clientY+30)));
  newX=crdx;
  newY=crdy;
  if((pathadder !=
null)&&(startNew!=true)&&(pressedButton="add_feature"))
  {
    var newpath=pathadder.getAttribute("d");
    newpath=newpath+" L " + newX + " " + newY + " ";
    //alert(newpath);
    pathadder2.setAttribute("d", newpath );
  
  }

}

function startZoom(evt){
  zoomer = svgDoc.getElementById("zoomer");

  zoomer.getStyle().setProperty("visibility",
"visible");
}

function continueZoom(evt){

zoomer.setAttribute("width",(Math.abs(newX-origX))*scaleFactor);

zoomer.setAttribute("height",(Math.abs(newY-origY))*scaleFactor);
}

function endZoom(evt){
  if( zoomer != null )
  {
    zoomer.getStyle().setProperty("visibility",
"hidden");
    zoomer.setAttribute("width","0");
    zoomer.setAttribute("height","0");
    oldCurrentWidth=currentWidth;
    oldCurrentHeight=currentHeight;
    newWidth=(newX-origX)*scaleFactor;
    newHeight=(newY-origY)*scaleFactor;
    if (!newWidth==0)
    {
      if((newHeight/newWidth)>heightFactor)
      {
        currentHeight=newHeight;
        currentWidth=newHeight/heightFactor;
        minX=minX-((currentWidth-newWidth)/2);
      }
      else
      {
        currentWidth=newWidth;
        currentHeight=newWidth*heightFactor;
        minY=minY-((currentHeight-newHeight)/2);
      }
    
svgDoc.getElementById('theSVG').setAttribute("viewBox",minX+"
"+minY+" "+ currentWidth+" "+currentHeight);
      currentScale=baseScale*scaleFactor;
    
loadSVG(minX,minY,currentWidth,currentHeight,currentScale);
      scaleFactor=currentWidth/mapWidth;
      setScale(currentScale);
      resetSymbols();
      showHideRows();
    }
    else
    {
      minX=oldMinX;
      minY=oldMinY;
      alert("To zoom in, click and drag around the area
you want to view.");
    }
  }
  zoomer = null;
}
]]></script>
  <svg id="map" x="0" y="30">
    <g id="mapLayers"
style="fill:none;fill-rule:evenodd;stroke-antialiasing:true;">
<!-- added NR -->
<rect id="bg" style="fill:white;"/>
<rect id="zoomer" x="0" y="0" width="0" height="0"
style="visibility: hidden; fill:
none;stroke:red;stroke-width:1"/>
<line id="panner" x1="0" y1="0" x2="0" y2="0"
style="visibility: hidden;
stroke:red;stroke-width:1"/>
<path id="pathadder" style="fill:none;visibility:
hidden; stroke:red;stroke-width:1" d=""/>
<path id="pathadder2"
style="fill:pink;fill-rule:evenodd;opacity:0.3;visibility:
hidden; stroke:red;stroke-width:1" d=""/>
<!-- end added NR -->
    </g>

    <g id="featureCollections"/>
    <g id="queries"/>
    <g id="capabilities"/>
<!-- added NR -->
    <g id="epd"/>
    <g id="viewboxLog"/>
<!-- end added NR -->
    <g id="sld"/>
    <g id="eld"/>
    <g id="xsd"/>
  </svg>
  <svg id="keyMap" >
<!-- added AR : still referencing the whole mapLayers,
not the preferred individual layer -->
    <use id="useMapLayers" xlink:href="#mapLayers" x="0"
y="0" width="100%" height="100%" />
    <g id="keyMapLayers"
style="fill:none;fill-rule:evenodd;stroke-antialiasing:true;"/>
  </svg>
  <svg id="legend" x="0" y="0" width="2" height="100" >
    <rect id="legBack" x="0" y="0" width="100%"
height="100%" fill='#DDD' stroke='#EEE'
stroke-width='1'/>
    <svg id='tester' onload="" x="0" y="0" width="2"
height="100" preserveAspectRatio="xMinyMin meet">
      <g id='legendLayers'>
        <text x="2" y="10" font-family="Arial"
fill="black" stroke="none" font-size="10" >.</text>
        <g id="cboxes" transform="translate(2,25)"
onclick='chk(evt);'></g>
        <g id="legends" transform="translate(20,25)"
onclick='alert(printNode(evt.getTarget().parentNode))'></g>
        <g id="labelkey" transform="translate(20,25)"
onclick=''></g>
      </g>
    </svg>
    <g id='legbutton'>
      <rect id="butBack" x="0" y="0" width="1000"
height="18" fill='#BBB' stroke='none'
stroke-width='0'/>
      <text x="2" y="12" font-family="Arial" fill="black"
stroke="none" font-size="12" >Legend</text>
      <use id="legup" onclick="legscroll(evt)"
onmousedown="chbutd(evt)" onmouseup="chbutu(evt)"
xlink:href="#triangleup" x="0" y="0" width="14"
height="14" />
      <use id="legdown" onclick="legscroll(evt)"
onmousedown="chbutd(evt)" onmouseup="chbutu(evt)"
xlink:href="#triangledown" x="0" y="0" width="14"
height="14" />
    </g>
  </svg>

  <svg id="toolbar" width="100" height="30"
preserveAspectRatio="xMidyMid meet" onmouseover=""
onmouseout="" >
    <rect pointer-events="none" id='hh' x='0' y='0'
width='100%' height='100%' fill="#BBB"/>
    <line x1="0" y1="100%" x2="100%" y2="100%"
fill="none" stroke="#666" stroke-width="3"/>
    <line x1="100%" y1="100%" x2="100%" y2="0"
fill="none" stroke="#666" stroke-width="3"/>
    <line x1="0" y1="0" x2="0" y2="100%" fill="none"
stroke="#EEE" stroke-width="3"/>
    <line x1="0" y1="0" x2="100%" y2="0" fill="none"
stroke="#EEE" stroke-width="3"/>
    <g onmouseover="toolclick(evt)"
      onmousedown="chlink(evt)"
      onmouseup="chlink(evt);chkup(evt)"
      onload="arrangeButton(evt)" >

      <g id="Keymap_toggle" onclick="showhide('keyMap')"

        <use xlink:href="#bt_up" width="25" height="20"/>
        <use xlink:href="#keymap" x="" y="0" width="25"
height="20" pointer-events="none" />
      </g>
      <g id="Legend_toggle" onclick="showhide('legend')"

        <use xlink:href="#bt_up" width="25" height="20"/>
        <use xlink:href="#showlegend" width="25"
height="20" pointer-events="none" />
      </g>
      <g id="Autolabel_toggle" onclick="labelall()" >
        <use xlink:href="#bt_up" width="25" height="20"/>
        <use xlink:href="#autolabel" width="25"
height="20" pointer-events="none" />
      </g>
      <g id="Manual_Label" onclick="chkdown(evt)" >
        <use xlink:href="#bt_up" width="25" height="20"/>
        <use xlink:href="#label" width="25" height="20"
pointer-events="none" />
      </g>
      <g id="Show_Identity" onclick="chkdown(evt)">
        <use xlink:href="#bt_up" width="25" height="20"/>
        <use xlink:href="#identity" width="25"
height="20" pointer-events="none" />
      </g>
      <g id="zoom_in" onclick="mapzoom(1)" >
        <use xlink:href="#bt_up" width="25" height="20"/>
        <use xlink:href="#zoomplus" width="25"
height="20" pointer-events="none" />
      </g>
      <g id="zoom_all" onclick="mapzoom(0)" >
        <use xlink:href="#bt_up" width="25" height="20"/>
        <use xlink:href="#nozoom" width="25" height="20"
pointer-events="none" />
      </g>
      <g id="zoom_out" onclick="mapzoom(-1)" >
        <use xlink:href="#bt_up" width="25" height="20"/>
        <use xlink:href="#zoommin" width="25" height="20"
pointer-events="none" />
      </g>
      <g id="help_about" onclick="helpabout()">
        <use xlink:href="#bt_up" width="25" height="20"/>
        <use xlink:href="#helpz" width="25" height="20"
pointer-events="none" />
      </g>

      <g id="add_feature" onclick="chkdown(evt)" >
        <use xlink:href="#bt_up" width="25" height="20"/>
        <use xlink:href="#input" width="25" height="20"
pointer-events="none" />
      </g>
<!--
      <g id="open_map" onclick="toolclick(evt,'open_map
clicked')" >
        <use xlink:href="#bt_up" width="25" height="20"/>
        <use xlink:href="#open" width="25" height="20"
pointer-events="none" />
      </g>
      <g id="reload_map" onclick="toolclick(evt,'reload
map clicked')" >
        <use xlink:href="#bt_up" width="25" height="20"/>
        <use xlink:href="#reload" x="" y="0" width="25"
height="20" pointer-events="none" />
      </g>
      <g id="add_links" onclick="toolclick(evt,'links
clicked')" >
        <use xlink:href="#bt_up" width="25" height="20"/>
        <use xlink:href="#links" width="25" height="20"
pointer-events="none" />
      </g>
      <g id="show_table"
onclick="toolclick(evt,'show_table clicked')" >
        <use xlink:href="#bt_up" width="25" height="20"/>
        <use xlink:href="#table" width="25" height="20"
pointer-events="none" />
      </g>
      <g id="build_query" onclick="toolclick(evt,'query
clicked')">
        <use xlink:href="#bt_up" width="25" height="20"/>
        <use xlink:href="#query" width="25" height="20"
pointer-events="none" />
      </g>
      <g id="use_filter" onclick="toolclick(evt,'use
filter clicked')">
        <use xlink:href="#bt_up" width="25" height="20"/>
        <use xlink:href="#filter" width="25" height="20"
pointer-events="none" />
      </g>
      <g id="remove_filter"
onclick="toolclick(evt,'remove filter clicked')">
        <use xlink:href="#bt_up" width="25" height="20"/>
        <use xlink:href="#nofilter" width="25"
height="20" pointer-events="none" />
      </g>
      <g id="find_on_map" onclick="toolclick(evt,'find
clicked')">
        <use xlink:href="#bt_up" width="25" height="20"/>
        <use xlink:href="#find" width="25" height="20"
pointer-events="none"/>
      </g>
      <g id="admin" onclick="toolclick(evt,'admin
clicked')">
        <use xlink:href="#bt_up" width="25" height="20"/>
        <use xlink:href="#jroger" width="25" height="20"
pointer-events="none"/>
      </g>
      <g id="go_home" onclick="toolclick(evt,'home
clicked')">
        <use xlink:href="#bt_up" width="25" height="20"/>
        <use xlink:href="#home" width="25" height="20"
pointer-events="none"/>
      </g>

-->

      <g>
        <text x="20" y="13" id='texttool'
font-family="Arial" font-size="10"
fill='rgb(00,88,00)' >.</text>
      </g>
    </g>
  </svg>

  <defs>
    <use id="masterUse" xlink:href="" x="0" y="0"
width="100%" height="100%" />
    <use id="usetest" xlink:href=""></use>
    <rect id="abc" x="0" y="0" width="150" height="150"
style="fill:#F00;stroke:white;stroke-width:1pt"/>
    <symbol id='marker' viewBox="0 0 20 20"
preserveAspectRatio="xMidyMid meet">
      <ellipse cx="10" cy="10" rx="5" ry="5"/>
    </symbol>
    <symbol id='fill' viewBox="0 0 20 20"
preserveAspectRatio="xMidyMid meet">
      <rect x="0" y="0" width="20" height="20" />
    </symbol>
    <symbol id='pen' viewBox="0 0 20 20"
preserveAspectRatio="xMidyMid meet">
      <path d="M 0 16 L 7 3 L 14 16 L 20 0" fill="none"/>
    </symbol>
    <symbol id="check" viewBox="0 0 10 10"
preserveAspectRatio="xMidyMid meet">
      <rect x="0" y="0" width="10" height="10"
fill="lime" fill-opacity="0" stroke="black"
stroke-width="1pt"/>
      <path d="M2,5 L5,8 8,2" fill="none" stroke="black"
stroke-width="1pt" />
    </symbol>
    <symbol id="uncheck" viewBox="0 0 10 10"
preserveAspectRatio="xMidyMid meet">
      <rect x="0" y="0" width="10" height="10"
fill="lime" fill-opacity="0" stroke="black"
stroke-width="1pt" />
    </symbol>
    <symbol id="triangledown" viewBox="0 0 10 10"
preserveAspectRatio="xMidyMid meet">
      <path fill="#888" d="M1,1 L5,9 9,1 z" stroke="none"
stroke-width="0pt" transform="translate(1,1)" />
      <path fill="#CCC" d="M1,1 L5,9 9,1 z" stroke="none"
stroke-width="0pt" />
      <path fill="none" d="M5,9 L1,1 9,1 " stroke="#EEE"
stroke-width="0.5pt" />
    </symbol>
    <symbol id="triangledown2" viewBox="0 0 10 10"
preserveAspectRatio="xMidyMid meet">
      <path fill="#CCC" d="M1,1 L5,9 9,1 z" stroke="#999"
stroke-width="0.8pt" />
    </symbol>
    <symbol id="triangleup" viewBox="0 0 10 10"
preserveAspectRatio="xMidyMid meet">
      <path fill="#888" d="M1,9 L5,1 9,9 z" stroke="none"
stroke-width="0pt" transform="translate(1,1)"/>
      <path fill="#CCC" d="M1,9 L5,1 9,9 z" stroke="none"
stroke-width="0pt" />
      <path fill="none" d="M1,9 L5,1 " stroke="#EEE"
stroke-width="0.5pt" />
    </symbol>
    <symbol id="triangleup2" viewBox="0 0 10 10"
preserveAspectRatio="xMidyMid meet">
      <path fill="#CCC" d="M1,9 L5,1 9,9 z" stroke="#999"
stroke-width="0.8pt" />
    </symbol>
  </defs>
  <defs id="toolbar_button_symbols">
    <symbol id="bt_up" viewBox="0 0 30 26"
preserveAspectRatio="none">
      <rect id="r1" x="0" y="0" width="28" height="24"
rx="5" ry="5" fill="#FFF" stroke="none"/>
      <rect id="r3" x="2" y="2" width="28" height="24"
rx="5" ry="5" fill="#666" stroke="none"/>
      <rect id="r2" x="1" y="1" width="28" height="24"
rx="5" ry="5" fill="#DDD" stroke="none"/>
    </symbol>
    <symbol id="bt_down" viewBox="0 0 30 26"
preserveAspectRatio="none">
      <rect id="r2" x="1" y="1" width="28" height="24"
rx="5" ry="5" fill="yellow" stroke="#666"
stroke-width="2"/>
    </symbol>
    <symbol id="open" viewBox="0 0 30 26"
preserveAspectRatio="none">
      <polygon points="6,20 6,8 8,8 8,6 12,6 12,8 20,8
20,20" fill='rgb(00,200,00)' stroke='rgb(00,88,00)'/>
      <polygon points="6,20 10,12 26,12 20,20"
fill='rgb(00,88,00)' stroke='green'/>
    </symbol>
    <symbol id="keymap" viewBox="0 0 30 26"
preserveAspectRatio="none">
      <path d="M15,4 V22 M6,13 H24"
stroke='rgb(00,88,00)' fill='none'
stroke-width='1pt'/>
      <polygon points="10,8 20,8 20,18 10,18"
stroke='rgb(00,88,00)' fill='lime'/>
    </symbol>
    <symbol id="showlegend" viewBox="160 0 35 30"
preserveAspectRatio="none">
        <path d="M188.556 14.8889 L181.773 24 L164.223 24
L172.023 14.8889 z"
           style="fill:#080;stroke-width:1;stroke:#000"/>
        <path d="M189 10.4444 L182.217 19.5556 L164.667
19.5556 L172.467 10.4444 z"
           style="fill:#FF0;stroke-width:1;stroke:#000"/>
        <path d="M189 6.44444 L182.217 15.5556 L164.667
15.5556 L172.467 6.44444 z"
          
style="fill:#0D0;stroke-width:1;stroke:rgb(0,0,0)"/>
    </symbol>
    <symbol id="label" viewBox="0 0 30 26"
preserveAspectRatio="none">
      <polygon points="10,13 15,7 26,7 26,19 15,19"
fill='#090' stroke='#000'/>
      <circle cx='16' cy='13' r='2.5' fill='#DDD'
stroke='#000'/>
      <ellipse transform='translate(9,9) rotate(45)
translate(-9,-9)' cx="9" cy="9" rx="7" ry="2"
fill="none" stroke='#000'/>
    </symbol>
    <symbol id="input" viewBox="0 0 30 26"
preserveAspectRatio="none">
      <line x1="15" y1="6" x2="15" y2="20"
stroke='#000'/>
                        <line x1="9" y1="13" x2="21"
y2="13" stroke='#000'/>
                </symbol>
    <symbol id="autolabel" viewBox="0 0 30 26"
preserveAspectRatio="none">
      <polygon points="10,13 15,7 26,7 26,19 15,19"
fill='#090' stroke='#000'/>
      <polygon transform="translate(-3,3)" points="10,13
15,7 26,7 26,19 15,19" fill='lime' stroke='#000'/>
      <circle transform="translate(-3,3)" cx='16' cy='13'
r='2.5' fill='#DDD' stroke='#000'/>
      <ellipse transform='translate(9,12) rotate(45)
translate(-9,-9)' cx="9" cy="9" rx="7" ry="2"
fill="none" stroke='#000'/>
    </symbol>
    <symbol id="filter" viewBox="0 0 30 26"
preserveAspectRatio="none">
      <polygon points="5,5 25,5 25,7 17,16 17,22 13,22
13,16 5,7" fill='url(#green-metallic)' stroke='#000'/>
    </symbol>
    <symbol id="nofilter" viewBox="0 0 30 26"
preserveAspectRatio="none">
      <polygon points="5,5 25,5 25,7 17,16 17,22 13,22
13,16 5,7" fill='url(#green-metallic)' stroke='#000'/>
      <path d="M12,10 L25,20 M12,20 L25,10" fill='none'
stroke='#F00' stroke-width='4'/>
    </symbol>
    <symbol id="links" viewBox="0 0 30 26"
preserveAspectRatio="none">
      <polygon points="10,23 13,15 10,15 13,09 9,09 13,3
19,3 15,09 18,09 14,15 16,15" fill='#080'
stroke='#000'/>
    </symbol>
    <symbol id="table" viewBox="0 0 30 26"
preserveAspectRatio="none">
      <rect x="5" y="5" width="20" height="16"
fill="#FFF" stroke="black" stroke-width='1pt'/>
      <rect x="7" y="9" width="5" height="11" fill="#BBB"
stroke="none"/>
      <rect x="13" y="9" width="5" height="11"
fill="#BBB" stroke="none"/>
      <rect x="19" y="9" width="5" height="11"
fill="#BBB" stroke="none"/>
      <rect x="5" y="5" width="20" height="2" fill="#000"
stroke="none"/>
    </symbol>
    <symbol id="identity" viewBox="0 0 30 26"
preserveAspectRatio="none">
      <ellipse cx="15" cy="13" rx="10" ry="10"
stroke="none" fill='rgb(00,88,00)'/>
      <text x="12" y="19" font-family="Arial"
font-weight="bold" font-size="20" fill='#FFF'>i</text>
    </symbol>
    <symbol id="query" viewBox="0 0 30 26"
preserveAspectRatio="none">
      <ellipse cx="15" cy="13" rx="10" ry="10"
stroke="none" fill='rgb(00,88,00)'/>
      <text x="8" y="19" font-family="Arial"
font-weight="bold" font-size="18" fill='#FFF'>Q</text>
    </symbol>
    <symbol id="reload" viewBox="0 0 30 30"
preserveAspectRatio="none">
      <path transform='translate(0,1)'
        d="M16.23 15.7 L22 21.5 L16.23 27.3 L16.23 23.75
C12.16 23.7 5 20.6 5 10.3 L10.7 10.3 C10.7 15 13 19.17
16.23 19.15 z"
        style="fill:#060;stroke:none;"/>
      <path transform='translate(15,15) rotate(180)
translate(-15,-15) translate(0,2)'
        d="M16.23 15.7 L22 21.5 L16.23 27.3 L16.23 23.75
C12.16 23.7 5 20.6 5 10.3 L10.7 10.3 C10.7 15 13 19.17
16.23 19.15 z"
        style="fill:#060;stroke:none;"/>
    </symbol>
    <symbol id="jroger" viewBox="0 0 30 26"
preserveAspectRatio="none">
      <text x="6" y="21" font-family="Wingdings"
font-weight="bold" font-size="24"
fill='rgb(00,88,00)'>N</text>
    </symbol>
    <symbol id="helpz" viewBox="0 0 30 26"
preserveAspectRatio="none">
      <text x="6" y="21" font-family="Arial"
font-weight="bold" font-size="24"
fill='rgb(00,88,00)'>?</text>
    </symbol>
    <symbol id="home" viewBox="2 2 30 26"
preserveAspectRatio="none" >
      <g id="hm" pointer-events="none"
style="stroke-width:3;fill:none">
        <path fill="url(#homegrad)" d="M9,13 h16 v11 h-6
v-9 h-4 v9 h-6 z"/>
        <path fill="rgb(00,88,00)" d="M4,14 L17,5 30,14 z"
/>
      </g>
    </symbol>
    <symbol id="find" viewBox="2 2 30 26"
preserveAspectRatio="none">
      <g transform="translate(2,1)"
style="fill:url(#green-metallic);stroke:#004400;stroke-width:.2">
        <rect x="6.3126" y="8.64304" width="5.12"
height="8"/>
        <rect x="4.9113" y="16.8922" width="7.9"
height="6.46"/>
        <rect x="5.70931" y="4.25491" width="6.335"
height="4.16151"/>
        <rect x="17.8103" y="8.58636" width="5.12"
height="8"/>
        <rect x="16.409" y="16.8356" width="7.9"
height="6.46"/>
        <rect x="17.207" y="4.19823" width="6.335"
height="4.16151"/>
        <rect x="11.4656" y="9.37506" width="6.4"
height="5"/>
      </g>
    </symbol>

    <symbol id="zoomplus" viewBox="2 2 30 26"
preserveAspectRatio="none" >
      <g id="df" pointer-events="none"
style="stroke:rgb(00,88,00);stroke-width:3;fill:none">
        <ellipse cx="14" cy="14" rx="9.5" ry="9.5"
stroke-width="2"/>
        <line x1="21.3333" y1="19.8889" x2="28.8889"
y2="25.2222"/>
        <line x1="8.44444" y1="14.5556" x2="19.5556"
y2="14.5556"/>
        <line x1="13.7778" y1="19.4444" x2="13.7778"
y2="9.22222"/>
      </g>
    </symbol>
    <symbol id="nozoom" viewBox="34 2 30 26"
preserveAspectRatio="none">
      <g pointer-events="none"
style="fill:none;stroke:rgb(00,88,00);stroke-width:2">
        <ellipse cx="46" cy="13.6667" rx="9.5" ry="9.5" />
        <line x1="53.3333" y1="19.5556" x2="60.8889"
y2="24.8889" stroke-width="3"/>
        <line x1="52.4444" y1="7" x2="39.1111"
y2="20.3333" />
      </g>
    </symbol>
    <symbol id="zoommin" viewBox="66 2 30 26"
preserveAspectRatio="none">
      <g pointer-events="none"
style="fill:none;stroke:rgb(00,88,00);stroke-width:3">
        <line x1="85.3333" y1="19.5556" x2="92.8889"
y2="24.8889"/>
        <ellipse cx="78" cy="13.6667" rx="9.5" ry="9.5"
stroke-width="2"/>
        <line x1="72.8889" y1="13.6667" x2="83.1111"
y2="13.6667"/>
      </g>
    </symbol>
    <linearGradient id="green-metallic" x1="0%" y1="0%"
x2="100%" y2="0%" spreadMethod="pad"
gradientUnits="objectBoundingBox">
      <stop offset="1%"
style="stop-color:rgb(118,166,128);stop-opacity:1"/>
      <stop offset="18%"
style="stop-color:rgb(0,78,0);stop-opacity:1"/>
      <stop offset="48%"
style="stop-color:rgb(164,188,168);stop-opacity:1"/>
      <stop offset="83%"
style="stop-color:rgb(122,205,142);stop-opacity:1"/>
      <stop offset="99%"
style="stop-color:rgb(0,78,0);stop-opacity:1"/>
    </linearGradient>
    <linearGradient id="homegrad"
gradientUnits="objectBoundingBox" x1="0" y1="1" x2="0"
y2="0">
      <stop offset=".0" style="stop-color:palegreen"/>
      <stop offset=".8"
style="stop-color:rgb(00,88,00)"/>
    </linearGradient>
    <radialGradient id="overgrad"
gradientUnits="objectBoundingBox" x1="0" y1="1" x2="0"
y2="0">
      <stop offset=".05" style="stop-color:palegreen"/>
      <stop offset=".9" style="stop-color:green"/>
    </radialGradient>
  </defs>
</svg>

Chat instantly with your online friends? Get the
FREE Yahoo! Messenger http://uk.messenger.yahoo.com/