 SVGDoc=null
 Path=null
 function Init(LoadEvent) {
  SVGDoc = LoadEvent.getTarget().getOwnerDocument()
 }

 function onclk(e) {
	if (!e.shiftKey && !e.altKey && !e.ctrlKey) {
   x=e.getClientX()
   y=e.getClientY()
  if (Path==null) {
   var lineel=SVGDoc.createElement('g')
   lineel.setAttribute("style","stroke-width:2px;fill:none;stroke:#006400")
   pathel=SVGDoc.createElement('path')
   str="M"+x+" "+y+" L"+x+" "+y
   pathel.setAttribute("d",str)
   Path=pathel
   lineel.appendChild(pathel)
   SVGDoc.firstChild.appendChild(lineel)
  } else {
   str=Path.getAttribute("d")
   str+=" L"+x+" "+y+" M"+x+" "+y
   Path.setAttribute("d",str)
		}
 } 
 if (e.shiftKey && Path) {
  str=Path.getAttribute("d")
  str+=" L"+str.substring(1,str.indexOf('L'))+" z"
  Path.setAttribute("d",str)
  Path=null
 }
}
function submit() {
 var str=printNode(SVGDoc.firstChild)
 str=str.replace(/<script>.*<\/script>/gim,'')
 alert(str)
}

