if( typeof gCCoord == 'undefined' ){
  var gCCoord = 'defined';
  var CCoord = Class.create();
  CCoord.prototype = Object.extend(new AJSMapBaseClass(), {
    initialize: function(params){
      if(typeof params.lon!='undefined')
        this.lon=params.lon;
      else if(typeof params.longitude!='undefined')
        this.lon=params.longitude;
      else if(typeof params.x!='undefined')
        this.lon=params.x;
      if(typeof params.swissx!='undefined')
        this.swissx=params.swissx;

      if(typeof params.lat!='undefined')
        this.lat=params.lat;
      else if(typeof params.latitude!='undefined')
        this.lat=params.latitude;
      else if(typeof params.y!='undefined')
        this.lat=params.y;
      if(typeof params.swissy!='undefined')
        this.swissy=params.swissy;
    },
    clone: function(){
      return new CCoord(this);
    },
    getLat:function(){
      if(typeof this.lat=='undefined'&&
         typeof this.swissy!='undefined'&&
         typeof this.swissx!='undefined')
        this.swiss2wgs84();
      return this.lat;
    },
    getLon:function(){
      if(typeof this.lon=='undefined'&&
         typeof this.swissy!='undefined'&&
         typeof this.swissx!='undefined')
        this.swiss2wgs84();
      return this.lon;
    },
    getSwissX:function(){
      if(typeof this.swissx=='undefined'&&
         typeof this.lat!='undefined'&&
         typeof this.lon!='undefined')
        this.wgs842swiss();
      return this.swissx;
    },
    getSwissY:function(){
      if(typeof this.swissy=='undefined'&&
         typeof this.lat!='undefined'&&
         typeof this.lon!='undefined')
        this.wgs842swiss();
      return this.swissy;
    },
    swiss2wgs84:function(){
      var Y=(this.swissx-600000.0)/1000000.0;
      var X=(this.swissy-200000.0)/1000000.0;
      var L=2.6779094+4.728982*Y+0.791484*X*Y+0.1306*Y*X*X-0.0436*Y*Y*Y;
      var F = 16.9023892+3.238272*X-0.270978*Y*Y-0.002528*X*X-0.0447*Y*Y*X-0.014*X*X*X;
      this.lat=Math.round(F*100000000.0/36.0);
      this.lon=Math.round(L*100000000.0/36.0);
    },
    wgs842swiss:function(){
      var P=(this.lat*3600.0/1000000.0-169028.66)/10000.0;
      var L=(this.lon*3600.0/1000000.0-26782.5)/10000.0;
      this.swissy=Math.round(200147.07+308807.95*P+3745.25*L*L+76.63*P*P+119.79*P*P*P-194.56*L*L*P);
      this.swissx=Math.round(600072.37+211455.93*L-10938.51*L*P-0.36*L*P*P-44.54*L*L*L);
    }
  });
}


