var EventsGeo={FormElements:{CountryList:null,RegionList:null,RegionTxt:null,SearchRadius:null,PostalCode:null},CodeBehindParams:{RegionCountries:"",PostalCountries:"",GeoDisplayMode:"",SpecifyDistance:"",SpecifyPostalCode:"",CountryControlID:"",RegionControlID:"",TxtRegionControlID:"",SearchRadiusControlID:"",PostalCodeControlID:"",SplitChar:"",CurrentCulture:"",DefaultOptionForDropDown:"",WebServicePath:"",SessionTimeOutErrorMessage:""},LocalParams:{GeoFrame:""},Init:function(regionCountriesArr,postalCountriesArr,geoDisplayMode,specifyDistance,specifyPostalCode,sessionTimeOutErrorMessage,countryControlID,regionControlID,txtRegionControlID,searchRadiusControlID,postalCodeControlID,splitChar,currentCulture,defaultOptionForDropDown,webServicePath){with(EventsGeo.CodeBehindParams){RegionCountries=regionCountriesArr.split(",");PostalCountries=postalCountriesArr.split(",");GeoDisplayMode=geoDisplayMode;SpecifyDistance=specifyDistance;SpecifyPostalCode=specifyPostalCode;SessionTimeOutErrorMessage=sessionTimeOutErrorMessage;CountryControlID=countryControlID;RegionControlID=regionControlID;TxtRegionControlID=txtRegionControlID;SearchRadiusControlID=searchRadiusControlID;PostalCodeControlID=postalCodeControlID;SplitChar=splitChar;CurrentCulture=currentCulture;DefaultOptionForDropDown=defaultOptionForDropDown;WebServicePath=webServicePath}with(EventsGeo.FormElements){CountryList=$get(EventsGeo.CodeBehindParams.CountryControlID);RegionList=$get(EventsGeo.CodeBehindParams.RegionControlID);RegionTxt=$get(EventsGeo.CodeBehindParams.TxtRegionControlID);SearchRadius=$get(EventsGeo.CodeBehindParams.SearchRadiusControlID);PostalCode=$get(EventsGeo.CodeBehindParams.PostalCodeControlID)}EventsGeo.FormElements.CountryList.onchange=function(){EventsGeo.GeoEvents.ShowRegion()};$addHandler(window,"load",function(){EventsGeo.GeoEvents.ShowRegion()});var address=window.location.href;if((address.indexOf("events.")==-1)||(address.indexOf("events.landing")!=-1)){EventsLanding.SetSearchPageData();EventsLanding.RenderPager()}EventsGeo.LocalParams.GeoFrame=$get("geoFrame")},GeoEvents:{GetCurrCountry:function(B){var D=EventsGeo.FormElements.CountryList.options[EventsGeo.FormElements.CountryList.selectedIndex].value.split(EventsGeo.CodeBehindParams.SplitChar);var C=D[0];var A=D[1];if(B=="code"){return A}else{return C}},ShowRegion:function(){var A=EventsGeo.GeoEvents.GetCurrCountry("code");if(EventsGeo.GeoEvents.ContainsCountry(A,EventsGeo.CodeBehindParams.RegionCountries)==true){var B=EventsGeo.GeoEvents.CreateRegionsWebServiceCallParameters();Sys.Net.WebServiceProxy.invoke(EventsGeo.CodeBehindParams.WebServicePath,"GetStates",false,B,EventsGeo.GeoEvents.ShowRegion_OnComplete,EventsGeo.GeoEvents.ShowRegion_OnTimeOut,null,30000);return}EventsGeo.GeoEvents.ToggleDisplayType();return false},CreateRegionsWebServiceCallParameters:function(){var A=new Object();A.countryID=String(EventsGeo.GeoEvents.GetCurrCountry());A.culture=EventsGeo.CodeBehindParams.CurrentCulture;return A},ShowRegion_OnComplete:function(B){var A;var C=false;if(typeof suppressFirstRegionLoad!="undefined"){C=suppressFirstRegionLoad;suppressFirstRegionLoad=false}if(!C){EventsGeo.FormElements.RegionList.options.length=0;A=new Option(EventsGeo.CodeBehindParams.DefaultOptionForDropDown,"0");EventsGeo.FormElements.RegionList.options[0]=A;for(var D in B){A=new Option(D,B[D]);if(A.value.indexOf("function")!=0){EventsGeo.FormElements.RegionList.options[EventsGeo.FormElements.RegionList.options.length]=A}}}EventsGeo.GeoEvents.ToggleDisplayType()},ShowRegion_OnTimeOut:function(A){Events.Utilities.DisplayAjaxError(EventsGeo.LocalParams.GeoFrame,EventsGeo.CodeBehindParams.SessionTimeOutErrorMessage)},ToggleDisplayType:function(){var D=EventsGeo.GeoEvents.GetCurrCountry("code");var A=$get("regionRowDD");var C=$get("regionRowTxt");var B=$get("postalRow");if(EventsGeo.CodeBehindParams.GeoDisplayMode=="search"){if(EventsGeo.GeoEvents.ContainsCountry(D,EventsGeo.CodeBehindParams.PostalCountries)==true&&EventsGeo.GeoEvents.ContainsCountry(D,EventsGeo.CodeBehindParams.RegionCountries)==false){A.style.display="none";C.style.display="none";B.style.display=""}else{if(EventsGeo.GeoEvents.ContainsCountry(D,EventsGeo.CodeBehindParams.PostalCountries)==false&&EventsGeo.GeoEvents.ContainsCountry(D,EventsGeo.CodeBehindParams.RegionCountries)==true){A.style.display="";C.style.display="none";B.style.display="none"}else{A.style.display="none";C.style.display="none";B.style.display="none"}}}else{if(EventsGeo.CodeBehindParams.GeoDisplayMode=="createedit"){if(EventsGeo.GeoEvents.ContainsCountry(D,EventsGeo.CodeBehindParams.RegionCountries)==true&&EventsGeo.FormElements.RegionList.options.length>0){A.style.display="";C.style.display="none";B.style.display="none"}else{C.style.display="";A.style.display="none";B.style.display="none"}}}},ContainsCountry:function(B,A){for(x in A){if(B==A[x]){return true}}return false}}};