/*ADOBE SYSTEMS INCORPORATED
Copyright 2007 Adobe Systems Incorporated
All Rights Reserved.

NOTICE:  Adobe permits you to use, modify, and distribute this file in accordance with the
terms of the Adobe license agreement accompanying it.  If you have received this file from a
source other than Adobe, then your use, modification, or distribution of it requires the prior
written permission of Adobe.*/
if(!ColdFusion.Map){
ColdFusion.Map={};
}
var coldFusion_markerObjCache=new Array();
var $MAP=ColdFusion.Map;
$MAP.statusCodeObject={code200:"A directions request could not be successfully parsed. For example, the request may have been rejected if it contained more than the maximum number of waypoints allowed.",code400:"A directions request could not be successfully parsed. For example, the request may have been rejected if it contained more than the maximum number of waypoints allowed.",code500:"A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known",code601:"The HTTP query parameter was either missing or had no value. For geocoding requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input",code602:"No corresponding geographic location could be found for the specified address. This may be due to the fact that the address is relatively new, or it may be incorrect",code603:"The geocode for the given address or the route for the given directions query cannot be returned due to legal or contractual reasons",code604:"The GDirections object could not compute directions between the points mentioned in the query. This is usually because there is no route available between the two points, or because we do not have data for routing in that region",code610:"The given key is either invalid or does not match the domain for which it was given",code620:"The given key has gone over the requests limit in the 24 hour period or has submitted too many requests in too short a period of time. If you are sending multiple requests in parallel or in a tight loop, use a timer or pause in your code to make sure you do not send the requests too quickly"};
ColdFusion.Map.init=function(_3e5,_3e6,_3e7,type,_3e9,_3ea,_3eb,_3ec,_3ed,_3ee,_3ef,_3f0,_3f1,_3f2,_3f3,_3f4,_3f5,_3f6,_3f7,_3f8,_3f9,_3fa,_3fb,_3fc,_3fd,_3fe,_3ff,_400){
var _401={divName:_3e5,type:type,layout:"fit",renderTo:_3e5,centerAddress:_3f6,centerLatitude:_3f7,centerLongitude:_3f8,markerItems:_3fc,onLoad:_3fd,onError:_3fe,showCenterMarker:_3f1,showAllMarker:_3f2,markerColor:_3fa,markerIcon:_3fb};
if(_3e7!=null&&typeof (_3e7)!="undefined"){
_401.width=_3e7;
}else{
_401.width=400;
}
if(_3e6!=null&&typeof (_3e6)!="undefined"){
_401.height=_3e6;
}else{
_401.height=400;
}
if(_3e9!=null&&typeof (_3e9)!="undefined"){
_401.zoomLevel=_3e9;
}else{
_401.zoomLevel=3;
}
_401.hideBorders=_3eb;
if(!_3eb){
if(_3ea==null||typeof _3ea==="undefined"||_3ea.length==0){
_3ea=" ";
}
_401.title=_3ea;
_401.collapsible=_3ec;
}
if(_3fa==null&&_3fb==null){
_401.markerColor="#00FF00";
}
var _402=new Ext.Panel(_401);
ColdFusion.objectCache[_3e5]=_401;
_401.mapPanel=[_402];
var _403=["enableDragging"];
if(_3ed){
_403.push("enableScrollWheelZoom");
}else{
_403.push("disableScrollWheelZoom");
}
if(_3ee){
_403.push("enableDoubleClickZoom");
}else{
_403.push("disableDoubleClickZoom");
}
if(_3ef){
_403.push("enableContinuousZoom");
}else{
_403.push("disableContinuousZoom");
}
var _404=$MAP.parseControlProperties(_3f0,_3f3,_3f4,_3f5);
var _405=[];
for(i=0;i<_401.markerItems.length;i++){
var _406=$MAP.parseMarker(_401.markerItems[i]);
_405.push(_406);
}
if(_3f9==null||typeof _3f9==="undefined"){
_3f9="";
}
var _407={marker:{title:_3f9}};
if(_401.markerColor!=null&&typeof _401.markerColor!="undefined"){
_407.marker.markercolor=_401.markerColor;
}else{
if(_401.markerIcon!=null&&typeof _401.markerIcon!="undefined"){
_407.marker.markericon=_401.markerIcon;
}
}
if(_3ff!=null||_400!=null){
_407.listeners={click:$MAP.markerOnClickHandler};
_407.marker.bindcallback=_3ff;
_407.marker.markerwindowcontent=_400;
_407.marker.name=_3e5;
}
if(_401.centerAddress!=null&&typeof _401.centerAddress==="string"){
_407.geoCodeAddr=_401.centerAddress;
_407.marker.address=_401.centerAddress;
}else{
_407.lat=_401.centerLatitude;
_407.lng=_401.centerLongitude;
_407.marker.address=_401.centerAddress;
}
var _408=false;
if(_3f4!=null&&typeof _3f4=="string"&&_3f4.toUpperCase()=="ADVANCED"){
_408=true;
}
var _409=new Ext.ux.GMapPanel({xtype:"gmappanel",region:"center",zoomLevel:_401.zoomLevel,gmapType:_401.type,mapConfOpts:_403,mapControls:_404,setCenter:_407,markers:_405,border:!_401.hideBorders,onLoadhandler:$MAP.onLoadCompleteHandler,onErrorhandler:$MAP.onErrorHandler,name:_401.divName,noCenterMarker:!_3f1,showAllMarker:_3f2,advanceMapTypeControl:_408});
_402.add(_409);
_401.mapPanelObject=_409;
_402.render();
ColdFusion.Log.info("map.initialized","widget",[_3e5]);
return _402;
};
$MAP.addMarker=function(name,_40b){
var _40c=$MAP.getMapPanelObject(name);
var _40d=$MAP.parseMarker(_40b);
var _40e=[];
_40e.push(_40d);
_40c.addMarkers(_40e);
ColdFusion.Log.info("map.addmarker.markeradded","widget",[name,_40e.length]);
};
$MAP.setCenter=function(name,_410){
var _411=$MAP.getMapPanelObject(name);
var lat;
var lng;
if(_410.latitude&&_410.longitude){
if(typeof _410.latitude!="number"||typeof _410.longitude!="number"){
ColdFusion.handleError(null,"map.setcenter.latlngnonnumeric","widget",[name,_410.latitude,_410.longitude],null,null,true);
}else{
lat=_410.latitude;
lng=_410.longitude;
}
var _414=new GLatLng(lat,lng);
_411.getMap().setCenter(_414,_411.zoomLevel,_411.parsedMapType);
}else{
if(_410.address){
if(typeof _410.address!="string"){
ColdFusion.handleError(null,"map.setcenter.addressnotstring","widget",[name,_410.address],null,null,true);
}else{
_411.geoCodeLookup(_410.address);
}
}else{
ColdFusion.handleError(null,"map.setcenter.invalidcenter","widget",[name],null,null,true);
}
}
ColdFusion.Log.info("map.setcenter.centerset","widget",[name]);
};
$MAP.getLatitudeLongitude=function(_415,_416){
geocoder=new GClientGeocoder();
if(_416==null||!typeof _416==="function"){
_416=$MAP.LatitudeLongitudeHanlder;
}
geocoder.getLatLng(_415,_416);
};
$MAP.addEvent=function(name,_418,_419,_41a){
var _41b=$MAP.getMapPanelObject(name);
_41b.addEventToMap(_418,_419,_41a);
};
$MAP.setZoomLevel=function(name,_41d){
var _41e=$MAP.getMapPanelObject(name);
_41e.zoomLevel=_41d;
_41e.getMap().setZoom(_41d);
};
$MAP.getMapObject=function(name){
var _420=$MAP.getMapPanelObject(name);
if(_420!=null){
return _420.getMap();
}
};
$MAP.parseMarker=function(_421){
var _422={};
if(_421.latitude&&_421.longitude){
if(typeof _421.latitude!="number"||typeof _421.longitude!="number"){
ColdFusion.handleError(null,"map.marker.latlngnonnumeric","widget",[_421.latitude,_421.longitude],null,null,true);
}else{
_422.lat=_421.latitude;
_422.lng=_421.longitude;
}
}else{
if(_421.address!=null){
if(typeof _421.address!="string"){
ColdFusion.handleError(null,"map.marker.addressnotstring","widget",[_421.address],null,null,true);
}else{
_422.address=_421.address;
}
}
}
var _423={};
if(_421.tip==null){
_423.title=" ";
}else{
_423.title=_421.tip;
}
if(_421.markercolor!=null&&typeof _421.markercolor!="undefined"){
_423.markercolor=_421.markercolor;
}else{
if(_421.markericon!=null&&typeof _421.markericon!="undefined"){
_423.markericon=_421.markericon;
}
}
if(_421.markerbindlistener!=null||_421.markerwindowcontent!=null){
_422.listeners={click:$MAP.markerOnClickHandler};
_423.bindcallback=_421.markerbindlistener;
_423.markerwindowcontent=_421.markerwindowcontent;
_423.name=_421.name;
}
_422.marker=_423;
return _422;
};
$MAP.parseControlProperties=function(_424,_425,_426,_427){
var _428=["NonExistantControl"];
if(_424){
_428.push("GScaleControl");
}
if(_426&&_426.toUpperCase()=="BASIC"){
_428.push("GMapTypeControl");
}else{
if(_426&&_426.toUpperCase()=="ADVANCED"){
_428.push("GMenuMapTypeControl");
}
}
if(_425){
_428.push("GOverviewMapControl");
}
if(_427!=null&&_427!="undefined"){
_427=_427.toUpperCase();
switch(_427){
case "SMALL":
_428.push("GSmallMapControl");
break;
case "SMALL3D":
_428.push("GSmallZoomControl3D");
break;
case "LARGE":
_428.push("GLargeMapControl");
break;
case "LARGE3D":
_428.push("GLargeMapControl3D");
break;
}
}
return _428;
};
$MAP.onErrorHandler=function(name,_42a){
var _42b=ColdFusion.objectCache[name];
var _42c=$MAP.statusCodeObject;
var _42d=$MAP.retrieveStatueMessage(_42a);
var _42e=_42b.onError;
if(_42e!=null&&typeof _42e==="function"){
_42e.call(null,_42a,_42d);
}else{
alert("Error: "+_42d);
}
ColdFusion.handleError(null,"map.loadMap.error","map",[name,_42a,_42d],null,null,true);
};
$MAP.onLoadCompleteHandler=function(name){
var _430=ColdFusion.objectCache[name];
var _431=_430.onLoad;
if(_431!=null&&typeof _431==="function"){
_431.call();
}
};
$MAP.retrieveStatueMessage=function(code){
var _433;
switch(code){
case 200:
_433=$MAP.statusCodeObject.code200;
break;
case 400:
_433=$MAP.statusCodeObject.code400;
break;
case 500:
_433=$MAP.statusCodeObject.code500;
break;
case 601:
_433=$MAP.statusCodeObject.code601;
break;
case 602:
_433=$MAP.statusCodeObject.code602;
break;
case 603:
_433=$MAP.statusCodeObject.code603;
break;
case 604:
_433=$MAP.statusCodeObject.code604;
break;
case 610:
_433=$MAP.statusCodeObject.code610;
break;
case 620:
_433=$MAP.statusCodeObject.code620;
break;
}
return _433;
};
$MAP.markerOnClickHandler=function(_434){
coldFusion_markerObjCache[this.name]=this.marker;
if(this.bindcallback!=null&&typeof this.bindcallback=="function"){
var _435=this.address;
if(_435==null||typeof _435=="undefined"){
_435="";
}
this.bindcallback.call(null,this.name,_434.lat(),_434.lng(),_435);
}else{
if(this.statictext!=null&&typeof this.statictext!="undefined"){
this.marker.openInfoWindowHtml(this.statictext);
}
}
};
ColdFusion.Map.loadMarkerWindowInfo=function(data,_437){
var _438=coldFusion_markerObjCache[_437._cf_marker_name];
_438.openInfoWindowHtml(data+"");
};
ColdFusion.Map.bindOnErrorHandler=function(data,_43a){
ColdFusion.handleError(null,"map.markerbind.binderror","widget",[data],null,null,true);
};
$MAP.getMapPanelObject=function(name){
var _43c=ColdFusion.objectCache[name];
if(_43c==null||typeof (_43c)=="undefined"){
ColdFusion.handleError(null,"map.getmappanelobject.notfound","widget",[name],null,null,true);
}
return _43c.mapPanelObject;
};

