// Vers. 1.0
var mousex,mousey;var timeoutID;var dodebug=true;var istooltip=false;function jsdecode(str){return str.replace(/&#34;/g,'"').replace(/&#39;/g,"'");}
function makejsparam(str){return str.replace(/'/g,"\'").replace(/\n\r/g,"").replace(/\r/g,"").replace(/\n/g,"").replace(/'/g,"\\\'");}
function showMoreInfoTitle(divid,divinfoid,info,divtitle,title,cssclass){clearTimeout(timeoutID);if(document.getElementById(divid)&&document.getElementById(divinfoid)){istooltip=false;d=document.getElementById(divid);d.className=cssclass;d.style.display='block';d.style.zIndex=20;document.getElementById(divinfoid).innerHTML=jsdecode(info);document.getElementById(divtitle).innerHTML=jsdecode(title);var leftPos=mousex-document.getElementById("map").offsetWidth;if(leftPos<0)leftPos=0;d.style.left=leftPos+'px';d.style.top=(mousey-d.offsetHeight-1>=0?mousey-d.offsetHeight-1:0)+'px';}}
function showTooltip(divid,divinfoid,info,divtitle,title,cssclass){}
function hideMoreInfoafter(divid,milisecs){clearTimeout(timeoutID);time=0+parseInt(milisecs);timeoutID=setTimeout("hideMoreInfo('"+divid+"')",time);}
function closeMoreInfo(divid){d=document.getElementById(divid);if(d){d.style.display='none';d.style.zIndex=-1;}}
function hideMoreInfo(divid){if(istooltip){closeMoreInfo(divid);}}
function mapquery(test){}
function updateflash(flashid,lang,what,code){closeMoreInfo('moreinfo'+flashid);eval("ShowMap"+flashid+"('"+lang+"','"+what+"','"+code+"')");}
function decimaltodegree(dcoord){var signlat=1;dcoord=parseFloat(dcoord);if(dcoord<0){signlat=-1;}
latAbs=Math.abs(Math.round(dcoord*1000000.));return((Math.floor(latAbs/1000000)*signlat)+'&deg; '
+Math.floor(((latAbs/1000000)-Math.floor(latAbs/1000000))*60)
+'\' '+(Math.floor(((((latAbs/1000000)-Math.floor(latAbs/1000000))*60)-Math.floor(((latAbs/1000000)-Math.floor(latAbs/1000000))*60))*100000)*60/100000)+'&quot;');}
function showCoordinates(x,y){return"<table class=\"coordstable\" cellspacing=\"0\" border=\"0\"><tr><td class=\"col1\">Long:</td><td class=\"col2\">"+x+"</td><td class=\"col3\">Lat:</td><td class=\"col4\">"+y+"</td></tr>"
+"<tr><td class=\"col1\"></td><td class=\"col2\">"+decimaltodegree(x)+"</td><td class=\"col3\"></td><td class=\"col4\">"+decimaltodegree(y)+"</td></tr></table>";}
function openGoogleMap(dx,dy){var url="http://maps.google.com/maps?f=q&hl=en&q="+dy+","+dx+"&om=1&z=14&t=k&iwloc=addr";var t=window.open(url,"googlemap","location=no,resizable=yes,menubar=no,directories=no,status=1,scrollbars=1,width=800,height=600");}
function flashEvent(event,args){if(event=="Map loadxml"&&document.getElementById("loadingMap")){document.getElementById("loadingMap").style.display="block";}
if(event=="Symbol load"&&document.getElementById("loadingMap")){document.getElementById("loadingMap").style.display="none";}
if(event=="Map click"){doMapClick(args);}
if(event=="Map mousemove"){var coords=args.split(",");document.getElementById("coords").innerHTML=showCoordinates(coords[0],coords[1]);if(coords[2])
doMapMouseOver(coords[2]);}
if(event=="Map custom"){var coords=args.split(",");openGoogleMap(coords[0],coords[1]);}
var mycommands="";if(args&&args["_FSCommand"]&&args["_FSCommand"].length>0){mycommands=args["_FSCommand"].split(";;;");}else if(args&&args.indexOf(event)>-1){mycommands=args.split(";;;");}
var i=0;for(i=0;i<mycommands.length;i++){var aa=mycommands[i].split("|||");if(aa.length>0&&aa[0].indexOf(event)>-1){var funct=aa[1]+"(";for(j=2;j<aa.length;j++){if(j>2)funct+=",";funct+="'"+makejsparam(aa[j])+"'";}
funct+=")";eval(funct);break;}}}
function doMapClick(argstr){var args=argstr.split("&");var hashr=new Array();for(var j=0;j<args.length;j++){var temp=args[j].split("=");if(temp.length>1){hashr[temp[0]]=temp[1];}}
if(hashr['featurelayer'].indexOf('Marina')>=0){marinacode=hashr['featureid'];MapService.GetMarinaInfo(langg.substr(0,2),marinacode,showmarinainfo)}}
function doMapMouseOver(argstr){}
function showmarinainfo(info){stopmove=true;istooltip=false;var args=info.split("|||");showMoreInfoTitle('moreinfo'+flashid,'moreinfotext'+flashid,args[1],'moreinfotitle'+flashid,args[0],'mypopupdivo');}
function flashzoomin(movieName){var flash=flashMovie(movieName);flash.DoZoomIn();}
function flashzoomout(movieName){flashMovie(movieName).DoZoomOut();}
function flashpan(movieName){var flash=flashMovie(movieName);flash.DoPan();}
function flashcustom(movieName){var flash=flashMovie(movieName);var res=flash.DoCustom();}
function flashlegend(movieName,divid){eval('islegend'+movieName+'=!islegend'+movieName);var mli=document.getElementById("legend"+movieName);var container=document.getElementById(divid);if(mli&&container){if(eval('islegend'+movieName)){var flash=flashMovie(movieName);var t=flash.ShowLegend();t=t.replace(/image\/swf/gi,"image/gif");mli.src=t;container.style.display='block';container.style.zIndex=9000;var leftPos=400;if(leftPos<0)leftPos=0;container.style.left=leftPos+'px';container.style.top=(mousey-container.offsetHeight-1>=0?mousey-container.offsetHeight-1+15:15)+'px';}else{closeMoreInfo(divid);}}}
function selectlayer(movieName){var flash=flashMovie(movieName);var flag="";var cn=eval("document.forms[0].layers"+movieName);for(i=0;i<cn.length;i++){flag=flag+","+cn[i].checked;}
flag=flag.substr(1);flash.DoSetLayers(flag);}
function flashlayers(movieName,containerdiv,textdiv){eval('layersOn'+movieName+'=!layersOn'+movieName);var container=document.getElementById(containerdiv);var info=document.getElementById(textdiv);if(container){if(eval('layersOn'+movieName)){var flash=flashMovie(movieName);var t=flash.GetLayers();var html="";var layers=t.split(",");for(j=0;j<layers.length;j++){var tmp=layers[j].split("_");html+="<label class=\"layerlabel\"><input type=\"checkbox\" class=\"layercheck\" name=\"layers"+movieName+"\" onclick=\"selectlayer('"+movieName+"', '"+tmp[0]+"', this.checked)\" value=\"1\" "+(tmp[1]=="true"?"checked":"")+" >"+tmp[0]+"</label><br/>";}
info.innerHTML=html;container.style.display='block';container.style.zIndex=2000;var leftPos=500;var topPos=100;if(leftPos<0)leftPos=0;container.style.left=leftPos+'px';container.style.top=topPos+'px';}else{closeMoreInfo(containerdiv);}}}
var ruler=false;function flashruler(movieName){ruler=!ruler;var flash=flashMovie(movieName);var t=flash.DoDistance();}
function pageredirect(url){if(url.length>0)window.location=url;}
function refreshpage(){window.location.reload(true);}
function flashMovie(movieName){if(navigator.appName.indexOf("Microsoft")!=-1){return window[movieName];}else{return document[movieName];}}
var ie=document.all;var nn6=document.getElementById&&!document.all;var isdrag=false;var x,y;var dobj;function movemouse(e)
{mousex=nn6?e.clientX:event.clientX;mousey=nn6?e.clientY:event.clientY;if(isdrag)
{dobj.style.left=(tx+mousex-x)+"px";dobj.style.top=(ty+mousey-y)+"px";if(document.getElementById(dobj.id+"footer")){document.getElementById(dobj.id+"footer").style.display="none";}
if(document.getElementById(dobj.id+"header")){document.getElementById(dobj.id+"header").style.display="none";}
return false;}}
function selectmouse(e)
{var fobj=nn6?e.target:event.srcElement;var topelement=nn6?"HTML":"BODY";while(fobj&&fobj.tagName!=topelement&&fobj.className!="mypopupdiv"&&fobj.className!="mypopupdivo"&&fobj.className!="layersdiv")
{fobj=nn6?fobj.parentNode:fobj.parentElement;}
if(fobj&&(fobj.className=="mypopupdiv"||fobj.className=="mypopupdivo"||fobj.className=="layersdiv"))
{isdrag=true;dobj=fobj;tx=parseInt(dobj.style.left+0);ty=parseInt(dobj.style.top+0);x=nn6?e.clientX:event.clientX;y=nn6?e.clientY:event.clientY;document.onmousemove=movemouse;return false;}else{}}
document.onmousemove=movemouse;document.onmousedown=selectmouse;document.onmouseup=new Function("isdrag=false");function updatepage(region,subregion,location,flashid,lang,what,code){try{if(what=="region"){MapService.GetRegionPageUrl(code,lang,urlprefix,wildcardname,pageredirect)}else if(what=="subregion"){MapService.GetSubRegionPageUrl(code,lang,urlprefix,wildcardname,pageredirect)}else if(what=="location"){MapService.GetLocationPageUrl(code,lang,urlprefix,wildcardname,pageredirect)}else if(what=="country"){MapService.GetCountryPageUrl(code,lang,urlprefix,wildcardname,pageredirect)}}catch(err){mydebug('error: '+err.description);}}
function noaction(region,subregion,location,flashid,lang,what,code){}
function mydebug(str){if(document.getElementById('debug')&&dodebug){document.getElementById('debug').innerHTML=str;}}
function debugobject(source)
{var property,propCollection="";for(property in source){propCollection+=(property+": "+source[property]+"<br/>");}
mydebug(propCollection);}
function drawMap(mapid){try{var map=$get("Map"+mapid).value;var mapindex=$get("MapIndexPosition"+mapid).value;var layers=$get("Layers"+mapid).value;var mapindexlayers=$get("MapIndexLayers"+mapid).value;var mapindexxmllayers=$get("MapIndexXmlLayers"+mapid).value;var MaxZoomOut=$get("MaxZoomOut"+mapid).value;var MinZoomOut=$get("MinZoomOut"+mapid).value;var CustomButton=$get("CustomButton"+mapid).value;var swfobj=fpath+"MapServerFlash/MapSymbols.swf?WMS="+map+"&Dynamic="+$get("Dynamic"+mapid).value;swfobj+="&Server="+$get("MapServerUrl"+mapid).value+"&GML="+$get("XmlLayers"+mapid).value;swfobj+="&Query="+$get("Query"+mapid).value+"&BBox="+$get("BBox"+mapid).value;swfobj+="&BGColor="+$get("BGColor"+mapid).value;if(mapindex&&mapindex.length>0){swfobj+="&MapIndex="+mapindex;}
if(layers&&layers.length>0){swfobj+="&Layers="+layers;}
if(mapindexlayers&&mapindexlayers.length>0){swfobj+="&MapIndexLayers="+mapindexlayers;}
if(mapindexxmllayers&&mapindexxmllayers.length>0){swfobj+="&MapIndexXmlLayers="+mapindexxmllayers;}
if(MinZoomOut&&MinZoomOut.length>0){swfobj+="&MaxZoomIn="+MinZoomOut;}
if(MaxZoomOut&&MaxZoomOut.length>0){swfobj+="&MaxZoomOut="+MaxZoomOut;}
if(CustomButton&&CustomButton.length>0){swfobj+="&CustomButton="+CustomButton;}
swfobj+="&MapIndexHeight="+$get("MapIndexHeight"+mapid).value+"&MapIndexWidth="+$get("MapIndexWidth"+mapid).value;swfobj+="&WrapDateline="+$get("WrapDateline"+mapid).value+"&Equidistant="+$get("Equidistant"+mapid).value;swfobj+="&Progressive"+$get("Progressive"+mapid).value+"&Feature_Custom="+$get("Feature_Custom"+mapid).value;swfobj+="&MouseAction="+$get("DefaultMouseAction"+mapid).value+"&TextSize="+$get("TextSize"+mapid).value+"&TextColor="+$get("TextColor"+mapid).value+"";swfobj+="&ToolBarXY="+$get("ToolBarXY"+mapid).value+"&ToolBarAlpha="+$get("ToolBarAlpha"+mapid).value+"";var mdiv=document.getElementById('dMapClient'+mapid);var w=mdiv.style.width;var h=mdiv.style.height;var so=new SWFObject(swfobj,"MapClient"+mapid,"100%","100%",$get("FlashVersion"+mapid).value,$get("FlashBgColor"+mapid).value,true);so.addParam("quality","low");so.addParam("Dynamic","true");so.addParam("wmode","transparent");var res=so.write("dMapClient"+mapid);if(!res){document.getElementById("dMapClient"+mapid).innerHTML="<a target=\"_new\" href=\"http:\/\/www.adobe.com\/shockwave\/download\/download.cgi?P1_Prod_Version=ShockwaveFlash\">Get the Flash Plugin<\/a> to see this.";}
delete so;eval('window.MapClient'+mapid+' = document.forms[0].MapClient'+mapid);}catch(err){window.status='error'+err.description;}}
function resetmap(what,code,mapid){if(what.length<=0||code.length<=0){$get("BBox"+mapid).value=$get("defaultBBox"+mapid).value;$get("XmlLayers"+mapid).value=$get("defaultXmlLayers"+mapid).value;}}
function pdisplayMessageCallback(mapid,result){var p=result.split("|||");if(p.length>1){var flashargs=p[1];var commands=flashargs.split("&&&");for(var obj in commands){var tt=""+commands[obj];var aa=tt.split("===");if(document.getElementById(aa[0]+mapid)&&document.getElementById(aa[0]+mapid).value){document.getElementById(aa[0]+mapid).value=aa[1];}}}
drawMap(mapid);if($get("mapnav"+mapid))
{if(p[0]!='')$get("mapnav"+mapid).innerHTML=p[0];}}
function blockError(){return true;}
window.onerror=blockError;if(Sys.WebForms!=null)Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequest);function endRequest(sender,e){if(e.get_error()){e.set_errorHandled(true);}}
