Type.registerNamespace("Pikaba.Client");Pikaba.Client.SearchByRadius=function(A){Pikaba.Client.SearchByRadius.initializeBase(this,[A]);this.TargetControlID=null;this.TargetControlUniqID=null;this.CountryDropDownID=null;this.StateDropDownID=null;this.ZipControlID=null;this.DefaultZipText=null;this.LatitudeContainer=null;this.LongitudeContainer=null;this.RadiusDropDownID=null;this._getCoordinates=null;this._checkState=null};Pikaba.Client.SearchByRadius.prototype={initialize:function(){Pikaba.Client.SearchByRadius.callBaseMethod(this,"initialize");var B=this.getCountryValue();var C=this.getStateValue();var A=this.getZipValue();if(B==0||(C==0&&A=="")){$get(this.RadiusDropDownID).disabled=true}this._getCoordinates=Function.createDelegate(this,this.getCoordinates);this._checkState=Function.createDelegate(this,this.setEnableState);$addHandler($get(this.TargetControlID),"click",this._getCoordinates);$addHandler($get(this.StateDropDownID),"change",this._checkState);$addHandler($get(this.ZipControlID),"keyup",this._checkState);$addHandler($get(this.CountryDropDownID),"change",this._checkState)},dispose:function(){$removeHandler($get(this.TargetControlID),"click",this._getCoordinates);$removeHandler($get(this.ZipControlID),"keyup",this._checkState);$removeHandler($get(this.StateDropDownID),"change",this._checkState);$removeHandler($get(this.CountryDropDownID),"change",this._checkState);this.TargetControlID=null;this.TargetControlUniqID=null;this.CountryDropDownID=null;this.StateDropDownID=null;this.ZipControlID=null;this.DefaultZipText=null;this._getCoordinates=null;this.LatitudeContainer=null;this.LongitudeContainer=null;this.RadiusDropDownID=null;this._checkState=null;this._getCoordinates=null;Pikaba.Client.SearchByRadius.callBaseMethod(this,"dispose")},getCoordinates:function(D){var F=$get(this.RadiusDropDownID);var A=F[F.selectedIndex].value;if(A!=null&&!isNaN(parseInt(A))&&parseInt(A)!=0){if(parseInt(A)!=-1){var C=this.getCountryValue();var E=this.getStateValue();var B=this.getZipValue();if(C!=0&&(E!=0||B!="")){D.stopPropagation();D.preventDefault();Sys.Net.WebServiceProxy.invoke($url("~/_srv/Location.asmx"),"GetLocationWithCoordinatesFromPikaba",false,{country:C,state:E,zip:B},Function.createDelegate(this,this.onPikabaServiceResponse));return false}else{return false}}}else{$get(this.CountryDropDownID).value=0;$get(this.StateDropDownID).selectedIndex=0;$get(this.ZipControlID).value=""}},setEnableState:function(C){var A=this.getZipValue();var B=this.getCountryValue();var D=this.getStateValue();if(B==0||(D==0&&A=="")){$get(this.RadiusDropDownID).disabled=true}else{$get(this.RadiusDropDownID).disabled=false}},getZipValue:function(){var B=$get(this.ZipControlID);var A="";if(B.value!=this.DefaultZipText){A=B.value}return A},getStateValue:function(){var A=$get(this.StateDropDownID);var B=null;if(A.selectedIndex!=-1){B=A[A.selectedIndex].value}if(B==null){B=0}return B},getCountryValue:function(){var A=$get(this.CountryDropDownID);var B=null;B=A[A.selectedIndex].value;if(B==null){B=0}return B},onPikabaServiceResponse:function(A){if((A.Latitude!=null&&A.Longitude!=null)&&(A.Latitude!=0&&A.Longitude!=0)){$get(this.LatitudeContainer).value=A.Latitude;$get(this.LongitudeContainer).value=A.Longitude;__doPostBack(this.TargetControlUniqID,"")}else{Sys.Net.WebServiceProxy.invoke($url("~/_srv/Location.asmx"),"GetLocationWithCoordinatesFromAPI",false,{country:A.Country,state:A.State,zip:A.Zip},Function.createDelegate(this,this.onAPIServiceResponse))}},onAPIServiceResponse:function(A){if((A.Latitude!=null&&A.Longitude!=null)&&(A.Latitude!=0&&A.Longitude!=0)){$get(this.LatitudeContainer).value=A.Latitude;$get(this.LongitudeContainer).value=A.Longitude}__doPostBack(this.TargetControlUniqID,"")},get_TargetControlID:function(){return this.TargetControlID},set_TargetControlID:function(A){if(this.TargetControlID!=A){this.TargetControlID=A}},get_CountryDropDownID:function(){return this.CountryDropDownID},set_CountryDropDownID:function(A){if(this.CountryDropDownID!=A){this.CountryDropDownID=A}},get_StateDropDownID:function(){return this.StateDropDownID},set_StateDropDownID:function(A){if(this.StateDropDownID!=A){this.StateDropDownID=A}},get_ZipControlID:function(){return this.ZipControlID},set_ZipControlID:function(A){if(this.ZipControlID!=A){this.ZipControlID=A}},get_DefaultZipText:function(){return this.DefaultZipText},set_DefaultZipText:function(A){if(this.DefaultZipText!=A){this.DefaultZipText=A}},get_LongitudeContainer:function(){return this.LongitudeContainer},set_LongitudeContainer:function(A){if(this.LongitudeContainer!=A){this.LongitudeContainer=A}},get_LatitudeContainer:function(){return this.LatitudeContainer},set_LatitudeContainer:function(A){if(this.LatitudeContainer!=A){this.LatitudeContainer=A}},get_RadiusDropDownID:function(){return this.RadiusDropDownID},set_RadiusDropDownID:function(A){if(this.RadiusDropDownID!=A){this.RadiusDropDownID=A}}};Pikaba.Client.SearchByRadius.descriptor={properties:[{name:"TargetControlID",type:String},{name:"TargetControlUniqID",type:String},{name:"CountryDropDownID",type:String},{name:"StateDropDownID",type:String},{name:"ZipControlID",type:String},{name:"DefaultZipText",type:String},{name:"LatitudeContainer",type:String},{name:"LongitudeContainer",type:String},{name:"RadiusDropDownID",type:String}]};Pikaba.Client.SearchByRadius.inheritsFrom(Sys.UI.Control);Pikaba.Client.SearchByRadius.registerClass("Pikaba.Client.SearchByRadius",Sys.UI.Control);if(typeof (Sys)!=="undefined"){Sys.Application.notifyScriptLoaded()};