// <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
// (c)adxon.com

_[68]={
	$:function(d){
		if(window.GBrowserIsCompatible){
			this._GI(d,this);
			this._BD(d,d);
			this._AT(d);
		}
		else this._GF(d);
	},
	_a:null,
	_A:function(d,e,p){
		var a=this._a,d,v=this._v;
		if(!v){
			if(a){
				d=this._D(d).$;
				a=d._a;
				v=d._v;
			}
			else return;
		}
		v.clearListeners(a,e);
		v.addListener(a,e,p);
	},
	_ac:null,
	_ad:null,
	_ag:null,
	_AT:function(d){
		var a=this._a,x;
		if(x=this._ac)GEvent.addListener(a,'click',x);
		if(x=this._ad)GEvent.addListener(a,'moveend',x);
		if(x=this._ic)GEvent.addListener(a,'infowindowclose',x);
		if(x=this._vc)this.Center(d,x,this._vm);
		if(x=d.getAttribute('center')){
			this.Center(d,x,d.getAttribute('zoom'));
			if(x=d.getAttribute('marks'))this.Mark(d,x);
		}
	},
	_bd:null,
	_BD:function(d){
		var b,i,p,s,x=d.getAttribute('buddy');
		if(x){
			x=x.split(':');
			b=x[0];
			if(x=x[1]){
				x=x.split(',');
				s=this._bs;
				b=d.ownerDocument.getElementById(b).$;
				while(i=x.shift())if(p=s[i])this.Attach(d,i,b,p);
			}
			else{
				this._bd=b;
				this.Attach(d,'markdragged',this,'_MD');
			}
		}
	},
	_bs:{
		infoclosed:'InfoClosed',
		infoopen:'InfoOpen',
		mapchanged:'MapChanged',
		mapclick:'MapClick',
		markclick:'MarkClick',
		markdragged:'MarkDragged'
	},
	_ct:null,
	_d:null,
	_D:function(d){
		return d.firstChild.contentWindow.document.body;
	},
	_gd:null,
	_GD:function(d){
		if(this._ge)this._gd(d);
		else this._ge=1;
	},
	_GF:function(d){
		var c=d.ownerDocument,f=c.createElement('IFRAME');
		d.appendChild(f);
		f.style.width='100%';
		f.style.height='100%';
		f.style.border='none';
		f.frameBorder=0;
		f.src='/tools/c68.'+_.lang+'.php';
	},
	_GI:function(d,t){
		if(GBrowserIsCompatible()){
			var a=new GMap2(d);
			this._a=a;
			this._v=GEvent;
			a.addControl(new GSmallMapControl());
			a.addControl(new GScaleControl());
//			GEvent.addListener(a,'infowindowopen',function(){t._ge=0;if(t._io)t._io(t._ck);t._dk=t._ck;});
//			GEvent.addListener(a,'dragstart',function(){a.closeInfoWindow()});
//			GEvent.addListener(a,'click',function(c,p){t._ck=c?c._i:0});
		}
	},
	_GL:function(w){
		var b,c,d=w.frameElement.parentNode,e=d.$;
		b=w.document.body;
		if(c=d.getAttribute('center'))b.setAttribute('center',c);
		if(c=d.getAttribute('zoom'))b.setAttribute('zoom',c);
		c=w._[68];
		b.$=c;
		c._ac=e._ac;
		c._ad=e._ad;
		c._ic=e._ic;
		c._md=e._md;
		c._vc=e._vc;
		c._vm=e._vm;
		c._GI(b,this);
		c._BD(d);
		e._a=c._a;
		c._AT(b);
	},
	_ic:null,
	_lq:[],
	_md:null,
	_MD:function(d,a,p){
		d=d.ownerDocument.getElementById(this._bd);
		d.value=p;
		this.PanTo(p);
	},
	_v:null,
	_vc:null,
	_vm:120,
	Attach:function(d,e,c,p){
		var a=this._a,f,t=this,v=this._v;
		f=function(e){c[p].call(c,t,e)};
		switch(e){
		case 'infoclosed':
			this._ic=f;
			this._A(d,'infowindowclose',f);
			break;
		case 'infoopen':
			break;
		case 'mapclick':
			this._ac=f;
			this._A(d,'click',f);
			break;
		case 'mapchanged':
			this._ad=f;
			this._A(d,'moveend',f);
			break;
		case 'markdragged':
			f=function(){
				var r=this.getLatLng();
				r.toString=function(){return this.lng()+' '+this.lat()}
				return c[p].call(c,d,t,r);
			}
			this._md=f;
			break;
		}
	},
	bounds:function(){
		var a=this._a,n=a.getBounds(),s=n.getSouthWest();
		n=n.getNorthEast();
		return s.lng()+' '+s.lat()+','+n.lng()+' '+n.lat();
	},
	Center:function(d,c,m){
		if(window.GBrowserIsCompatible){
			var i,k='',x,y;
			if(typeof(c)=='string'){
				c=c.split(':');
				while(i=c.shift()){
					switch(i){
					case 'draggable':
						k='{draggable:true}';
						break;
					case 'mark':
						k='{}';
						break;
					default:
						i=i.split(' ');
						x=1*i[0];
						y=1*i[1];
					}
				}
				if(!(x&&y)){
					x=104;
					y=35;
					m=40;
				}
				this._a.closeInfoWindow();
				if(!(m=Math.floor(m/10)))m=10;
				this._a.setCenter(new GLatLng(y,x),m);
				if(k)this.Mark(d,'[{loc:"'+x+' '+y+'",opt:'+k+'}]');
			}
		}
    	else{
    		d=this._D(d);
    		if(d&&d.$)d.$.Center(d,c,m);
			else{
				this._vc=c;
				this._vm=m;
			}
		}
	},
	info:function(){
		return this._a.getInfoWindow();
	},
	Info:function(d,n,v){
		if(window.GBrowserIsCompatible){
			var a=this._a;
			this._ck=1;
			if(v){
				if(typeof(n)=='string'){
					n=n.split(' ');
					n=new GLatLng(n[1],n[0]);
				}
				if(typeof(v)=='string')a.openInfoWindowHtml(n,v);
				else a.openInfoWindow(n,v);
			}
			else a.closeInfoWindow();
		}
    	else{
    		d=this._D(d);
     		if(d&&d.$)d.$.Info(d,n,v);
    	}
	},
	Mark:function(d,s,b,e){
		if(window.GBrowserIsCompatible){
			var a=this._a,f,i,k,n,o,p=this;
			if(typeof(s)=='string'){
				switch(s.charAt(0)){
				case '{':
				case '[':
					eval('s='+s);
					break;
				default:
					s=s.split(',');
				}
			}
			a.clearOverlays();
			f=this._md;
			b=b*1;
			if(!e)e=1000;
			for(i=b;i<e;){
				k=s[i];
				o=k.opt;
				if(k.o)k=k.o;
				k=k.split(' ');
				k=new GMarker(new GLatLng(k[1],k[0]),o);
				k._={};
				k._.y='mark';
				k._.i=i++;
				a.addOverlay(k);
				if(f)GEvent.addListener(k,'dragend',f);
    		}
    	}
    	else{
    		d=d.firstChild.contentWindow.document.body;
    		d.$.Mark(d,s,b,e);
    	}
	},
	Shape:function(d,s){
		alert('Shape');
	},
	PanTo:function(p){
		if(typeof(p)=='string'){
			p=p.split(' ');
			p=new GLatLng(p[1],p[0]);
		}
		this._a.panTo(p);
	},
	zoom:function(){
		return this._a.getZoom()*10;
	}
};