var isIE=window.navigator.userAgent.indexOf("MSIE")>-1;var GlassWindow=null;var Dialog=null;function ShowGlassWindow(show){if(GlassWindow==null){GlassWindow=document.createElement('DIV');with(GlassWindow.style){display='none';position='absolute';height=0;width=0;zIndex=1;if(isIE){backgroundColor='#ffffff';filter="progid:DXImageTransform.Microsoft.Alpha(Opacity=40, Style=0)"}else backgroundImage='url(media\\images\\alfa40-fon.png)'}document.body.appendChild(GlassWindow)}if(show){var s=getDocumentSize();with(GlassWindow.style){left=top=0;width=s[0]+'px';height=s[1]+'px'}}GlassWindow.style.display=show?'block':'none'}function resizeModal(width,height){if(Dialog==null)Dialog=document.getElementById('modal');Dialog.style.width=width+"px";Dialog.style.height=height+30+"px";realignModal(width,height)}function realignModal(width,height){if(Dialog==null)Dialog=document.getElementById('modal');var c=getClientCenter();Dialog.style.left=(c[0]-width/2)+'px';Dialog.style.top=(20)+'px';Dialog.focus()}function ShowModalWindow(show){ShowGlassWindow(show);if(Dialog==null)Dialog=document.getElementById('modal');if(show){var c=getClientCenter();Dialog.style.left=(c[0]-1024/2)+'px';Dialog.style.top=(20)+'px';Dialog.style.display='block';Dialog.focus()}else Dialog.style.display='none'}function getDocumentSize(){return[document.body.scrollWidth>document.body.offsetWidth?document.body.scrollWidth:document.body.offsetWidth,document.body.scrollHeight>document.body.offsetHeight?document.body.scrollHeight:document.body.offsetHeight]}function getClientSize(){if(document.compatMode=='CSS1Compat')return[document.documentElement.clientWidth,document.documentElement.clientHeight];else return[document.body.clientWidth,document.body.clientHeight]}function getDocumentScroll(){return[self.pageXOffset||(document.documentElement&&document.documentElement.scrollLeft)||(document.body&&document.body.scrollLeft),self.pageYOffset||(document.documentElement&&document.documentElement.scrollTop)||(document.body&&document.body.scrollTop)]}function getClientCenter(){var sizes=getClientSize();var scrl=getDocumentScroll();return[parseInt(sizes[0]/2)+scrl[0],parseInt(sizes[1]/2)+scrl[1]]}function closeModal(){ShowModalWindow(false)}

function getMyApp(appName){if(navigator.appName.indexOf("Microsoft")!=-1){return window[appName]}else{return document[appName]}}function performDistrictSearch(){getMyApp("GermanyMap").performSearching()}function districtSearch(stateName,stateId,districtName,districtId){window.document.getElementById('such_form').type.value='districtSearch';window.document.getElementById('such_form').state.value=stateId;window.document.getElementById('such_form').district.value=districtId;window.document.getElementById('such_form').submit()}var sId;function showDetailedView(stateId){sId=stateId;ShowModalWindow(true);if(isIE){document.getElementById("MapDetailedView").refresh()}}function getStateId(){return sId}function detailedViewDistrictClick(stateId,districtId){ShowModalWindow(false);getMyApp("GermanyMap").performSearchFor(stateId,districtId)}function mapDetailedViewSizesChanged(width,height){document.getElementById("MapDetailedView").width=width;document.getElementById("MapDetailedView").height=height;resizeModal(width,height)}function mapStateChanged(stateId,stateName){}function mapDistrictChanged(districtId,districtName){}
