﻿// JScript File

//var idcounter=0;
// Callout object-----------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------- ----------------
var firstx=0;
var firsty=0;
var anchorclick =0;
var symbol={};


 symbol.callout = function(vtxt,bgcolor,fontcolor,fontsize,fontbold,Ax,Ay,vMap,isnew){  
 	  
 	   this.isnew = isnew;
 	   this.isdirty=false;
       this.group = document.createElement("v:shapegroup")//create shapegroup
       this.polygon = document.createElement("v:shape");//create polygon
       this.fill = document.createElement("v:fill");//create polygon
       this.fill.color =bgcolor;//set fill color
       this.fill.opacity = "1"; //set fill opacity
       this.polygon.fill = this.fill;//set polygon fill equal to fill
       this.polygon.id="polygon";  //set polygon id
       this.polygon.appendChild(this.fill); //append the fill to the polygon
       this.polygon.style.position = "absolute";
       this.polygon.style.zIndex = "11";
       this.polygon.style.width="800";
       this.polygon.style.height="800";
       this.polygon.strokecolor="black";
       this.polygon.strokeweight="1px";  

       this.shadow = document.createElement("v:shape");//create shadow 
       this.shadowfill = document.createElement("v:fill");//create shadow fill
       this.shadowfill.color ="#333333";//set shadow fill color
       this.shadowfill.opacity = ".5";//set shadow fill opacity
       this.shadow.id="shadow"; //set shadow id
       this.shadow.appendChild(this.shadowfill); //append the shadowfill to the shadow
       this.shadow.style.position = "absolute";
       
       
       this.txt = document.createElement('span')
       this.font = document.createElement('font')
    
       this.txt.font = this.font;
       this.txt.className="callouttext";
       this.txt.appendChild(this.font);
       //this.txt.font.innerHTML = vtxt;
       this.font.style.color=fontcolor;
	   
       if(fontbold)
	   	{
         this.font.style.fontWeight = "bold";
         }
		 else
		 {
          this.font.style.fontWeight = "normal";
         }
		 
       this.font.style.family="verdana";
       this.font.style.fontSize=fontsize;
       this.group.txt = this.txt
       this.group.polygon = this.polygon;
       this.group.shadow = this.shadow;
       this.group.font = this.font;
       this.group.appendChild(this.shadow);
     
      this.group.appendChild(this.polygon);
       
       this.group.appendChild(this.txt);
       //this.txt.style.position="absolute"
       //this.group.txt.zIndex ="15"
       this.txt.style.visibility="hidden"
     
    
       this.group.coordorigin="0,0";
       this.group.coordsize="800,800"
      
       this.shadow.style.zIndex = "10";
       this.shadow.style.width="800";
       this.shadow.style.height="800";
       this.shadow.coordorigin=this.group.coordorigin;
       this.shadow.coordsize = this.group.coordsize
       this.shadow.strokecolor="#333333";
       this.shadow.strokeweight="0px";
       this.polygon.coordorigin=this.group.coordorigin
       this.polygon.coordsize = this.group.coordsize
       this.Ax=Ax;
       this.Ay=Ay;
	   this.vMap = vMap;
	  
	   this.inspoint = vMap.toWorldPoint(this.Ax,(this.Ay-45));
	   this.group.id = "callout"+this.inspoint.X+this.inspoint.Y;
       this.group.onmousedown = layout_grab;
       this.group.onmouseup = this.updatePosition;
       this.group.objtype="callout";
       this.group.elementType="callout"
       this.group.style.cursor= "hand";
       this.group.drag = this.drag;
       this.group.updatePosition = this.updatePosition;
       this.group.txtwidth=0 ;
       this.group.txtheight=0;
       this.group.onclick = layout_checkButton;
       this.onclick = layout_checkButton;
       this.group.build = this.build;
       this.insertpoint = document.createElement('div');
       this.insertpoint.style.width="10px";
       this.insertpoint.style.height="10px";
       this.insertpoint.style.position = "absolute";
       this.insertpoint.style.display = "none";
       this.insertpoint.style.backgroundColor = "red";
       this.insertpoint.style.zIndex = "5";
       this.insertpoint.onmousedown=this.setanchor;
       this.group.insertpoint = this.insertpoint;
       this.group.txt.font.innerText = vtxt;
       this.group.appendChild(this.insertpoint);
       this.group.updateSize = this.updateSize;
       this.group.updatePosition = this.updatePosition;
       this.group.saveVCall = this.saveVCall;
	   this.group.zIndex = "2";
	    this.group.quad;
	   //this.txtwidth= this.txt.font.offsetWidth;
       //this.txtheight= this.txt.font.offsetHeight;
           // editobj.updateSize();
	  
        }
       symbol.callout.prototype.setanchor=function(){
       anchorclick=1;
       }
       
      //---------Build the callout graphic----------------------------------------
      //--------------------------------------------------------------------------
     symbol.callout.prototype.build=function(offsets){
	if(this.isnew)
	{
		this.group.quad = 1;
        if(this.txt.innerText.length==0)
		{
       this.group.txtwidth=50;
         }
		 else
		 {
       this.group.txtwidth= this.txt.font.offsetWidth;
       this.group.txtheight =  this.txt.font.offsetHeight;
        }
      this.txt.width = this.group.txtwidth;
      this.group.insertpoint.style.top=this.Ay;
      this.group.insertpoint.style.left=this.Ax;
      this.group.Ax = this.Ax;
      this.group.Ay = this.Ay;
      this.group.Bx = this.Ax -20;
      this.group.By = this.Ay -50;
      this.group.Cx = this.group.Bx - this.group.txtwidth -10;
      this.group.Cy = this.group.By;
      this.group.Dx = this.group.Bx - this.group.txtwidth -10;
      this.group.Dy = this.group.By - this.group.txtheight-10;
      this.group.Ex = this.group.Bx +10;
      this.group.Ey = this.group.By - this.group.txtheight-10;
      this.group.Fx = this.group.Ex;
      this.group.Fy = this.group.By -10 ;
      this.buildvCall();
	}
	else
	{
	  
      this.group.insertpoint.style.top=(this.Ay+45);
      this.group.insertpoint.style.left=this.Ax;
      this.group.Ax = this.Ax;
      this.group.Ay = (this.Ay+45);
	  var cds = offsets.split("|");
      this.group.Bx = parseInt(cds[0].substring(0,cds[0].indexOf(',')))+this.group.Ax; 
      this.group.By = parseInt(cds[0].substring(cds[0].indexOf(',')+1))+this.group.Ay ;
      this.group.Cx =  parseInt(cds[1].substring(0,cds[1].indexOf(',')))+this.group.Ax;
      this.group.Cy = parseInt(cds[1].substring(cds[1].indexOf(',')+1))+this.group.Ay ;
      this.group.Dx = parseInt(cds[2].substring(0,cds[2].indexOf(',')))+this.group.Ax;
      this.group.Dy =  parseInt(cds[2].substring(cds[2].indexOf(',')+1))+this.group.Ay;
      this.group.Ex =  parseInt(cds[3].substring(0,cds[3].indexOf(',')))+this.group.Ax;
      this.group.Ey =  parseInt(cds[3].substring(cds[3].indexOf(',')+1))+this.group.Ay ;
      this.group.Fx = parseInt(cds[4].substring(0,cds[4].indexOf(',')))+this.group.Ax;
      this.group.Fy =  parseInt(cds[4].substring(cds[4].indexOf(',')+1))+this.group.Ay ;
      if(this.group.Ay<=this.group.Fy)
        {
          if(this.group.Ax>=this.group.Bx)
          {
            this.group.quad = 4;
           }
           else
           {
           this.group.quad = 3;
           }    
        }
        else
        {
        if(this.group.Ax>=this.group.Bx)
          {
            this.group.quad = 1;
           }
           else
           {
           this.group.quad = 2;
           }
        }
	  }
	   //alert(this.group.quad)
      this.txt.style.top = this.group.Dy+ 5; 
      this.txt.style.left = this.group.Dx +10; 
      this.polygon.path = "m "+this.group.Ax+","+this.group.Ay+" l "+this.group.Bx+","+this.group.By+" "+this.group.Cx+","+this.group.Cy+" "+this.group.Dx+","+this.group.Dy+" "+this.group.Ex+","+this.group.Ey+" "+this.group.Fx+","+this.group.Fy+" xe";
      this.shadow.path =  "m "+this.group.Ax+","+this.group.Ay+" l "+(this.group.Bx-10)+","+(this.group.By+10)+" "+(this.group.Cx-10)+","+(this.group.Cy+10)+" "+(this.group.Dx-10)+","+(this.group.Dy+10)+" "+(this.group.Ex-15)+","+(this.group.Ey+10)+" "+(this.group.Fx-15)+","+(this.group.Fy+10)+" xe";
      this.txt.style.visibility = "visible";  
     
}
		
      //function to build the vertual callout object--------------------------------------------------
      //----------------------------------------------------------------------------------------------
      
      
      symbol.callout.prototype.buildvCall = function()
	  {
		var vc = new symbol.vCallout();
		vc.id = this.group.id;
		vc.txt = this.txt.font.innerText;
		vc.bgColor =  String(this.fill.color);
		vc.fontColor =  String(this.font.style.color);
		vc.fontSize = this.font.style.fontSize.substring(0,this.font.style.fontSize.indexOf("px"));
		if(this.font.style.fontWeight =="bold")
		{		
		vc.fontBold = true;
		}
		else
	  	{
		  vc.fontBold=false;
	  	}
		vc.objtype = "callout";
		vc.insertx = this.inspoint.X
		vc.inserty = this.inspoint.Y
		vc.Ax = this.group.Ax;
		vc.Ay = (this.group.Ay-45);
		vc.offsets =( this.group.Bx-this.group.Ax )+","+(this.group.By-this.group.Ay)+"|"+ (this.group.Cx-this.group.Ax) +","+(this.group.Cy-this.group.Ay)+"|" +(this.group.Dx-this.group.Ax) +","+(this.group.Dy-this.group.Ay)+"|"+(this.group.Ex-this.group.Ax) +","+(this.group.Ey-this.group.Ay)+"|"+(this.group.Fx-this.group.Ax) +","+(this.group.Fy-this.group.Ay);
		markupObjects[vc.id] = vc;
		
		 
	  }
	   //function to update vertual callout object shape and position --------------------------------
      //----------------------------------------------------------------------------------------------
      
      
	  symbol.callout.prototype.saveVCall = function(ax,ay,bx,by,cx,cy,dx,dy,ex,ey,fx,fy)
	  {
	  markupObjects[this.id].offsets =( bx-ax )+","+(by-ay)+"|"+ ( cx-ax) +","+(cy-ay)+"|" +( dx-ax) +","+(dy-ay)+"|"+( ex-ax) +","+(ey-ay)+"|"+( fx-ax) +","+(fy-ay); 
	   
	  }
	  
	  
	  
	  
	  
	  
   symbol.callout.prototype.drag=function(dx,dy,anchor)
       {
           
          if(anchor){
             this.vAx = this.Ax + parseInt(dx,10);
             this.vAy = this.Ay + parseInt(dy,10);
             this.vBx = this.Bx ;
             this.vBy = this.By ;
             this.vCx = this.Cx ;
             this.vCy = this.Cy ;
             this.vDx = this.Dx ;
             this.vDy = this.Dy ;
             this.vEx = this.Ex ;
             this.vEy = this.Ey ;
             this.vFx = this.Fx ;
             this.vFy = this.Fy ;
             }
             else
             {
              
             this.vAx = this.Ax;
             this.vAy = this.Ay;
             this.vBx = this.Bx + parseInt(dx,10);
             this.vBy = this.By + parseInt(dy,10);
             this.vCx = this.Cx + parseInt(dx,10);
             this.vCy = this.Cy + parseInt(dy,10);
             this.vDx = this.Dx + parseInt(dx,10);
             this.vDy = this.Dy + parseInt(dy,10);
             this.vEx = this.Ex + parseInt(dx,10);
             this.vEy = this.Ey + parseInt(dy,10);
             this.vFx = this.Fx + parseInt(dx,10);
             this.vFy = this.Fy + parseInt(dy,10);
             }
        
       if(this.vAy<=this.vBy)
       {
       
         if(this.vBx>=this.Ax)//lower Right
         {
            if(this.vFy>= this.vAy)//needs to be flipped down
            {
               
                 this.pBx = this.Bx= this.vBx;
                 this.pBy = this.vBy ;
                 this.pCx = this.vCx ;
                 this.pCy = this.vDy ;
                 this.pDx = this.vDx ;
                 this.pDy = this.vBy +(this.vCy-this.vDy) ;
                 this.pEx = this.vEx ;
                 this.pEy = this.pDy ;
                 this.pFx = this.vFx ;
                 this.pFy = this.vBy+20 ;
                 this.txt.style.top = parseInt(this.pFy )-5 ;
                 this.txt.style.left = parseInt(this.pFx)+10;
               }
               else if(this.vBx<=this.vAx) //needs to be flipped right
               {
                 this.pBx = this.vDx+10;
                 this.pBy = this.vDy ;
                 this.pCx = this.vEx ;
                 this.pCy = this.vDy ;
                 this.pDx = this.vEx ;
                 this.pDy = this.vCy ;
                 this.pEx = this.vCx ;
                 this.pEy = this.vCy ;
                 this.pFx = this.vCx ;
                 this.pFy = this.vDy+10 ;
                 this.txt.style.top = parseInt(this.pFy )-5 ;
                 this.txt.style.left = parseInt(this.pFx)+10;
               
               }

          }
          
          
          
          else if(this.vBx<this.Ax&&this.quad!=4)//lower left
          {
          this.pBx = this.vEx -10 ;
          this.pBy = this.vDy;
          this.pCx = this.vCx;
          this.pCy = this.vDy;
          this.pDx = this.vCx ;
          this.pDy = this.vCy ;
          this.pEx = this.vEx ;
          this.pEy = this.vCy ;
          this.pFx = this.vFx;
          this.pFy = this.vDy+10;  
          this.txt.style.top = parseInt(this.vDy )+5 ;
          this.txt.style.left = parseInt(this.vCx)+10;     
          }
       }
        
         else
         {
          if(this.vBx>=this.Ax)//upper Right
          {
            if(this.vFx>=this.vAx)//needs to be flipped right
             {
            
                  this.pBx = this.vBx +20 ;
                  this.pBy = this.vBy ;
                  this.pCx = this.pBx + (this.vBx-this.vCx) ;
                  this.pCy = this.vCy ;
                  this.pDx = this.pBx + (this.vEx-this.vDx)-10 ;
                  this.pDy = this.vDy ;
                  this.pEx = this.vEx ;
                  this.pEy = this.vEy ;
                  this.pFx = this.vFx ;
                  this.pFy = this.vFy ;
                  this.txt.style.top = parseInt(this.pEy )+5 ;
                  this.txt.style.left = parseInt(this.pEx)+10;
             }
             if(this.vFy>=this.vAy)//needs to be flipped Up
             {
            
                  this.pBx = this.vBx ;
                  this.pBy = this.vBy ;
                  this.pCx = this.vCx ;
                  this.pCy = this.vCy ;
                  this.pDx = this.vDx;
                  this.pDy = this.pCy -(this.vDy-this.vCy) ;
                  this.pEx = this.vEx ;
                  this.pEy = this.pDy ;
                  this.pFx = this.vFx ;
                  this.pFy = this.vFy -20 ;
                  this.txt.style.top = parseInt(this.pEy )+5 ;
                  this.txt.style.left = parseInt(this.pEx)+10;
             }
          }
          
          else if(this.vBx<this.Ax)//upperleft
          {
          
          this.pBx = this.vBx ;
          this.pBy = this.vBy ;
          this.pCx = this.vCx ;
          this.pCy = this.vCy ;
          this.pDx = this.vCx ;
          this.pDy = this.vDy ;
          this.pEx = this.vEx ;
          this.pEy = this.vDy ;
          this.pFx = this.vFx ;
          this.pFy = this.vFy ;
          this.txt.style.top = parseInt(this.vDy )+5 ;
          this.txt.style.left = parseInt(this.vCx)+10;
          }
       }
        

         
         this.polygon.path = "m "+this.vAx+","+this.vAy+" l "+this.pBx+","+this.pBy+" "+this.pCx+","+this.pCy+" "+this.pDx+","+this.pDy+" "+this.pEx+","+this.pEy+" "+this.pFx+","+this.pFy+" xe";
         this.insertpoint.style.top=(this.vAy-5);
         this.insertpoint.style.left=(this.vAx-5);
         this.shadow.path =  "m 0,0"; 
       
         this.txt.style.width = this.txtwidth;
    }
        
        
 symbol.callout.prototype.updatePosition=function()
      {       
           
             anchorclick=0;
             this.Ax =this.vAx;
             this.Ay =this.vAy;
             this.Bx =this.pBx;
             this.By =this.pBy ;
             this.Cx =this.pCx ;
             this.Cy =this.pCy;
             this.Dx =this.pDx;
             this.Dy =this.pDy;
             this.Ex =this.pEx ;
             this.Ey =this.pEy ;
             this.Fx =this.pFx ;
             this.Fy =this.pFy ; 
             this.polygon.path = "m "+this.vAx+","+this.vAy+" l "+this.pBx+","+this.pBy+" "+this.pCx+","+this.pCy+" "+this.pDx+","+this.pDy+" "+this.pEx+","+this.pEy+" "+this.pFx+","+this.pFy+" xe";
            
             this.shadow.path =  "m "+this.vAx+","+this.vAy+" l "+(this.pBx-10)+","+(this.pBy+10)+" "+(this.pCx-10)+","+(this.pCy+10)+" "+(this.pDx-10)+","+(this.pDy+10)+" "+(this.pEx-15)+","+(this.pEy+10)+" "+(this.pFx-15)+","+(this.pFy+10)+" xe";
            this.saveVCall(this.vAx,this.vAy,this.pBx,this.pBy,this.pCx,this.pCy,this.pDx,this.pDy,this.pEx,this.pEy,this.pFx,this.pFy)
        }

         symbol.callout.prototype.updateSize=function()
         { 
         //alert("update Size");
         this.Cx = this.Bx - this.txtwidth -10;
         this.Dy = this.By - this.txtheight-10;
         this.drag(0,0,false);
         this.updatePosition();   
          }
          
         
		 
		 
    //Label Object---------------------------------------------------------
    //--------------------------------------------------------------------------------------- 
    symbol.LayoutLabel = function(txtsize,txtcolor,labelText,txtbgcolor,txtwidth,txtbold,Ax,Ay){
  
         this.txt = document.createElement('div');//top.mapframe.
         this.txt.style.position = "absolute";
         this.txt.style.top = Ay;
         this.txt.style.left = Ax;
         this.txt.style.fontSize = txtsize +"px";
         this.txt.style.color = txtcolor; 
         
        if(txtbold)
             {
                this.txt.style.fontWeight = "bold";
              }
              else
             {
             this.txt.style.fontWeight = "normal";
             }
             
         if(this.labelText!="")
		 {
          this.txt.innerHTML = labelText
          }
		  else
		  {
         this.txt.innerHTML = "Text";
         }
         this.txt.style.width=txtwidth;
         this.txt.style.backgroundColor = txtbgcolor;
         this.txt.style.textAlign="left"
         this.txt.style.cursor ="hand";
         this.txt.ondblclick =layout_editObject;
         this.txt.onclick = layout_checkButton;
         this.txt.onmousedown = layout_grab;
         this.txt.elementType="label";
		 this.txt.objtype = "label";
         this.txt.style.cursor = "hand";
		 this.txt.style.zIndex ="25";
		 
         
         }
		 
		 
         
      //Line Object---------------------------------------------------------
      //--------------------------------------------------------------------------------------- 
        symbol.LayoutLine = function(wt,clr)
		{  
 
       this.line = document.createElement("v:shape");
       this.fill = document.createElement("v:fill");
       this.fill.opacity = "0";
       this.line.appendChild(this.fill); 
       this.line.style.position = "absolute";
       this.line.style.zindex = "5";
       this.line.style.width="200";
       this.line.style.height="200";
       this.line.strokecolor=clr;
       this.line.strokeweight=wt;
       this.line.coordorigin="0,0";
       this.line.coordsize = "200,200";
       this.line.onclick = layout_checkButton;
       this.line.onmousemove = layout_drawElement;
       this.line.onmousedown = layout_grab;
       this.line.ondblclick = layout_doubleClick;
       this.line.objtype="shape";
       this.line.elementType="line";
       this.line.style.cursor= "crosshair";
	   this.line.id="line";
	    this.line.style.zIndex= "25";
       path="";
       }
       
	   
	   
       //Rectangle Object---------------------------------------------------------
       //--------------------------------------------------------------------------------------- 
       symbol.LayoutRectangle = function(wt,clr,fclr,ftrans)
	   {      
       this.shape = document.createElement("v:shape");
       this.fill = document.createElement("v:fill");
       this.fill.color = fclr;
       this.fill.opacity = ftrans;
       this.shape.appendChild(this.fill); 
       this.shape.style.position = "absolute";
       this.shape.style.width="200";
       this.shape.style.height="200";
       this.shape.strokecolor=clr;
       this.shape.strokeweight=wt;
       this.shape.coordorigin="0,0";
       this.shape.coordsize = "200,200";
       this.shape.onclick = layout_checkButton;
       this.shape.onmousemove = layout_drawElement;
       this.shape.onmousedown = layout_grab;
       this.shape.objtype="shape";
       this.shape.elementType="rectangle";
       this.shape.style.cursor= "crosshair";
	   this.shape.style.zIndex= "25";
	   this.shape.id;
        path="";
       }
       
        //Polygon Object---------------------------------------------------------
        //--------------------------------------------------------------------------------------- 
        symbol.LayoutPolygon = function(wt,clr,fclr,ftrans){  
     
       this.polygon = document.createElement("v:shape");
       this.fill = document.createElement("v:fill");
       this.fill.color =String(fclr);
       this.fill.opacity = ftrans;
       this.polygon.appendChild(this.fill); 
	   this.polygon.fillColor =String(fclr);
	   this.polygon.fillOpacity = ftrans;
       this.polygon.style.position = "absolute";
       this.polygon.style.zindex = "5";
       this.polygon.style.width="800";
       this.polygon.style.height="800";
       this.polygon.strokecolor=clr;
       this.polygon.strokeweight=wt;
       this.polygon.coordorigin="0,0";
       this.polygon.coordsize = "800,800";
       this.polygon.onclick =  layout_checkButton;
       this.polygon.onmousemove = layout_drawElement;
       this.polygon.onmousedown = layout_grab;
       this.polygon.ondblclick = layout_doubleClick;
       this.polygon.objtype="shape";
	   this.objtype="shape";
       this.polygon.elementType="polygon";
      this.polygon.style.cursor= "crosshair";
	  this.polygon.style.zIndex= "25";  
	  this.polygon.id;
       path="";
	   
       }
       
       //Circle Object---------------------------------------------------------
       //--------------------------------------------------------------------------------------- 
        symbol.LayoutCircle = function(wt,clr,fclr,ftrans){  

       this.circle = document.createElement("v:oval");
       this.fill = document.createElement("v:fill");
       this.fill.color =fclr;
       this.fill.opacity = ftrans;
       this.circle.appendChild(this.fill); 
       this.circle.style.position = "absolute";
       this.circle.style.width="200";
       this.circle.style.height="200";
       this.circle.strokecolor=clr;
       this.circle.strokeweight=wt;
       this.circle.coordorigin="0,0";
       this.circle.coordsize = "0,0";
       
       this.circle.onclick = layout_checkButton;
       this.circle.onmousemove = layout_drawElement;
       this.circle.onmousedown = layout_grab;
       this.circle.ondblclick = layout_doubleClick;
       this.circle.style.cursor= "crosshair";
       this.circle.elementType="circle";
	   this.circle.objtype="shape";
	   this.circle.style.zIndex= "25";
      
       }
	    //Icon objects----------------------------------
	    //--------------------------------------------------------------------------------------- 
 symbol.Icon = function(up,down,id,mouseover){
 this.up = up;
 this.down = down;
 this.img = new Image();
 this.img.id = id
 this.imagebase = "images/layout/"
 this.img.src = this.imagebase + this.up;
 this.img.onclick = setFunction;
 this.img.onMouseOver = iconover;
 }
 

 
 //------function for parsing the path of a line or polygon object------------------------ 
 //--------------------------------------------------------------------------------------- 
 symbol.parsePath=function(path,elementtype)
 {
	 var pts = new Array();
	 //pts[0] = vpath.substring(5);//path.indexOf('m '),path.indexOf(' l')
	 var vpath = new String(path);
	 var endLetter;
	// if(elementtype=='line')
	// {
		 endLetter="e";
	// }
	//  if(elementtype=='polygon')
	// {
	//	 endLetter = "xe";
	// }

		//alert(vpath.substring(vpath.indexOf("m")+1,vpath.indexOf(","))+","+vpath.substring(vpath.indexOf(",")+1,vpath.indexOf("l")-1))
		 pts[0] = vMap.toWorldPoint(vpath.substring(vpath.indexOf("m")+1,vpath.indexOf(",")),(vpath.substring(vpath.indexOf(",")+1,vpath.indexOf("l")-1)-45));
		 var ctr = 0; 
		// alert(vpath)
		 var rem = vpath.substring((vpath.indexOf("l")+1),(vpath.indexOf(endLetter)-1))
		 var rempts = rem.split(',')
	
		 for (var i = 0; i<rempts.length-1;i+=2)
		 {
			 ctr++
			//alert( rempts[i]+","+rempts[i+1])
			 pts[ctr]= vMap.toWorldPoint(rempts[i],(rempts[i+1]-45));
		 
		 }
	  
		
	 
	return pts;	 
 }
 
 
 
 //----------These are vertual object that are stored in memory and saved to the server--- 
 //--------------------------------------------------------------------------------------- 
 symbol.vCallout = function()
 {
	 this.id;
	 this.txt;
	 this.bgColor;
	 this.fontColor;
	 this.fontSize;
	 this.fontBold;
	 this.insertx;
	 this.inserty;
	 this.Ax;
	 this.Ay;
	 this.offsets;
	 this.objtype = "callout";
	 this.elementType = "callout";
 }
 
 
 symbol.vRectangle = function()
 {
	 this.id;
	 this.fillColor;
	 this.fillOpacity;
	 this.strokeColor;
	 this.strokeWeight;
	 this.Ax;
	 this.Ay;
	 this.Bx;
	 this.By;
	 this.objtype = "shape";
	 this.elementType ="rectangle";
 }
 
  symbol.vLabel = function()
 {
	 this.id;
	 this.txt;
	 this.bgColor;
	 this.fontColor;
	 this.fontSize;
	 this.fontBold;
	 this.width;
	 this.Ax;
	 this.Ay;
	 this.objtype = "label";
	 this.elementType ="label";
 }
 symbol.vCircle = function()
 {
	 this.id;
	 this.fillColor;
	 this.fillOpacity;
	 this.strokeColor;
	 this.strokeWeight;
	 this.Ax;
	 this.Ay;
	 this.width;
	 this.height;
	 this.objtype = "shape";
	 this.elementType ="circle";
 }
 
 symbol.vLine = function()
 {
	 this.id;
	 this.strokeColor;
	 this.strokeWeight;
	 this.points;
	 this.objtype = "shape";
	 this.elementType ="line";
 }
 
 
  symbol.vPolygon = function()
 {
	 this.id;
	 this.fillColor;
	 this.fillOpacity;
	 this.strokeColor;
	 this.strokeWeight;
	 this.points;
	 this.objtype = "shape";
	 this.elementType ="polygon";
 }
