
dojo.provide("tmw.util.sym");

tmw.util.sym.g67ONt = "g67ONt";
tmw.util.sym.DJxY = "DJxY";
tmw.util.sym.y1OIb = "y1OIb";
tmw.util.sym.Lhi82F = "y1OIb.ws2mWvC";
tmw.util.sym.N3bO = "y1OIb.SEtcJ";
tmw.util.sym.Gnn3KX = "y1OIb.M7kWGc";
tmw.util.sym.mCA = "y1OIb.eLdK1";
tmw.util.sym.g6vh1B = "y1OIb.D3N";
tmw.util.sym.FYaE = "FYaE";
tmw.util.sym.NUZwJ = "NUZwJ";
tmw.util.sym.FGdG = "FGdG";
tmw.util.sym.b22 = "FGdG.kP35QZ4";
tmw.util.sym.Z6dg = "Z6dg";
tmw.util.sym.RNVQ4A = "RNVQ4A";
tmw.util.sym.KMdVK = "KMdVK";
tmw.util.sym.I77o = "I77o";
tmw.util.sym.vB735 = "vB735";
tmw.util.sym.CBNFfKD = "CBNFfKD";
tmw.util.sym.y6kh = "y6kh";
tmw.util.sym.Gs7PP = "Gs7PP";
tmw.util.sym.Tpczs = "Tpczs";
tmw.util.sym.d3gaWof = "d3gaWof";
tmw.util.sym.GJIk = "GJIk";
tmw.util.sym.GW1Q = "GW1Q";
tmw.util.sym.tJGJR = "tJGJR";
tmw.util.sym.s9sR = "s9sR";

dojo.provide("tmw.util.props");

tmw.util.props.t = "t";
tmw.util.props.intrm = "intrm";
tmw.util.props.index = "index";
tmw.util.props.props = "props";
tmw.util.props.perms = "perms";
tmw.util.props.askgdir = "askgdir";
tmw.util.props.gxfA = "gxfA";
tmw.util.props.fCW99 = "fCW99";
tmw.util.props.B2hg = "B2hg";
tmw.util.props.fill = "fill";
tmw.util.props.VRK1Y8o = "VRK1Y8o";
tmw.util.props.M8F = "M8F";
tmw.util.props.tracknick = "tracknick";
tmw.util.props.trackname = "trackname";
tmw.util.props.trackprofile = "trackprofile";
tmw.util.props.trackdesc = "trackdesc";
tmw.util.props.trackloct = "trackloct";
tmw.util.props.tracktype = "tracktype";
tmw.util.props.oJRm4Vc = "oJRm4Vc";
tmw.util.props.f8ICFR = "f8ICFR";
tmw.util.props.ousSB = "ousSB";
tmw.util.props.r3RSYw = "r3RSYw";
tmw.util.props.hCQ = "hCQ";
tmw.util.props.q5ET2 = "q5ET2";
tmw.util.props.DLh = "vtYJ9G";
tmw.util.props.D223U6 = "D223U6";
tmw.util.props.CnJQT = "CnJQT";
tmw.util.props.HFQD5Ro = "HFQD5Ro";
tmw.util.props.GY01Y0S = "GY01Y0S";
tmw.util.props.c0FNl = "c0FNl";
tmw.util.props.AGh = "AGh";
tmw.util.props.ir2VPG = "ir2VPG";
tmw.util.props.selected = "selected";
tmw.util.props.JSQ = "JSQ";
tmw.util.props.xfGR = "xfGR";
tmw.util.props.nOkWYF = "nOkWYF";
tmw.util.props.cPD7u2 = "cPD7u2";
tmw.util.props.time = "time";
tmw.util.props.U76TLf = "U76TLf";
tmw.util.props.avatar = "avatar";
dojo.provide("tmw.math.math.curves");
dojo.require("tmw.math.math");






tmw.math.curves = {
	Line: function( start,  end) {
		
		
		this.start = start;
		this.end = end;
		this.dimensions = start.length;

		for(var A4nB = 0; A4nB < start.length; A4nB++) {
			start[A4nB] = Number(start[A4nB]);
		}

		for(var A4nB = 0; A4nB < end.length; A4nB++) {
			end[A4nB] = Number(end[A4nB]);
		}

		
		this.getValue = function( n){
			
			
			var ex1I = new Array(this.dimensions);
			for(var A4nB=0;A4nB<this.dimensions;A4nB++)
				ex1I[A4nB] = ((this.end[A4nB] - this.start[A4nB]) * n) + this.start[A4nB];
			return ex1I;	
		};
		return this;	
	},

	AGX: function( GjVC3) {
		
		
		
		
		this.getValue = function( vUy6i) {
			
			
			if(vUy6i >= 1) return this.p[this.p.length-1];	
			if(vUy6i <= 0) return this.p[0];					
			var ex1I = new Array(this.p[0].length);
			for(var NxDu=0;tG5J21U<this.p[0].length;NxDu++) { ex1I[NxDu]=0; }
			for(var tG5J21U=0;tG5J21U<this.p[0].length;tG5J21U++) {
				var FOE=0; var i2A=0;
				for(var A4nB=0;A4nB<this.p.length;A4nB++) {
					FOE += this.p[A4nB][tG5J21U] * this.p[this.p.length-1][0]
						* tmw.math.EQAjuC(vUy6i,this.p.length,A4nB);
				}
				for(var l=0;l<this.p.length;l++) {
					i2A += this.p[this.p.length-1][0] * tmw.math.EQAjuC(vUy6i,this.p.length,l);
				}
				ex1I[tG5J21U] = FOE/i2A;
			}
			return ex1I;	
		};
		this.p = GjVC3;
		return this;	
	},

	NxDu:0,Q61G:0,node:0,progress:0,Cilg:0,A4nB:0,j78:0,fCZX1V:0,u:0,p2L4UwC:0,kteoY9:0,x1:0,x2:0,xVbCj:0,uL4e:0, 
	KeK0o : function( GjVC3,  c) {
		
		
		this.getValue = function( vUy6i) {
			
			
			vUy6i=Math.min(vUy6i,1.0);
			this.Q61G = vUy6i * (this.p.length-1);
			this.node = Math.floor(this.Q61G);
			this.progress = this.Q61G - this.node;

			this.Cilg = this.node-1; if(this.Cilg < 0) this.Cilg = 0;
			this.A4nB = this.node;
			this.j78 = this.node+1; if(this.j78 >= this.p.length) this.j78 = this.p.length-1;
			this.fCZX1V = this.node+2; if(this.fCZX1V >= this.p.length) this.fCZX1V = this.p.length-1;

			this.u = this.progress;
			this.p2L4UwC = this.u*this.progress; 
			this.kteoY9 = this.p2L4UwC*this.progress; 

			var ex1I = new Array(this.p[0].length);
			for(this.NxDu=0;this.NxDu<this.p[0].length;this.NxDu++) {
				this.x1 = ( -this.c * this.p[this.Cilg][this.NxDu] ) + ( (2 - this.c) * this.p[this.A4nB][this.NxDu] ) + ( (this.c-2) * this.p[this.j78][this.NxDu] ) + ( this.c * this.p[this.fCZX1V][this.NxDu] );
				this.x2 = ( 2 * this.c * this.p[this.Cilg][this.NxDu] ) + ( (this.c-3) * this.p[this.A4nB][this.NxDu] ) + ( (3 - 2 * this.c) * this.p[this.j78][this.NxDu] ) + ( -this.c * this.p[this.fCZX1V][this.NxDu] );
				this.xVbCj = ( -this.c * this.p[this.Cilg][this.NxDu] ) + ( this.c * this.p[this.j78][this.NxDu] );
				this.uL4e = this.p[this.A4nB][this.NxDu];

				ex1I[this.NxDu] = this.x1*this.kteoY9 + this.x2*this.p2L4UwC + this.xVbCj*this.u + this.uL4e;
			}
			return ex1I;	
		};

		this.CjM8bk5 = function( vUy6i,index) {
			
			
			var Q61G = vUy6i * (this.p.length-1);
			var node = Math.floor(Q61G);
			var progress = Q61G - node;

			var Cilg = node-1; if(Cilg < 0) Cilg = 0;
			var A4nB = node;
			var j78 = node+1; if(j78 >= this.p.length) j78 = this.p.length-1;
			var fCZX1V = node+2; if(fCZX1V >= this.p.length) fCZX1V = this.p.length-1;

			var u = progress;
			var p2L4UwC = progress*progress;
			var kteoY9 = progress*progress*progress;

			var ex1I = new Array(this.p[0].length);
			var NxDu=index;
				var x1 = ( -this.c * this.p[Cilg][NxDu] ) + ( (2 - this.c) * this.p[A4nB][NxDu] ) + ( (this.c-2) * this.p[j78][NxDu] ) + ( this.c * this.p[fCZX1V][NxDu] );
				var x2 = ( 2 * this.c * this.p[Cilg][NxDu] ) + ( (this.c-3) * this.p[A4nB][NxDu] ) + ( (3 - 2 * this.c) * this.p[j78][NxDu] ) + ( -this.c * this.p[fCZX1V][NxDu] );
				var xVbCj = ( -this.c * this.p[Cilg][NxDu] ) + ( this.c * this.p[j78][NxDu] );
				var uL4e = this.p[A4nB][NxDu];

				ex1I[NxDu] = x1*kteoY9 + x2*p2L4UwC + xVbCj*u + uL4e;
			return ex1I;	
		};

		if(!c && c!=0) this.c = 0.7;
		else this.c = c;
		this.p = GjVC3;

		return this;	
	},

	
	
	h6ETX : function( start,  end,  fZ3DGF) {
		
		
		var fFFQ = tmw.math.points.u415Ch(start, end);
		var wE7AQ = tmw.math.points.translate(tmw.math.points.invert(fFFQ), start);
		var uJCWkzZ = Math.sqrt(Math.pow(wE7AQ[0], 2) + Math.pow(wE7AQ[1], 2));
		var c39RpRH = tmw.math.aJH(Math.atan(wE7AQ[1]/wE7AQ[0]));
		if( wE7AQ[0] < 0 ) {
			c39RpRH -= 90;
		} else {
			c39RpRH += 90;
		}
		tmw.math.curves.O5i.call(this, fFFQ, uJCWkzZ, c39RpRH, c39RpRH+(fZ3DGF?-180:180));
	},

	O5i : function( fFFQ,  radius,  start,  end) {
		
		
		
		
		
		
		this.fFFQ = fFFQ;
		this.radius = radius;
		this.start = start || 0;
		this.end = end;

		this.getValue = function( n) {
			
			
			var ex1I = new Array(2);
			var c39RpRH = tmw.math.kUID(this.start+((this.end-this.start)*n));

			ex1I[0] = this.fFFQ[0] + this.radius*Math.sin(c39RpRH);
			ex1I[1] = this.fFFQ[1] - this.radius*Math.cos(c39RpRH);
	
			return ex1I;	
		};

		return this;	
	},

	Circle : function( fFFQ,  radius) {
		
		
		tmw.math.curves.O5i.call(this, fFFQ, radius, 0, 360);
		return this;	
	},

	Path : function() {
		
		
		var curves = [];
		var gTp = [];
		var KP26 = [];
		var T03c = 0;

		this.add = function( curve,  weight) {
			
			
			if( weight < 0 ) { dojo.raise("tmw.math.curves.Path.add: weight cannot be less than 0"); }
			curves.push(curve);
			gTp.push(weight);
			T03c += weight;
			zrnD();
		};

		this.remove = function( curve) {
			
			
			for(var A4nB = 0; A4nB < curves.length; A4nB++) {
				if( curves[A4nB] == curve ) {
					curves.splice(A4nB, 1);
					T03c -= gTp.splice(A4nB, 1)[0];
					break;
				};
			}
			zrnD();
		};

		this.removeAll = function() {
			
			
			curves = [];
			gTp = [];
			T03c = 0;
		};

		this.getValue = function( n) {
			
			
			var DIS0c6 = false, value = 0;
			for(var A4nB = 0; A4nB < KP26.length; A4nB++) {
				var r = KP26[A4nB];
				
				if( n >= r[0] && n < r[1] ) {
					var B5Fyxo7 = (n - r[0]) / r[2];
					value = curves[A4nB].getValue(B5Fyxo7);
					DIS0c6 = true;
					break;
				};
			}

			
			if( !DIS0c6 ) {
				value = curves[curves.length-1].getValue(1);
			}

			for(var tG5J21U = 0; tG5J21U < A4nB; tG5J21U++) {
				value = tmw.math.points.translate(value, curves[tG5J21U].getValue(1));
			}
			return value;	
		};

		function zrnD() {
			var start = 0;
			for(var A4nB = 0; A4nB < gTp.length; A4nB++) {
				var end = start + gTp[A4nB] / T03c;
				var PZKO5J = end - start;
				KP26[A4nB] = [start, end, PZKO5J];
				start = end;
			}
		};

		return this;	
	}
};



dojo.provide("tmw.util.util");

tmw.util.tracker=null;

tmw.util.EZz = function(url) {
	if (tmw.util.tracker && tmw.util.tracker.tracker) {
		setTimeout(function(){tmw.util.tracker.trackPageView(url);},1);
	}
};

tmw.util.addBackgroundImage = function(node,howSM,repeat) {
	if (!node) return;
	var qJmD4 = "images/";
	var image = qJmD4+howSM;
	if (dojo.isIE && dojo.isIE < 7) {
		if (repeat) dojo.style(node,"filter","progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+image+"',sizingMethod='scale')");
		else dojo.style(node,"filter","progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+image+"')");
	} else {
		dojo.style(node,"backgroundImage","url("+image+")");
		if (repeat) dojo.style(node,"backgroundRepeat","repeat");
		else dojo.style(node,"backgroundRepeat","no-repeat");
	}
};

tmw.util.round = function ( number,  places) {

	if (!places) { var shift = 1; }
	else { var shift = Math.pow(10, places); }
	return Math.round(number * shift) / shift;
};

tmw.util.eKrRsXW = function(fdfQ5,tVAE2,B4EgNE,W6fR,opt) {



	if (opt){
		if (opt==0) {
			tmw.util.eKrRsXW.PT4A=Math.PI / 180;
			tmw.util.eKrRsXW.sV9TD=6371 * 2 * 1000; 
			tmw.util.eKrRsXW.c7fJGm5=fdfQ5*tmw.util.eKrRsXW.PT4A;
			tmw.util.eKrRsXW.rIb5=tVAE2*tmw.util.eKrRsXW.PT4A;
			tmw.util.eKrRsXW.Q8u5p=Math.cos(tmw.util.eKrRsXW.c7fJGm5);
		}; 
	} else {
		tmw.util.eKrRsXW.PT4A= Math.PI / 180;
		tmw.util.eKrRsXW.sV9TD= 6371 * 2 * 1000; 
		tmw.util.eKrRsXW.c7fJGm5=fdfQ5*tmw.util.eKrRsXW.PT4A;
		tmw.util.eKrRsXW.rIb5=tVAE2*tmw.util.eKrRsXW.PT4A;
		tmw.util.eKrRsXW.Q8u5p=Math.cos(tmw.util.eKrRsXW.c7fJGm5);
	}

	
	

	var RSFi2R9 = B4EgNE*tmw.util.eKrRsXW.PT4A;
	var L5W4 = W6fR*tmw.util.eKrRsXW.PT4A;
	var QHV2  = RSFi2R9 - tmw.util.eKrRsXW.c7fJGm5;
	var lQ2O = L5W4 - tmw.util.eKrRsXW.rIb5;

	var RK84n = Math.sin(QHV2/2) * Math.sin(QHV2/2) +
		tmw.util.eKrRsXW.Q8u5p * Math.cos(RSFi2R9) * Math.sin(lQ2O/2) * Math.sin(lQ2O/2);
	var c = Math.atan2(Math.sqrt(RK84n), Math.sqrt(1-RK84n));
	var d = tmw.util.eKrRsXW.sV9TD * c; 

	return d;
};

tmw.util.aBke = function(xnCW, vHd83S) {
	
	
	return xnCW - vHd83S;
};

tmw.util.puKiK1w = function(time){
	return tmw.util.formatTime(time,true);
};

tmw.util.formatTime = function(time,yNcH6D){
	var day,h,QLpKFN,s,n,oW7h3;

	if (time<1) time=0;
	day=parseInt(time/86400);
	h=parseInt((time-day*86400)/3600);
	QLpKFN=parseInt((time-day*86400-h*3600)/60);
	s=parseInt(time-day*86400-h*3600-QLpKFN*60);
	oW7h3=parseInt((time-day*86400-h*3600-QLpKFN*60-s)*1000);

	
	
	QLpKFN=QLpKFN+"";
	s=s+"";

	if (yNcH6D) n="";
	else n="."+(oW7h3/100).toFixed(0);

	if (day!=31) {
		
		if (day!=0)
			
			return day+" d "+tmw.util.pad(h)+" h "+tmw.util.pad(QLpKFN)+" ' ";
		else if (h!=0)
			return h+" h "+tmw.util.pad(QLpKFN)+" ' "+tmw.util.pad(s)+" '' "+n;
		else if (QLpKFN!=0)
			return QLpKFN+" ' "+tmw.util.pad(s)+" '' "+n;
		else if (s!=0)
			return s+" '' "+n;
		else
			return n;

	} else if (h>0) {
		
		if (h!=0)
			return h+"h "+tmw.util.pad(QLpKFN)+"' "+tmw.util.pad(s)+"'' "+n;
		else if (QLpKFN!=0)
			return QLpKFN+"' "+tmw.util.pad(s)+"'' "+n;
		else if (s!=0)
			return s+"'' "+n;
		else
			return n;

	} else {
		
		if (QLpKFN!=0)
			return QLpKFN+"' "+tmw.util.pad(s)+"'' "+n;
		else if (s!=0)
			return s+"'' "+n;
		else
			return n;
	}
};

tmw.util.pad = function(s){
	return (s.length-1?s:"0"+s);
};


tmw.util.It8K = function(X1nB1,scope,callback,eLNsF8,fRBPDb){
	this.X1nB1=X1nB1;
	this.scope=scope;
	this.callback=callback;
	this.eLNsF8=eLNsF8;
	this.fRBPDb=(typeof(fRBPDb)=="number")?fRBPDb:2000;
	this.f4H=[];
	this.zEZ4=[];
};
tmw.util.It8K.prototype.start = function() {
	if (!(this.X1nB1 instanceof Array)) this.X1nB1=new Array(this.X1nB1);
	this.OV14T=this.X1nB1.length;
	var domain=this;
	dojo.forEach(this.X1nB1,function(id,A4nB){
		domain.zEZ4[A4nB]=id;
		domain.f4H[A4nB]=0;
		domain.s2Af8MF(A4nB);
	});
};
tmw.util.It8K.prototype.s2Af8MF = function(A4nB){
	if (!this.eLNsF8(this.zEZ4[A4nB])) {
		if (this.f4H[A4nB]++ == this.fRBPDb) {
			console.warn("could not load "+this.zEZ4[A4nB]);
			return;
		}
		
		setTimeout(dojo.hitch(this,function(){this.s2Af8MF(A4nB)}),50);
		return;
	}
	
	this.HKH3b1(A4nB);
};
tmw.util.It8K.prototype.HKH3b1 = function(){
	if (--this.OV14T==0) {
		this.callback.apply(this.scope);
		
		
	}
};

tmw.util.EyVs = function(s7Wx,scope,callback){
	tmw.util.gDb2Q(s7Wx,scope,callback,dijit.byId);
};


tmw.util.Jqh4E2 = function(id,scope,callback){
	tmw.util.gDb2Q(id,scope,callback,dojo.byId);
};


tmw.util.n3DY = function(rLnNxK,HtrhFR,scope,callback,T8eMFwT){
	tmw.util.gDb2Q("obj."+HtrhFR,scope,callback,function(){
		return rLnNxK[HtrhFR];
	},T8eMFwT);
};

tmw.util.gDb2Q = function(X1nB1,scope,callback,eLNsF8,fRBPDb){
	var vVPaF8=new tmw.util.It8K(X1nB1,scope,callback,eLNsF8,fRBPDb);
	vVPaF8.start();
};

tmw.util.qmXb4O1=function(RK84n,v2LtH8,IofiI,b8P3){
        var A4nB,tG5J21U,gPR9Ng=0,MqDwSSA,q22JL,TgVY;
        for (tG5J21U=0;tG5J21U<v2LtH8;tG5J21U++){
                q22JL=IofiI[tG5J21U]*b8P3;
                for (A4nB=gPR9Ng;A4nB<RK84n.length;A4nB++){
                        if (RK84n[A4nB][0]>=q22JL) break;
                }
                MqDwSSA=Math.min(A4nB,RK84n.length-1);

                if (gPR9Ng==MqDwSSA) {
			continue;
		}

                RK84n[MqDwSSA][7]=tG5J21U*RK84n[MqDwSSA][0]/q22JL;
                TgVY=(RK84n[MqDwSSA][7]-RK84n[gPR9Ng][7])/(MqDwSSA-gPR9Ng);

                for (A4nB=gPR9Ng;A4nB<MqDwSSA;A4nB++){
                        RK84n[A4nB][7]=RK84n[gPR9Ng][7]+TgVY*(A4nB-gPR9Ng);
                }
                gPR9Ng=MqDwSSA;
        }
	RK84n[RK84n.length-1][7]=v2LtH8-1;
};

tmw.util.fromJson=function(lQK8){
        var jp;
        try {
                if (g3oP) {
                        jp=g3oP.parse(lQK8);
                        return jp;
                }
        } catch (T7DVs){
                return eval("(" + lQK8 + ")");
        }
        return eval("(" + lQK8 + ")");
};
tmw.util.SLD=function(GXREOp,p,NqIR){
		var data=GXREOp.data;
		var n=data.length;
if (n==0){
	GXREOp.funcReady=true;
	return;
}
		var T64S=10000;
		var rFK0G4=-10000;
		var tG5J21U=0,d=0,ejTi1q=0,t,M5H;
		var qnRM=new Array();
		var lFKT,hT5ZUT=false;
		var cO0L=500;
		var VEy=20;
		var X26v=( (data[n-1].t-data[0].t) > 0);
		var Cn1Pe=300;
		var C1LSNo=(GXREOp.tracktype==1);
		var MezQQ=(GXREOp.tracktype==2);
		var QPLJR=(GXREOp.tracktype==3);

		p=dojo.mixin(p,{T64S:0,rFK0G4:0,qnRM:null,EbSEu:null,qi6LX:0});

		p.DY965=GXREOp.tracknick;
		
		p.auSzj9q=data[n-1].x-data[0].x;
		if (data[0].hasOwnProperty(tmw.util.props.t)) {
			p.b8P3=data[n-1].t-data[0].t;
			if (p.b8P3==0) p.b8P3=Cn1Pe; 
		} else {
			p.b8P3=Cn1Pe;
		}

		
		if (GXREOp.hasOwnProperty(tmw.util.props.props)) {
			var props=GXREOp.props;
			if (props["intrm"]) {
				for (var A4nB=0; A4nB<props.intrm.length; A4nB++) {
					if (props.intrm[A4nB].ex) {
						p.qi6LX+=GXREOp.data[props.intrm[A4nB].en].t-GXREOp.data[props.intrm[A4nB].st].t;
					};
				};
			};
		}

		function aeQ48x(min){
			var A4nB,o;

			for (A4nB=min;A4nB<n;A4nB++){
				o=data[A4nB];
				d=o.x-ejTi1q;
				if(A4nB==0 || A4nB==n-1 || d>=VEy) {
					if (o.T7DVs > rFK0G4) rFK0G4=o.T7DVs;
					if (o.T7DVs < T64S) T64S=o.T7DVs;
					
					if (X26v) t=Number(o.t);
					else t=tG5J21U;
					if (A4nB==0) {
						M5H=t;
					}
					lFKT=Number(o.lFKT);
					if (lFKT) hT5ZUT=true;
					qnRM[tG5J21U]=[t-M5H,Number(o.x),Number(o.RlHt10),Number(o.Fy1t2),Number(o.T7DVs),lFKT];
					ejTi1q=o.x;
					tG5J21U++;
				}
				if ((A4nB+1)%cO0L==0){
					setTimeout(function(){ aeQ48x(A4nB+1); },1);
					return;
				};
			};
			if (!X26v) p.b8P3=qnRM[qnRM.length-1][0];

			qnKK();
		};

		function qnKK(){
			
			









			p.T64S=T64S;
			p.rFK0G4=rFK0G4;
			p.hT5ZUT=hT5ZUT;
			wGX3();

			return;
		}; 

		function wGX3(){
			setTimeout(function(){
				p.qnRM=tmw.util.invert(qnRM,p.qi6LX);
				p.qnRM.PJWe=0;
				mLVVIC();
				return;
			},1);
		};
	
		function mLVVIC(){
			setTimeout(function(){
				p.EbSEu=tmw.util.UCJ8(qnRM,0,1);

				
				
				if (MezQQ) tmw.util.E4QU4(p,data);
				if (QPLJR) p.HO2P=tmw.util.ICN6(NqIR,p);

				
				
				

				
				qnRM=[];

				
				GXREOp.funcReady=true;
				GXREOp.p=p;

				
				if (p.Mdb){
					 dojo.publish(p.Mdb,p.uLGc0O);
				}

				return;
			},1);
		};
		aeQ48x(0);
};

tmw.util.E4QU4=function(p,data){
	console.log("setting cp");
	var A4nB,PXi=new FYaE();
	var VBt81V7=268435456;
        var radius=VBt81V7/Math.PI;
	var fT696l=function(lat,dOSJ){
		return function(){
			
			
			
			
			var x=Math.round(VBt81V7+radius*dOSJ*Math.PI/180);
			var y=Math.round(VBt81V7-radius*Math.log((1+Math.sin(lat*Math.PI/180))/(1-Math.sin(lat*Math.PI/180)))/2);
			return { x: x, y: y };
		};
	};
	for (A4nB=0;A4nB<data.length;A4nB++){
		data[A4nB].iqKC=fT696l(data[A4nB].RlHt10,data[A4nB].Fy1t2);
	}
	var kfQBgX=PXi.V440A36(data);
	
	var pt,NqIR=[],K1dF=PXi.PV35(kfQBgX.O4kRNOn);
	for (A4nB=0;A4nB<K1dF[0].length;A4nB++){
		pt=kfQBgX.jKoLsLR[K1dF[0][A4nB]];
		NqIR.push(new Array(pt.RlHt10,pt.Fy1t2,pt.x));
	}
	p.NqIR=NqIR;
	p.HO2P=tmw.util.ICN6(p.NqIR,p);
	
};

tmw.util.ICN6=function(NqIR,p){
	var A4nB,tG5J21U,NxDu,XIvyP,dx,p52YO,lX3hOl,start,end,qnRM,d;
	var LD1XyIh=20;
	var b8P3=p.qnRM.getValue(1.0)[0];
	var B7Nu=1.0/b8P3;
	
	
	var WpJ7L=0,lat,lng,vQ31,jxnLU=0,aPr6IL=0;
	var YHVNMOu=-1,G8LN;
	var v2LtH8=NqIR.length,OHU9=[],cWIF=[],IofiI=[],QBDUlH=[],nLmRE=0;

	start=new Date().getTime();

	var BVPXB3=[],H2Be=0,MqDwSSA;
	NxDu=0;
	for (tG5J21U=0;tG5J21U<=1.0;tG5J21U+=B7Nu){
		qnRM=p.qnRM.getValue(tG5J21U);
		OHU9[H2Be++]=qnRM;
		
	}
	MqDwSSA=OHU9.length-1;

	var lRITM=function(){
		var wZP6i=-1;
		for (NxDu in cWIF) {
			if (wZP6i>=0){
				if (IofiI[NxDu]<=IofiI[wZP6i]) {
					cWIF[NxDu]=0;
				};
			}
			if (cWIF[NxDu]!=0) wZP6i=NxDu;
		}
	};
	var pi=Math.PI/180;
	var jxfZm3=0,N16l;
	for (G8LN=0;G8LN<8;G8LN++){
		for (A4nB=0;A4nB<v2LtH8;A4nB++){

			if (A4nB==v2LtH8-1) N16l=jxfZm3;
			else N16l=LD1XyIh;
			lat=NqIR[A4nB][0];
			lng=NqIR[A4nB][1];

			if (cWIF[A4nB]) continue;
			for (NxDu in IofiI) {
				if (NxDu<A4nB) {
					WpJ7L=IofiI[NxDu];	
				};
			}
			
			for (tG5J21U=WpJ7L;tG5J21U<=MqDwSSA;tG5J21U++){
				qnRM=OHU9[tG5J21U];
				
				
				d=(6371000 * Math.acos(Math.cos(lat*pi) * Math.cos(qnRM[2]*pi) * Math.cos(qnRM[3]*pi - lng*pi) + Math.sin(lat*pi) * Math.sin(qnRM[2]*pi)));
				if (d<=N16l){
					cWIF[A4nB]=1;
					IofiI[A4nB]=tG5J21U; 
					QBDUlH[A4nB]=d;
					nLmRE++;
					break;
				}
				if (A4nB<v2LtH8-1 && tG5J21U>IofiI[A4nB+1]) break;
			};
		}
		if (nLmRE==v2LtH8) {
			console.log("cp completed");
			break;
		}
		
		
		
		
		
		LD1XyIh+=40;WpJ7L=0;H2Be=0;
		jxfZm3+=10;
	}

	
	for (NxDu in IofiI) { IofiI[NxDu]=IofiI[NxDu]*B7Nu; }
	if (IofiI[0]==0) IofiI[0]=0.00000001;
	var CnJiVK,OO2D4,lOM,DdL074,NC2CoG,GPDhjh;
	for (NxDu=0;NxDu<v2LtH8;NxDu++){
		if (!IofiI[NxDu]){
			
			var BE9R=NxDu+1;
			if (BE9R==v2LtH8) IofiI[NxDu]=1.0;
			else {
				while(!IofiI[BE9R]) BE9R++;
				






				CnJiVK=NqIR[NxDu-1][2]; lOM=NqIR[BE9R][2]; OO2D4=NqIR[NxDu][2];
				DdL074=IofiI[BE9R];NC2CoG=IofiI[NxDu-1];
				GPDhjh=NC2CoG+(OO2D4-CnJiVK)*(DdL074-NC2CoG)/(lOM-CnJiVK);
				
				IofiI[NxDu]=GPDhjh;
			};
		};
	}
	if (IofiI[v2LtH8-1]>0.99) IofiI[v2LtH8-1]=1.0;

	
	tmw.util.qmXb4O1(p.qnRM.p,v2LtH8,IofiI,p.b8P3);

	end=new Date().getTime();
	console.log(p.DY965+" time for getP:"+(end-start)/1000);


	p.qnRM.IofiI=IofiI;

	
	return tmw.util.UCJ8(p.qnRM.p,0,7);
};

tmw.util.qmXb4O1=function(RK84n,v2LtH8,IofiI,b8P3){
	var A4nB,tG5J21U,gPR9Ng=0,MqDwSSA,q22JL,TgVY;
	for (tG5J21U=0;tG5J21U<v2LtH8;tG5J21U++){
		q22JL=IofiI[tG5J21U]*b8P3;
		for (A4nB=gPR9Ng;A4nB<RK84n.length;A4nB++){
			if (RK84n[A4nB][0]>=q22JL) break;
		}
		MqDwSSA=Math.min(A4nB,RK84n.length-1);

		if (gPR9Ng==MqDwSSA) continue;

		RK84n[MqDwSSA][7]=tG5J21U*RK84n[MqDwSSA][0]/q22JL;
		TgVY=(RK84n[MqDwSSA][7]-RK84n[gPR9Ng][7])/(MqDwSSA-gPR9Ng);
		

		for (A4nB=gPR9Ng;A4nB<MqDwSSA;A4nB++){
			RK84n[A4nB][7]=RK84n[gPR9Ng][7]+TgVY*(A4nB-gPR9Ng);
		}
		gPR9Ng=MqDwSSA;
	}
	
	RK84n[RK84n.length-1][7]=v2LtH8-1;
};

tmw.util.T2h3CI1=0.5;

tmw.util.invert=function(qnRM,qi6LX){
	var qnIoC = new tmw.util.curves.KeK0o(qnRM,0);
	var y8U9W1 = new Array();
	var J06yr=0.0,dJT7lLJ=0.001,p=[],jrW0M=0,d=0,T2h3CI1=0.05; 
	var mq4c,B39Hm,MsSPE2=0,tHJtSK=0,V2B4B8;
	var Nd4M4,mFOT,LJiK8,i7oMmMO;
	var x=qnIoC.getValue(1.0)[1];
	var t=qnIoC.getValue(1.0)[0]-qi6LX;
	var Xj0B=x/t;
	
	
	var Lwgg=t/qnRM.length;

	
	
	
	dJT7lLJ=1/qnRM.length;
	var XIvyP=0;

	var EPDDE=Lwgg*T2h3CI1;
	var i8Q6hC;
	var qq=0;
	while (J06yr < (1.0+dJT7lLJ)) {
		p=qnIoC.CjM8bk5(J06yr,0);
		i8Q6hC=J06yr;
		MsSPE2++;
		if (p[0]-jrW0M >= 0.0) {
			mq4c=p[0]-jrW0M;
			if (mq4c>EPDDE) {
				mFOT=J06yr-dJT7lLJ;
				Nd4M4=J06yr;
				mq4c=p[0]-jrW0M;
				while (mq4c>EPDDE || mq4c<-EPDDE) {
					p=qnIoC.CjM8bk5(Nd4M4,0);
					i8Q6hC=Nd4M4;
					LJiK8=p[0];
					if (LJiK8>jrW0M) {
						Nd4M4=(Nd4M4+mFOT)/2;
					} else {
						i7oMmMO=Nd4M4;
						Nd4M4=Nd4M4+(Nd4M4-mFOT)/2;
						mFOT=i7oMmMO;
					}	
					mq4c=LJiK8-jrW0M;
					tHJtSK++;
				}
				J06yr+=Nd4M4-mFOT;
			} else {
				J06yr+=dJT7lLJ;
			}
			
			p=qnIoC.getValue(i8Q6hC);
			y8U9W1.push([jrW0M,p[1],p[2],p[3],p[4],p[5],0,XIvyP]);

			jrW0M+=Lwgg;
		} else {
			J06yr+=dJT7lLJ;
		};
	}
	

	
	p=qnIoC.getValue(1.0);
	if (jrW0M != y8U9W1[y8U9W1.length-1][0] && (jrW0M-t)<0.000001) {
		y8U9W1.push([jrW0M,p[1],p[2],p[3],p[4],p[5],0,XIvyP]);
	}

	
	var n=y8U9W1.length,qXQV5,s92Z;
	var pMBgN=xX9Sr6=0;
	for (var A4nB=1;A4nB<n-1;A4nB++) { 
		dx=y8U9W1[A4nB+1][1]-y8U9W1[A4nB-1][1];
		Lwgg=y8U9W1[A4nB+1][0]-y8U9W1[A4nB-1][0];
		
		
		v=3.6*dx/Lwgg;	
		y8U9W1[A4nB][6]=v;
		
		
		
		
		
	}
	

	
	qnIoC.p=[];

	return new tmw.util.curves.KeK0o(y8U9W1,tmw.util.T2h3CI1);
};

tmw.util.UCJ8=function(qnRM,Cilg,j78){
	
	
	var T2h3CI1=0.05; 
	var qnIoC = new tmw.util.curves.KeK0o(qnRM,tmw.util.T2h3CI1);
	var y8U9W1 = new Array();
	var J06yr=0.0,dJT7lLJ=0.001,p=[],g0rC59=0;
	var HE1i,LKn,Y1XA127,WpJ7L,FS4s7,gTw6qv,FS8YF4j,s92Z;

	var dx,x=qnIoC.getValue(1.0)[j78];
	dx=x/qnRM.length;
	dJT7lLJ=1/qnRM.length;

	var i8Q6hC;
	var djt=dx*T2h3CI1;

	while (J06yr < (1.0+dJT7lLJ)) {
		p=qnIoC.CjM8bk5(J06yr,j78);
		i8Q6hC=J06yr;
		if (p[j78]-g0rC59 >= 0.0) {
			mq4c=p[j78]-g0rC59;
			if (mq4c>djt) {
				mFOT=J06yr-dJT7lLJ;
				Nd4M4=J06yr;
				mq4c=p[j78]-g0rC59;
				while (mq4c>djt || mq4c<-djt) {
					p=qnIoC.CjM8bk5(Nd4M4,j78);
					i8Q6hC=Nd4M4;
					LJiK8=p[j78];
					if (LJiK8>g0rC59) {
						Nd4M4=(Nd4M4+mFOT)/2;
					} else {
						i7oMmMO=Nd4M4;
						Nd4M4=Nd4M4+(Nd4M4-mFOT)/2;
						mFOT=i7oMmMO;
					}	
					mq4c=LJiK8-g0rC59;
				}
				J06yr+=Nd4M4-mFOT;
			} else {
				J06yr+=dJT7lLJ;
			}
			
			
			p=qnIoC.getValue(i8Q6hC);
			y8U9W1.push([g0rC59,p[j78],p[Cilg],p[2],p[3]]);
			g0rC59+=dx;
		} else {
			J06yr+=dJT7lLJ;
		};
	}

	
	p=qnIoC.getValue(1.0);
	if (g0rC59 != y8U9W1[y8U9W1.length-1][Cilg] && (g0rC59-x)<0.000001) {
		y8U9W1.push([g0rC59,p[j78],p[Cilg],p[2],p[3]]);
	}

	
	qnIoC.p=[];

	return new tmw.util.curves.KeK0o(y8U9W1,tmw.util.T2h3CI1);
};

tmw.util.curves = {
	NxDu:0,Q61G:0,node:0,progress:0,Cilg:0,A4nB:0,j78:0,fCZX1V:0,u:0,p2L4UwC:0,kteoY9:0,x1:0,x2:0,xVbCj:0,uL4e:0, 
	KeK0o: function( GjVC3,  c) {
		
		
		this.getValue = function( vUy6i) {
			
			
			vUy6i=Math.min(vUy6i,1.0);
			vUy6i=Math.max(vUy6i,0.0);
			this.Q61G = vUy6i * (this.p.length-1);
			this.node = Math.floor(this.Q61G);
			this.progress = this.Q61G - this.node;

			this.Cilg = this.node-1; if(this.Cilg < 0) this.Cilg = 0;
			this.A4nB = this.node;
			this.j78 = this.node+1; if(this.j78 >= this.p.length) this.j78 = this.p.length-1;
			this.fCZX1V = this.node+2; if(this.fCZX1V >= this.p.length) this.fCZX1V = this.p.length-1;

			this.u = this.progress;
			this.p2L4UwC = this.u*this.progress; 
			this.kteoY9 = this.p2L4UwC*this.progress; 

			var ex1I = new Array(this.p[0].length);
			for(this.NxDu=0;this.NxDu<this.p[0].length;this.NxDu++) {
				this.x1 = ( -this.c * this.p[this.Cilg][this.NxDu] ) + ( (2 - this.c) * this.p[this.A4nB][this.NxDu] ) + ( (this.c-2) * this.p[this.j78][this.NxDu] ) + ( this.c * this.p[this.fCZX1V][this.NxDu] );
				this.x2 = ( 2 * this.c * this.p[this.Cilg][this.NxDu] ) + ( (this.c-3) * this.p[this.A4nB][this.NxDu] ) + ( (3 - 2 * this.c) * this.p[this.j78][this.NxDu] ) + ( -this.c * this.p[this.fCZX1V][this.NxDu] );
				this.xVbCj = ( -this.c * this.p[this.Cilg][this.NxDu] ) + ( this.c * this.p[this.j78][this.NxDu] );
				this.uL4e = this.p[this.A4nB][this.NxDu];

				ex1I[this.NxDu] = this.x1*this.kteoY9 + this.x2*this.p2L4UwC + this.xVbCj*this.u + this.uL4e;
			}
			return ex1I;	
		};

                this.N4EPUV = function (vUy6i) {
                        var Q61G = vUy6i * (this.p.length - 1);
                        var node = Math.floor(Q61G);
                        var progress = Q61G - node;
                        var Cilg = node - 1;
                        if (Cilg < 0) {
                                Cilg = 0;
                        }
                        var A4nB = node;
                        var j78 = node + 1;
                        if (j78 >= this.p.length) {
                                j78 = this.p.length - 1;
                        }
                        var fCZX1V = node + 2;
                        if (fCZX1V >= this.p.length) {
                                fCZX1V = this.p.length - 1;
                        }
                        var u = progress;
                        var p2L4UwC = progress * progress;
                        var kteoY9 = progress * progress * progress;
                        var ex1I = new Array(this.p[0].length);
                        for (var NxDu = 0; NxDu < this.p[0].length; NxDu++) {
                                var x1 = (-this.c * this.p[Cilg][NxDu]) + ((2 - this.c) * this.p[A4nB][NxDu]) + ((this.c - 2) * this.p[j78][NxDu]) + (this.c * this.p[fCZX1V][NxDu]);
                                var x2 = (2 * this.c * this.p[Cilg][NxDu]) + ((this.c - 3) * this.p[A4nB][NxDu]) + ((3 - 2 * this.c) * this.p[j78][NxDu]) + (-this.c * this.p[fCZX1V][NxDu]);
                                var xVbCj = (-this.c * this.p[Cilg][NxDu]) + (this.c * this.p[j78][NxDu]);
                                var uL4e = this.p[A4nB][NxDu];
                                ex1I[NxDu] = x1 * kteoY9 + x2 * p2L4UwC + xVbCj * u + uL4e;
                        }
                        return ex1I;
                };

		this.CjM8bk5 = function( vUy6i,index) {
			
			
			var Q61G = vUy6i * (this.p.length-1);
			var node = Math.floor(Q61G);
			var progress = Q61G - node;

			var Cilg = node-1; if(Cilg < 0) Cilg = 0;
			var A4nB = node;
			var j78 = node+1; if(j78 >= this.p.length) j78 = this.p.length-1;
			var fCZX1V = node+2; if(fCZX1V >= this.p.length) fCZX1V = this.p.length-1;

			var u = progress;
			var p2L4UwC = progress*progress;
			var kteoY9 = progress*progress*progress;

			var ex1I = new Array(this.p[0].length);
			var NxDu=index;
				var x1 = ( -this.c * this.p[Cilg][NxDu] ) + ( (2 - this.c) * this.p[A4nB][NxDu] ) + ( (this.c-2) * this.p[j78][NxDu] ) + ( this.c * this.p[fCZX1V][NxDu] );
				var x2 = ( 2 * this.c * this.p[Cilg][NxDu] ) + ( (this.c-3) * this.p[A4nB][NxDu] ) + ( (3 - 2 * this.c) * this.p[j78][NxDu] ) + ( -this.c * this.p[fCZX1V][NxDu] );
				var xVbCj = ( -this.c * this.p[Cilg][NxDu] ) + ( this.c * this.p[j78][NxDu] );
				var uL4e = this.p[A4nB][NxDu];

				ex1I[NxDu] = x1*kteoY9 + x2*p2L4UwC + xVbCj*u + uL4e;
			return ex1I;	
		};

		if(!c && c!=0) this.c = 0.7;
		else this.c = c;
		this.p = GjVC3;

		return this;	
	}
};

dojo.declare(tmw.util.sym.FYaE,null,{









	egn1DGJ: 50 ,
	CqY949: 55 ,
	iFFd: 40 ,
	u5LHSp: Math.pow(20,2) ,
	X1EP2: Math.pow(20,2) ,
	y8QI: Math.pow(22,2) ,
	ySqO: Math.pow(22,2) ,
	

	constructor: function(e295SM, SUt1, egn1DGJ){
		if (e295SM)
			this.y8QI=e295SM;
		if (SUt1)
			this.xRHIv=SUt1;
		if (egn1DGJ)
			this.CqY949=egn1DGJ;
	} ,


	p1FMG: function(list, j2882zZ){
		if (j2882zZ!=list[0])
			list.splice(0,0,j2882zZ);
	} ,


	DZP6: function(list, j2882zZ){
		if (j2882zZ!=list[list.length-1])
			list.push(j2882zZ);
	} ,


	JSGfPZ: function(list, j2882zZ){
		if (j2882zZ!=list[list.length-2])
			list.splice(list.length-1,0,j2882zZ);
	} ,


	ssZE7I: function(list, j2882zZ){
		if (j2882zZ!=list[1])
			list.splice(1,0,j2882zZ);
	} ,


	c5kE: function(x1, y1, x2, y2){
		return (x1*x2+y1*y2);
	} ,


	PZKO5J: function(x, y){
		return Math.sqrt(x*x+y*y);
	} ,


	qIW5xeG: function(x, y){
		return (x*x+y*y);
	} ,


	asSB: function(x1, y1, x2, y2){
		return this.PZKO5J(x1-x2, y1-y2);
	} ,


	JkiM: function(x1, y1, x2, y2){
		return this.qIW5xeG(x1-x2, y1-y2);
	} ,


	yT7Ql: function(FS4s7, QdYOWg){
		var jnj, IfANF;

		jnj=FS4s7.iqKC(true);
		IfANF=QdYOWg.iqKC(true);
		return this.JkiM(jnj.x, jnj.y, IfANF.x, IfANF.y);
		
	} ,


	MlA: function(FS4s7, QdYOWg){
		var p,r,eTSO,W6Gr,LyWQH,OjXV1M,d,hqF8X94,jKh,kiFbWY,HY2iRC,BeV6L,JYBi,Cdf5,WWWQ,RK84n;
		p=3.1415926535898/180;
		r=6371;
		eTSO=2*r*1000;
		W6Gr=FS4s7.RlHt10*p;
		LyWQH=FS4s7.Fy1t2*p;
		OjXV1M=Math.cos(W6Gr);
		d=0;
		hqF8X94=W6Gr;
		jKh=LyWQH;
		kiFbWY=OjXV1M;

		HY2iRC=QdYOWg.RlHt10*p;
		BeV6L=QdYOWg.Fy1t2*p;
		JYBi=Math.cos(HY2iRC);
		Cdf5=HY2iRC-hqF8X94;
		WWWQ=BeV6L-jKh;
		RK84n=Math.sin(Cdf5/2) * Math.sin(Cdf5/2) + kiFbWY * JYBi * Math.sin(WWWQ/2) * Math.sin(WWWQ/2);

		d += eTSO*Math.atan2(Math.sqrt(RK84n), Math.sqrt(1-RK84n));
		W6Gr = HY2iRC;
		LyWQH = BeV6L;
		OjXV1M = kiFbWY;
		return d;
	} ,


	u44NB: function(FS4s7, QdYOWg){
		return Math.pow(this.MlA(FS4s7, QdYOWg),2);
	} ,


	bLR: function(o8WL, baNN, pt){

		
		
		

		var g3YS7sl,uoEy,jWKX,b;
		var sO1TYX,MD7H,vWjZ,VqYOG1,tUMY6y={RlHt10:0,Fy1t2:0};

		sO1TYX=baNN.RlHt10-o8WL.RlHt10;
		FYE6Uu=baNN.Fy1t2-o8WL.Fy1t2;

		jWKX=this.qIW5xeG(sO1TYX, FYE6Uu);
		vWjZ=pt.RlHt10-o8WL.RlHt10;
		VqYOG1=pt.Fy1t2-o8WL.Fy1t2;

		uoEy=this.c5kE(vWjZ, VqYOG1, sO1TYX, FYE6Uu);

		if (uoEy<=0)
			g3YS7sl=this.u44NB(pt, o8WL);
		else if (jWKX<uoEy)
			g3YS7sl=this.u44NB(pt, baNN);
		else {
			b=uoEy/jWKX;
			tUMY6y.RlHt10=o8WL.RlHt10+b*sO1TYX;
			tUMY6y.Fy1t2=o8WL.Fy1t2+b*FYE6Uu;
			g3YS7sl=this.u44NB(pt, tUMY6y);
		}

		return g3YS7sl;
	} ,


	 
	dV6KH: function(v, s, T7DVs){
		var xiEjcn=[];
		var cx9=0;
		
		xiEjcn[cx9]=v[s];
		for(var A4nB=s;A4nB<=T7DVs;A4nB++){
			
			if (this.u44NB(v[A4nB],xiEjcn[cx9])<this.ySqO)
				continue;
			xiEjcn[++cx9]=v[A4nB];
		}
		if (xiEjcn[cx9]!=v[A4nB-1])
			xiEjcn[++cx9]=v[A4nB-1];
		
		return xiEjcn;
	} ,


	 
	I1dgeG: function(v,tG5J21U,NxDu){
		var w364, u6GikGY;	

		if (tG5J21U+1>=NxDu) return{
			index: null ,
			asSB: 0
		};

		var ujITD9, HVxLu; 	
		var o8WL, baNN, k4Qo, uoEy;
		var g3YS7sl, jWKX;	






		o8WL=v[tG5J21U];
		baNN=v[NxDu];
		w364=0;
		for(var A4nB=tG5J21U+1;A4nB<NxDu;A4nB++){















			g3YS7sl=this.bLR(o8WL,baNN,v[A4nB]);
			if (g3YS7sl<=w364) continue;
			u6GikGY=A4nB;
			w364=g3YS7sl;
		}
		if (w364<=this.y8QI){
			w364=0;
			u6GikGY=null;
		}	
		return {
			index: u6GikGY ,
			asSB: w364
		};
	} ,


	CjJT: function(v, s, T7DVs){
		var groups=[], cx9=0;

		if (s>T7DVs) return groups;

		groups[cx9]=s;
		for(var A4nB=s+1;A4nB<=T7DVs;A4nB++){
			if(v[A4nB].index>v[A4nB-1].index+1){
				groups[++cx9]=A4nB-1;
				groups[++cx9]=A4nB;
			};
		}
		if (cx9%2==0)
			groups[++cx9]=A4nB-1;

		return groups;
	} ,


	q6K: function(grp, vUy6i){
		var fcYDH=[], pTpB=0, A4nB, n;

		if (!vUy6i)
			vUy6i=1;

		for(A4nB=0;A4nB<grp.length;A4nB+=2){
			fcYDH[pTpB++]=grp[A4nB];
			fcYDH[pTpB]=grp[A4nB+1];
			for(n=grp[A4nB]+1;n<grp[A4nB+1];n+=vUy6i){
				fcYDH.splice(pTpB,0,n,n);
				pTpB+=2;
			}
			pTpB++;
		}
		return fcYDH;
	} ,


	PV35: function(path){
		var Sf3Q=[], cx9=-1, i8Q6hC, n;

		for(n=0;n<path.length;n+=2){
			if (path[n]!=i8Q6hC){
				if (i8Q6hC)
					Sf3Q[cx9].push(i8Q6hC);
				Sf3Q[++cx9]=[];
			}
			Sf3Q[cx9].push(path[n]);
			i8Q6hC=path[n+1];
		}
		if (i8Q6hC)
			Sf3Q[cx9].push(i8Q6hC);
		return Sf3Q;
	} ,


	ODHW: function(t5wtMHL, filter){
		var 	hBxL0=30, 
			p=Math.PI/180, iQ6J9H6=6371, 
			eTSO=2*iQ6J9H6*1000, A4nB=x=d=qF5821=0,
			W6Gr=LyWQH=OjXV1M=kiFbWY=JYBi
			=Cdf5=WWWQ=RK84n=dx=hqF8X94=jKh=HY2iRC=BeV6L=0, r,
			BSfa9w=[], G4A=t5wtMHL.getVertexCount();
		if (!filter) filter=hBxL0;
		for (A4nB=0;A4nB<G4A;A4nB++){
			r=t5wtMHL.getVertex(A4nB);
			if (A4nB>0) {
				hqF8X94=W6Gr;
				jKh=LyWQH;
				kiFbWY=OjXV1M;

				HY2iRC = r.lat()*p;
				BeV6L = r.lng()*p;
				JYBi = Math.cos(HY2iRC);
				Cdf5 = HY2iRC-hqF8X94;
				WWWQ = BeV6L-jKh;
				RK84n = Math.sin(Cdf5/2) * Math.sin(Cdf5/2) +
					kiFbWY * JYBi * Math.sin(WWWQ/2) * Math.sin(WWWQ/2);
				dx = eTSO*Math.atan2(Math.sqrt(RK84n), Math.sqrt(1-RK84n));
				qF5821 += dx;
				d += dx;
				x = Math.round(d);
				W6Gr = HY2iRC;
				LyWQH = BeV6L;
				OjXV1M = kiFbWY;
			} else {
				W6Gr = r.lat()*p;
				LyWQH = r.lng()*p;
				OjXV1M = Math.cos(W6Gr);
			}
			if (A4nB==0 || A4nB==(G4A-1) || qF5821>=filter) {
				qF5821=0;
				BSfa9w.push(r);
			};
		}
		return BSfa9w;
	} ,


	V440A36: function(v, S7ylrE3){
		
		var grp, VMU206, o48P1GP,
		    sC6G=[],
		    fcn5, wTHUR7E, IPGx,
		    mH8D;
	
		grp=this.CjJT(v,0,v.length-1);
		VMU206=new Array(grp.length);

		if (S7ylrE3){
			this.egn1DGJ=this.iFFd;
			this.ySqO=this.X1EP2;
		} else {
			this.egn1DGJ=this.CqY949;
			this.ySqO=this.u5LHSp;
		}

		for(var A4nB=0;A4nB<grp.length;A4nB+=2){
			VMU206[A4nB]=sC6G.length;
			sC6G=sC6G.concat(this.dV6KH(v,grp[A4nB],grp[A4nB+1]));
			VMU206[A4nB+1]=sC6G.length-1;
		}

		console.log(sC6G.length+ "points after vtx reduction");
		
		if (VMU206[A4nB-1]<this.egn1DGJ/4)
			return {
				jKoLsLR: sC6G, 
				O4kRNOn: this.q6K(VMU206)
			};
		






		o48P1GP=VMU206.slice(0);	
		IPGx=VMU206.length;
		fcn5=new Array(IPGx/2);

		





		do {
			wTHUR7E=null;
			for(var A4nB=0;A4nB<o48P1GP.length;A4nB+=2){
				if (!fcn5[A4nB/2]){
					fcn5[A4nB/2]=this.I1dgeG(sC6G,o48P1GP[A4nB],o48P1GP[A4nB+1]);
				}
				if (	(wTHUR7E==null && fcn5[A4nB/2].asSB>0 ) || 
					(wTHUR7E!=null && fcn5[A4nB/2].asSB>fcn5[wTHUR7E].asSB)
				){
					wTHUR7E=A4nB/2;
				};
			}
			if (wTHUR7E!=null){
				o48P1GP.splice(wTHUR7E*2+1,0,fcn5[wTHUR7E].index,fcn5[wTHUR7E].index);
				fcn5[wTHUR7E]=null;
				fcn5.splice(wTHUR7E+1,0,null);
				IPGx++;
			};
		} while (wTHUR7E!=null && IPGx<this.egn1DGJ);
		return {
			jKoLsLR: sC6G ,
			O4kRNOn: o48P1GP
		};
	}
});


dojo.provide("tmw.math.math");

tmw.math.degToRad = function(/* float */x) {
	//	summary
	//	Converts degrees to radians.
	return (x*Math.PI) / 180; 	//	float
}
tmw.math.radToDeg = function(/* float */x) { 
	//	summary
	//	Converts radians to degrees.
	return (x*180) / Math.PI; 	//	float
}

tmw.math.factorial = function(/* integer */n){
	//	summary
	//	Returns n!
	if(n<1){ return 0; }
	var retVal = 1;
	for(var i=1;i<=n;i++){ retVal *= i; }
	return retVal;	//	integer
}

tmw.math.permutations = function(/* integer */n, /* integer */k) {
	//	summary
	//	The number of ways of obtaining an ordered subset of k elements from a set of n elements
	if(n==0 || k==0) return 1;
	return (tmw.math.factorial(n) / tmw.math.factorial(n-k));	//	float
}

tmw.math.combinations = function (/* integer */n, /* integer */r) {
	//	summary
	//	The number of ways of picking n unordered outcomes from r possibilities
	if(n==0 || r==0) return 1;
	return (tmw.math.factorial(n) / (tmw.math.factorial(n-r) * tmw.math.factorial(r)));	//	float
}

tmw.math.bernstein = function(/* float */t, /* float */n, /* float */i) {
	//	summary
	//	Calculates a weighted average based on the Bernstein theorem.
	return (tmw.math.combinations(n,i) * Math.pow(t,i) * Math.pow(1-t,n-i));	//	float
}

tmw.math.gaussianRandom = function(){
	//	summary
	//	Returns random numbers with a Gaussian distribution, with the mean set at 0 and the variance set at 1.
	var k = 2;
	do {
		var i = 2 * Math.random() - 1;
		var j = 2 * Math.random() - 1;
		k = i * i + j * j;
	} while (k >= 1);
	k = Math.sqrt((-2 * Math.log(k)) / k);
	return i * k;	//	float
}

tmw.math.mean = function() {
	//	summary
	//	Calculates the mean of an Array of numbers.
	var array = dojo.lang.isArray(arguments[0]) ? arguments[0] : arguments;
	var mean = 0;
	for (var i = 0; i < array.length; i++) { mean += array[i]; }
	return mean / array.length;	//	float
}

tmw.math.round = function(/* float */number, /* integer */places) {
	//	summary
	//	Extends Math.round by adding a second argument specifying the number of decimal places to round to.
	// TODO: add support for significant figures
	if (!places) { var shift = 1; }
	else { var shift = Math.pow(10, places); }
	return Math.round(number * shift) / shift;	//	float
}

tmw.math.sd = tmw.math.standardDeviation = function(/* array */){
	//	summary
	//	Calculates the standard deviation of an Array of numbers
	var array = dojo.lang.isArray(arguments[0]) ? arguments[0] : arguments;
	return Math.sqrt(tmw.math.variance(array));	//	float
}

tmw.math.variance = function(/* array */) {
	//	summary
	//	Calculates the variance of an Array of numbers
	var array = dojo.lang.isArray(arguments[0]) ? arguments[0] : arguments;
	var mean = 0, squares = 0;
	for (var i = 0; i < array.length; i++) {
		mean += array[i];
		squares += Math.pow(array[i], 2);
	}
	return (squares / array.length) - Math.pow(mean / array.length, 2);	//	float
}

tmw.math.range = function(/* integer */a, /* integer */b, /* integer */step) {
	//	summary
	//	implementation of Python's range()
    if(arguments.length < 2) {
        b = a;
        a = 0;
    }
    if(arguments.length < 3) {
        step = 1;
    }

    var range = [];
    if(step > 0) {
        for(var i = a; i < b; i += step) {
            range.push(i);
        }
    } else if(step < 0) {
        for(var i = a; i > b; i += step) {
            range.push(i);
        }
    } else {
        throw new Error("tmw.math.range: step must be non-zero");
    }
    return range;	//	array
}
dojo.provide("tmw.math.math.points");
dojo.require("tmw.math.math");

tmw.math.points = {
	translate: function(/* array */a, /* array */b) {
		//	summary
		//	translate a by b, and return the result.
		if( a.length != b.length ) {
			dojo.raise("tmw.math.translate: points not same size (a:[" + a + "], b:[" + b + "])");
		}
		var c = new Array(a.length);
		for(var i = 0; i < a.length; i++) {
			c[i] = a[i] + b[i];
		}
		return c;	//	array
	},

	midpoint: function(/* array */a, /* array */b) {
		//	summary
		//	Find the point midway between a and b
		if( a.length != b.length ) {
			dojo.raise("tmw.math.midpoint: points not same size (a:[" + a + "], b:[" + b + "])");
		}
		var c = new Array(a.length);
		for(var i = 0; i < a.length; i++) {
			c[i] = (a[i] + b[i]) / 2;
		}
		return c;	//	array
	},

	invert: function(/* array */a) {
		//	summary
		//	invert the values in a and return it.
		var b = new Array(a.length);
		for(var i = 0; i < a.length; i++) { b[i] = -a[i]; }
		return b;	//	array
	},

	distance: function(/* array */a, /* array */b) {
		//	summary
		//	Calculate the distance between point a and point b
		return Math.sqrt(Math.pow(b[0]-a[0], 2) + Math.pow(b[1]-a[1], 2));	// 	float
	}
};

