﻿
function MapLabel(id,x,y)
{this.ID=id;this.iPixX=x;this.iPixY=y;}
function CCoordinate(dX,dY)
{this.dX=dX;this.dY=dY;}
function CSimplePoi(strID,dX,dY)
{this.strID=strID;this.dX=dX;this.dY=dY;}
function CSimpleAddress(strAddress,dX,dY)
{this.strAddress=strAddress;this.dX=dX;this.dY=dY;}
function CPoiAddress(strName,strAddress,dX,dY)
{this.strName=strName;this.strAddress=strAddress;this.dX=dX;this.dY=dY;}
function CAddress(strAddress,dX,dY,dMinX,dMinY,dMaxX,dMaxY)
{this.strAddress=(strAddress!=null?strAddress:"");this.dX=(dX!=null?dX:0);this.dY=(dY!=null?dY:0);this.dMinX=(dMinX!=null?dMinX:0);this.dMinY=(dMinY!=null?dMinY:0);this.dMaxX=(dMaxX!=null?dMaxX:0);this.dMaxY=(dMaxY!=null?dMaxY:0);}
function CComplexAddress(strAddress,dX,dY,dMinX,dMinY,dMaxX,dMaxY,strCountry,strRegion,strSettlement,strDistrict,strSubSettlement,strStreetName,strStreetType,strHouseNumber,strCornerStreetName,strCornerStreetType,strZip)
{this.strAddress=(strAddress!=null?strAddress:"");this.dX=(dX!=null?dX:0);this.dY=(dY!=null?dY:0);this.dMinX=(dMinX!=null?dMinX:0);this.dMinY=(dMinY!=null?dMinY:0);this.dMaxX=(dMaxX!=null?dMaxX:0);this.dMaxY=(dMaxY!=null?dMaxY:0);this.strCountry=(strCountry!=null?strCountry:"");this.strRegion=(strRegion!=null?strRegion:"");this.strSettlement=(strSettlement!=null?strSettlement:"");this.strDistrict=(strDistrict!=null?strDistrict:"");this.strSubSettlement=(strSubSettlement!=null?strSubSettlement:"");this.strStreetName=(strStreetName!=null?strStreetName:"");this.strStreetType=(strStreetType!=null?strStreetType:"");this.strHouseNumber=(strHouseNumber!=null?strHouseNumber:"");this.strCornerStreetName=(strCornerStreetName!=null?strCornerStreetName:"");this.strCornerStreetType=(strCornerStreetType!=null?strCornerStreetType:"");this.strZip=(strZip!=null?strZip:"");}
function CNorc(lat,lon,id,angle)
{this.m_lat=lat;this.m_lon=lon;this.m_id=id;this.m_angle=angle;}
function CMapData()
{this.strCaption;this.iMapWidth;this.iMapHeight;this.dCenterX;this.dCenterY;this.dRadius;this.dMinX;this.dMinY;this.dMaxX;this.dMaxY;this.dMeterPerPixelX;this.dMeterPerPixelY;this.iViewportOffsetX;this.iViewportOffsetY;this.dGridMinX;this.dGridMinY;this.dGridMaxX;this.dGridMaxY;}
function RasterLevel(iLevel,dPixelDensityXMeter,dPixelDensityYMeter,dPixelDensityXAC,dPixelDensityYAC,iActiveWidth,iActiveHeight,iRows,iCols)
{this.iLevel=(iLevel!=undefined?iLevel:0);this.dPixelDensityXMeter=(dPixelDensityXMeter!=undefined?dPixelDensityXMeter:1.0);this.dPixelDensityYMeter=(dPixelDensityYMeter!=undefined?dPixelDensityYMeter:1.0);this.dPixelDensityXAC=(dPixelDensityXAC!=undefined?dPixelDensityXAC:1.0);this.dPixelDensityYAC=(dPixelDensityYAC!=undefined?dPixelDensityYAC:1.0);this.iActiveWidth=(iActiveWidth!=undefined?iActiveWidth:0);this.iActiveHeight=(iActiveHeight!=undefined?iActiveHeight:0);this.iRows=(iRows!=undefined?iRows:0);this.iCols=(iCols!=undefined?iCols:0);};function RasterMapInfo(iVersion,iLevels,iSectionWidth,iSectionHeight,wgsMapMinX,wgsMapMinY,wgsMapMaxX,wgsMapMaxY,arrLevels)
{this.iVersion=(iVersion!=undefined?iVersion:1);this.iLevels=(iLevels!=undefined?iLevels:0);this.iSectionWidth=(iSectionWidth!=undefined?iSectionWidth:0);this.iSectionHeight=(iSectionHeight!=undefined?iSectionHeight:0);this.wgsMapMinX=(wgsMapMinX!=undefined?wgsMapMinX:0);this.wgsMapMinY=(wgsMapMinY!=undefined?wgsMapMinY:0);this.wgsMapMaxX=(wgsMapMaxX!=undefined?wgsMapMaxX:0);this.wgsMapMaxY=(wgsMapMaxY!=undefined?wgsMapMaxY:0);this.arrLevels=(arrLevels!=undefined&&arrLevels!=null?arrLevels:new Array());};function RasterMapResult(dGridLowerLeftX,dGridLowerLeftY,dGridUpperRightX,dGridUpperRightY,dViewportLowerLeftX,dViewportLowerLeftY,dViewportUpperRightX,dViewportUpperRightY,dCenterX,dCenterY,dMinRadius,iLevel,iGridUpperRow,iGridLeftColumn,iGridLowerRow,iGridRightColumn,iViewportOffsetX,iViewportOffsetY,iViewportDeltaX,iViewportDeltaY,arrUrls,strCaption)
{this.dGridLowerLeftX=(dGridLowerLeftX!=undefined?dGridLowerLeftX:0.0);this.dGridLowerLeftY=(dGridLowerLeftY!=undefined?dGridLowerLeftY:0.0);this.dGridUpperRightX=(dGridUpperRightX!=undefined?dGridUpperRightX:0.0);this.dGridUpperRightY=(dGridUpperRightY!=undefined?dGridUpperRightY:0.0);this.dViewportLowerLeftX=(dViewportLowerLeftX!=undefined?dViewportLowerLeftX:0.0);this.dViewportLowerLeftY=(dViewportLowerLeftY!=undefined?dViewportLowerLeftY:0.0);this.dViewportUpperRightX=(dViewportUpperRightX!=undefined?dViewportUpperRightX:0.0);this.dViewportUpperRightY=(dViewportUpperRightY!=undefined?dViewportUpperRightY:0.0);this.dCenterX=(dCenterX!=undefined?dCenterX:0.0);this.dCenterY=(dCenterY!=undefined?dCenterY:0.0);this.dMinRadius=(dMinRadius!=undefined?dMinRadius:0.0);this.iLevel=(iLevel!=undefined?iLevel:0);this.iGridUpperRow=(iGridUpperRow!=undefined?iGridUpperRow:0);this.iGridLeftColumn=(iGridLeftColumn!=undefined?iGridLeftColumn:0);this.iGridLowerRow=(iGridLowerRow!=undefined?iGridLowerRow:0);this.iGridRightColumn=(iGridRightColumn!=undefined?iGridRightColumn:0);this.iViewportOffsetX=(iViewportOffsetX!=undefined?iViewportOffsetX:0);this.iViewportOffsetY=(iViewportOffsetY!=undefined?iViewportOffsetY:0);this.iViewportDeltaX=(iViewportDeltaX!=undefined?iViewportDeltaX:0);this.iViewportDeltaY=(iViewportDeltaY!=undefined?iViewportDeltaY:0);this.arrUrls=(arrUrls!=undefined&&arrUrls!=null?arrUrls:new Array());this.strCaption=(strCaption!=undefined&&strCaption!=null?strCaption:"");}
function ClickablePoi(strID,iX,iY,strName,iImageID,iPriority)
{this.strID=(strID!=undefined&&strID!=null?strID:"");this.iX=(iX!=undefined?iX:0);this.iY=(iY!=undefined?iY:0);this.strName=(strName!=undefined&&strName!=null?strName:"");this.iImageID=(iImageID!=undefined?iImageID:0);this.iPriority=(iPriority!=undefined?iPriority:0);}
function ClickableTMC(iID,iX,iY,iTMCTextIndex,iEventDescriptionIndex,iLocationDescriptionIndex)
{this.iID=(iID!=undefined?iID:0);this.iX=(iX!=undefined?iX:0);this.iY=(iY!=undefined?iY:0);this.iTMCTextIndex=(iTMCTextIndex!=undefined?iTMCTextIndex:-1);this.iEventDescriptionIndex=(iEventDescriptionIndex!=undefined?iEventDescriptionIndex:-1);this.iLocationDescriptionIndex=(iLocationDescriptionIndex!=undefined?iLocationDescriptionIndex:-1);}
function DrawMapPersonalResult(dLowerLeftX,dLowerLeftY,dUpperRightX,dUpperRightY,strCaption,strUrl,arrPois,arrMapLabels,arrTMCEvents,arrTMCTextTable,arrPTStops,dLastDistPointX,dLastDistPointY,arrDistPolylinePixelX,arrDistPolylinePixelY,dDistanceMeter)
{this.dLowerLeftX=(dLowerLeftX!=undefined?dLowerLeftX:0.0);this.dLowerLeftY=(dLowerLeftY!=undefined?dLowerLeftY:0.0);this.dUpperRightX=(dUpperRightX!=undefined?dUpperRightX:0.0);this.dUpperRightY=(dUpperRightY!=undefined?dUpperRightY:0.0);this.strCaption=(strCaption!=undefined&&strCaption!=null?strCaption:"");this.strUrl=(strUrl!=undefined&&strUrl!=null?strUrl:"");this.arrPois=(arrPois!=undefined&&arrPois!=null?arrPois:new Array());this.arrMapLabels=(arrMapLabels!=undefined&&arrMapLabels!=null?arrMapLabels:new Array());this.arrTMCEvents=(arrTMCEvents!=undefined&&arrTMCEvents!=null?arrTMCEvents:new Array());this.arrTMCTextTable=(arrTMCTextTable!=undefined&&arrTMCTextTable!=null?arrTMCTextTable:new Array());this.arrPTStops=(arrPTStops!=undefined?arrPTStops:[]);this.dLastDistPointX=(dLastDistPointX!=undefined?dLastDistPointX:0.0);this.dLastDistPointY=(dLastDistPointY!=undefined?dLastDistPointY:0.0);this.arrDistPolylinePixelX=(arrDistPolylinePixelX!=undefined?arrDistPolylinePixelX:null);this.arrDistPolylinePixelY=(arrDistPolylinePixelY!=undefined?arrDistPolylinePixelY:null);this.dDistanceMeter=(dDistanceMeter!=undefined?dDistanceMeter:0.0);}
function CPoiType(iID,strName,iLevel,bOnMap,bShowInTree,iCount)
{this.iID=(iID!=undefined&&iID!=null?iID:0);this.strName=(strName!=undefined&&strName!=null?strName:"");this.iLevel=(iLevel!=undefined&&iLevel!=null?iLevel:0);this.bOnMap=bOnMap;this.bShowInTree=(bShowInTree!=undefined?bShowInTree:true);this.iCount=(iCount!=undefined?iCount:0);}
function CPoiRecord(nID,nTypeID,iImageID,iListPriority,arrNames,arrValues,dX,dY)
{this.nID=nID;this.nTypeID=nTypeID;this.iImageID=iImageID;this.iListPriority=(iListPriority!=null?iListPriority:0);this.arrNames=(arrNames!=null?arrNames:new Array());this.arrValues=(arrValues!=null?arrValues:new Array());this.dX=dX;this.dY=dY;}
function CPoiQuery(nID,strFilter,strType,iFirst,iLast,bHasRect,dMinX,dMinY,dMaxX,dMaxY)
{this.nID=(nID!=undefined&&nID!=null?nID:0);this.strFilter=(strFilter!=undefined&&strFilter!=null?strFilter:"");this.strType=(strType!=undefined&&strType!=null?strType:"");this.iFirst=(iFirst!=undefined&&iFirst!=null?iFirst:0);this.iLast=(iLast!=undefined&&iLast!=null?iLast:iFirst+20);this.bHasRect=(bHasRect?true:false);this.dMinX=(dMinX!=undefined&&dMinX!=null?dMinX:0.0);this.dMinY=(dMinY!=undefined&&dMinY!=null?dMinY:0.0);this.dMaxX=(dMaxX!=undefined&&dMaxX!=null?dMaxX:0.0);this.dMaxY=(dMaxY!=undefined&&dMaxY!=null?dMaxY:0.0);}
function CPoiSearchResult(iFirst,bHasNextPage,arrRecords)
{this.iFirst=(iFirst!=undefined&&iFirst!=null?iFirst:0);this.bHasNextPage=(bHasNextPage!=undefined&&bHasNextPage!=null?bHasNextPage:false);this.arrRecords=(arrRecords!=null?arrRecords:new Array());}
function CFavouritePlace(id,x,y,name)
{this.id=id;this.x=x;this.y=y;this.name=unescape(name);}
function CFavouriteRoute(id,name,data)
{this.id=id;this.name=unescape(name);this.data=unescape(data);}
function CRegisteredData(arrPlaces,arrRoutes,name)
{this.favouritePlaces=(arrPlaces!=null?arrPlaces:new Array());this.favouriteRoutes=(arrRoutes!=null?arrRoutes:new Array());this.userName=name;}
function CWeather(id,x,y,place,weather,temperature,wind,humidity,pressure,uv,iconId)
{this.id=(id!=null?id:"");this.x=(x!=null?x:"");this.y=(y!=null?y:"");this.place=(place!=null?place:"");this.weather=(weather!=null?weather:"");this.temperature=(temperature!=null?temperature:"");this.wind=(wind!=null?wind:"");this.humidity=(humidity!=null?humidity:"");this.pressure=(pressure!=null?pressure:"");this.uv=(uv!=null?uv:"");this.iconId=(iconId!=null?iconId:"");}
function CUTV(id,x,y,address,name,camUrl,angle,pixelradius)
{this.id=(id!=null?id:0);this.x=(x!=null?x:0);this.y=(y!=null?y:0);this.address=(address!=null?unescape(address):"");this.name=(name!=null?unescape(name):"");this.camUrl=(camUrl!=null?unescape(camUrl):"");this.angle=(angle!=null?angle:0);this.pixelradius=(pixelradius!=null?pixelradius:0);var me=this;this.GetSafeCamUrl=function()
{return me.camUrl+"?"+Math.round(Math.random()*1000);}}
function CDailyNews(id,shortdescription,longdescription,eovx,eovy,signid)
{this.id=(id!=null?id:"");this.shortdescription=(shortdescription!=null?shortdescription:"");this.longdescription=(longdescription!=null?longdescription:"");this.eovx=(eovx!=null?eovx:"");this.eovy=(eovy!=null?eovy:"");this.signid=(signid!=null?signid:"");}
function SimpleAction(bSuccess,strError)
{this.bSuccess=bSuccess;this.strError=(strError!=null?strError:"");}
function CInitSettings(bShowTrafficChoice,bShowMenuTraffic,bShowMenuExtraInfo,bShowMenuSearch,strCountryName,iMultiModalVersion,bTMC,bMapMenu)
{this.bShowTrafficChoice=bShowTrafficChoice;this.bShowMenuTraffic=bShowMenuTraffic;this.bShowMenuExtraInfo=bShowMenuExtraInfo;this.bShowMenuSearch=bShowMenuSearch;this.strCountryName=strCountryName;this.iMultiModalVersion=iMultiModalVersion;this.bTMC=bTMC;this.bMapMenu=bMapMenu;}
function PBFullPoi(nID,strCaption,strIconUrl,iIconWidth,iIconHeight,strLinkUrl)
{this.nID=nID;this.strCaption=strCaption;this.strIconUrl=strIconUrl;this.iIconWidth=iIconWidth;this.iIconHeight=iIconHeight;this.strLinkUrl=strLinkUrl;}
function PoiBannerCampaign(strItinerHeaderHtml,arrPois,pDefaultPoiData,arrContentTemplates)
{this.strItinerHeaderHtml=strItinerHeaderHtml;this.pDefaultPoiData=pDefaultPoiData;this.arrPois=arrPois;this.arrContentTemplates=(arrContentTemplates!=null?arrContentTemplates:[]);if(this.pDefaultPoiData!=null&&this.arrPois!=null)
{for(var i=0;i<this.arrPois.length;i++)
{if(arrPois[i].strCaption==null||arrPois[i].strCaption=="")
arrPois[i].strCaption=pDefaultPoiData.strCaption;if(arrPois[i].strIconUrl==null||arrPois[i].strIconUrl=="")
arrPois[i].strIconUrl=pDefaultPoiData.strIconUrl;if(arrPois[i].iIconWidth==null||arrPois[i].iIconWidth==0)
arrPois[i].iIconWidth=pDefaultPoiData.iIconWidht;if(arrPois[i].iIconHeight==null||arrPois[i].iIconHeight==0)
arrPois[i].iIconHeight=pDefaultPoiData.iIconWidht;}}}

if(!Array.prototype.indexOf)
{Array.prototype.indexOf=function(elt)
{var len=this.length;var from=Number(arguments[1])||0;from=(from<0)?Math.ceil(from):Math.floor(from);if(from<0)
from+=len;for(;from<len;from++)
{if(from in this&&this[from]===elt)
return from;}
return-1;};}
function StopAnyEvent(obj)
{obj.ondblclick=function(pEvent){StopEventPropagation(pEvent);return false;}
obj.onmousemove=function(pEvent){StopEventPropagation(pEvent);return false;}
obj.onclick=function(pEvent){StopEventPropagation(pEvent);return false;}
obj.onmousedown=function(pEvent){StopEventPropagation(pEvent);return false;}
obj.onmouseup=function(pEvent){StopEventPropagation(pEvent);return false;}
obj.onmousewheel=function(pEvent){StopEventPropagation(pEvent);return false;}}
function IsRightClick(pEvent)
{if(window.event)
{return(window.event.button==2);}
else if(pEvent)
{return(pEvent.button==2);}
return false;}
function GetBlock(id)
{var block=null;if(document.getElementById)
{block=document.getElementById(id);}
return block;}
function GetTable(id)
{var table=GetBlock(id);if(table!=null)
{var tb=table.getElementsByTagName('tbody');if(tb.length>0)
return tb[0];}
return table;}
function SwapNode(a1,a2)
{if(a1.swapNode)
a1.swapNode(a2);else
{var itemtmp=a1.cloneNode(1);var parent1=a1.parentNode;var parent2=a2.parentNode;a2=parent2.replaceChild(itemtmp,a2);parent1.replaceChild(a2,a1);parent2.replaceChild(a1,itemtmp);itemtmp=null;}}
function DeleteChildren(pParent,strClassName)
{if(pParent!=null)
{var a=new Array();var c=pParent.firstChild;while(c!=null)
{if((c.className==strClassName)||(strClassName==""))
{a[a.length]=c;}
c=c.nextSibling;}}
for(i=0;i<a.length;i++)
{pParent.removeChild(a[i]);}}
function InsertBefore(pParent,pChild,pBefore)
{var a=new Array();var c=pParent.firstChild;while(c!=null)
{if(c==pBefore)
break;c=c.nextSibling;}
while(c!=null)
{a[a.length]=c;c=c.nextSibling;}
var i=0;for(i=0;i<a.length;i++)
{pParent.removeChild(a[i]);}
pParent.appendChild(pChild);for(i=0;i<a.length;i++)
{pParent.appendChild(a[i]);}
delete a;}
function RefreshChildren(pParent)
{var a=new Array();var c=pParent.firstChild;while(c!=null)
{a[a.length]=c;c=c.nextSibling;}
var i=0;for(i=0;i<a.length;i++)
{pParent.removeChild(a[i]);}
for(i=0;i<a.length;i++)
{pParent.appendChild(a[i]);}
delete a;}
function AddTag(pChild,pParent,pBefore)
{if(pBefore!=undefined)
pParent.insertBefore(pChild,pBefore);else
pParent.appendChild(pChild);}
function NewTag(id,pParent,pBefore)
{var tag=document.createElement(id);if(pParent!=undefined)
AddTag(tag,pParent,pBefore);return tag;}
function NewTextTag(text,pParent,pBefore)
{var tag=document.createTextNode(text);if(pParent!=undefined)
AddTag(tag,pParent,pBefore);return tag;}
function NewAutoLinkTag(text,pParent,pBefore)
{var strTemp=text;strTemp.toLowerCase();var iPos=strTemp.lastIndexOf(".");var strExt="";if(iPos>=0)
strExt=strTemp.substr(iPos+1);if(strTemp.substr(0,7)=="http://"||strTemp.substr(0,6)=="ftp://"||strTemp.substr(0,4)=="www.")
{var a=NewTag("a",pParent,pBefore);a.setAttribute("target","_blank");a.setAttribute("href",strTemp.substr(0,4)=="www."?"http://"+text:text);NewTextTag(text,a);}
else if(strTemp.indexOf("@")>=0)
{var a=NewTag("a",pParent,pBefore);a.setAttribute("href","mailto:"+text);NewTextTag(text,a);}
else if(strExt=="png"||strExt=="gif"||strExt=="jpg"||strExt=="jpeg")
{var img=NewTag("img",pParent,pBefore);img.setAttribute("src",text);img.setAttribute("alt","");}
else
{NewTextTag(text,pParent,pBefore);}}
function NewIframe(src,width,height,parentObj,beforeObj)
{var iframe=NewTag("iframe");iframe.setAttribute("frameBorder","0");if(parentObj!=null)
AddTag(iframe,parentObj,beforeObj);iframe.style.margin="5px";iframe.setAttribute("src",src);iframe.width=width;iframe.height=height;iframe.marginWidth=0;iframe.marginHeight=0;iframe.setAttribute("hspace","0");iframe.setAttribute("vspace","0");iframe.setAttribute("border","0");iframe.setAttribute("scrolling","no");iframe.frameBorder="0";return iframe;}
function NewFlash(src,iWidth,iHeight,parentObj)
{var xmlIc=document.createElement('object');xmlIc.setAttribute('type','application/x-shockwave-flash');xmlIc.setAttribute('data','');xmlIc.data=src;xmlIc.setAttribute('width','');xmlIc.width=iWidth;xmlIc.setAttribute('height','');xmlIc.height=iHeight;var paramIc=document.createElement('param');paramIc.setAttribute('name','');paramIc.name="movie";paramIc.setAttribute('value','');paramIc.value=src;xmlIc.appendChild(paramIc);parentObj.appendChild(xmlIc);try
{xmlIc.LoadMovie(0,src);}
catch(e)
{}
return xmlIc}
function SetEvent(obj,strEvent,strFunction)
{obj.setAttribute(strEvent,strFunction);if(navigator.appName.indexOf("Microsoft")>=0)
obj[strEvent]=new Function(strFunction);}
function SetImage(img,src,width,height,alt,title)
{if(width!=undefined&&width!=null&&width>0&&!isNaN(width))
{img.style.width=width+"px";img.width=width;}
if(height!=undefined&&height!=null&&height>0&&!isNaN(height))
{img.style.height=height+"px";img.height=height;}
img.style.border=0;img.setAttribute('src',src);if(alt!=null&&alt!=undefined||img.alt==null||img.alt==undefined)
img.setAttribute('alt',(alt==null||alt==undefined?"":alt));if(title!=null&&title!="")
img.setAttribute('title',title);}
function GetEventX(pEvent)
{if(pEvent==undefined)
pEvent=window.event;if(pEvent.target!=undefined){return GetEventXNew(pEvent)-GetAbsLayerLeft(pEvent.target);}
else{if(pEvent.layerX!=undefined){return pEvent.layerX;}
else if(pEvent.x!=undefined){return pEvent.x;}}
return null;}
function GetEventY(pEvent)
{if(pEvent==undefined)
pEvent=window.event;if(pEvent.target!=undefined){return GetEventYNew(pEvent)-GetAbsLayerTop(pEvent.target);}
else{if(pEvent.layerY!=undefined){return pEvent.layerY;}
else if(pEvent.y!=undefined){return pEvent.y;}}}
function GetLayerX(pEvent)
{if(pEvent==undefined)
pEvent=window.event;if(pEvent.layerX!=undefined){return pEvent.layerX;}else if(pEvent.offsetX!=undefined){return pEvent.offsetX;}
return null;}
function GetLayerY(pEvent)
{if(pEvent==undefined)
pEvent=window.event;if(pEvent.layerY!=undefined){return pEvent.layerY;}else if(pEvent.offsetY!=undefined){return pEvent.offsetY;}
return null;}
function GetEventXNew(pEvent)
{var posx=0;if(!pEvent)pEvent=window.event;if(pEvent.pageX)
posx=pEvent.pageX;else if(pEvent.clientX)
{posx=pEvent.clientX+document.body.scrollLeft
+document.documentElement.scrollLeft;}
return posx;}
function GetEventYNew(pEvent)
{var posy=0;if(!pEvent)pEvent=window.event;if(pEvent.pageY)
posy=pEvent.pageY;else if(pEvent.clientY)
{posy=pEvent.clientY+document.body.scrollTop
+document.documentElement.scrollTop;}
return posy;}
function GetEventSourceElement(pEvent)
{if(pEvent==undefined)
pEvent=window.event;if(pEvent.srcElement!=null){return pEvent.srcElement;}else if(pEvent.target!=null){return pEvent.target;}}
function GetEventRelatedElement(pEvent)
{if(pEvent==undefined||pEvent==null)
pEvent=window.event;var relTarg=pEvent.relatedTarget||pEvent.toElement;return relTarg;}
function StopEventPropagation(pEvent)
{if(pEvent==undefined)
pEvent=window.event;if(pEvent.preventDefault)
pEvent.preventDefault();pEvent.cancelBubble=true;if(pEvent.stopPropagation)
pEvent.stopPropagation();}
function GetEventButton(pEvent)
{if(pEvent==undefined)
pEvent=window.event;if(pEvent.button!=undefined)
return pEvent.button;if(pEvent.which!=undefined)
{if(pEvent.which==0)
return 1;if(pEvent.which==1)
return 4;return pEvent.which;}
return 1;}
function GetStyle(el,styleProp)
{if(el.currentStyle)
var y=el.currentStyle[styleProp];else if(window.getComputedStyle)
var y=document.defaultView.getComputedStyle(el,null).getPropertyValue(styleProp);return y;}
function GetLayerLeft(block)
{if(block.offsetLeft!=undefined)
{var iLeft=0;do{iLeft+=block.offsetLeft||0;block=block.offsetParent;if(block){if(block.tagName.toLowerCase()=='body')
break;var p=GetStyle(block,'position');if(p=='relative'||p=='absolute')
break;}}while(block);return iLeft;}
if(block.pixelLeft!=undefined)
return block.pixelLeft;return null;}
function GetStyle(block,strStyle)
{strStyle=strSyle=='float'?'cssFloat':strStyle;var value=block.style[strStyle];if(!value){var css=document.defaultView.getComputedStyle(block,null);value=css?css[strStyle]:null;}
if(strStyle=='opacity')
return value?parseFloat(value):1.0;return value=='auto'?null:value;}
function GetLayerTop(block)
{if(block.offsetTop!=undefined)
{var iTop=0;do{iTop+=block.offsetTop||0;block=block.offsetParent;if(block){if(block.tagName.toLowerCase()=='body')
break;var p=GetStyle(block,'position');if(p=='relative'||p=='absolute')
break;}}while(block);return iTop;}
if(block.pixelTop!=undefined)
return block.pixelTop;return null;}
function GetAbsLayerLeft(block)
{return parseInt($(block).offset().left,10);}
function GetAbsLayerTop(block)
{return parseInt($(block).offset().top,10);}
function GetLayerWidth(block)
{if(block.offsetWidth!=undefined)
return block.offsetWidth;if(block.pixelWidth!=undefined)
return block.pixelWidth;return null;}
function GetLayerHeight(block)
{if(block.offsetHeight!=undefined)
return block.offsetHeight;if(block.pixelHeight!=undefined)
return block.pixelHeight;return null;}
function GetLayerRight(block)
{return GetLayerLeft(block)+GetLayerWidth(block);}
function GetLayerBottom(block)
{return GetLayerTop(block)+GetLayerHeight(block);}
function GetAbsLayerRight(block)
{return GetAbsLayerLeft(block)+GetLayerWidth(block);}
function GetAbsLayerBottom(block)
{return GetAbsLayerTop(block)+GetLayerHeight(block);}
function Show(block)
{block.style.display="";block.style.visibility="visible";}
function Hide(block)
{block.style.display="none";block.style.visibility="hidden";}
function setAlpha(strCssSelector)
{if(document.all&&typeof window.opera==undefined)
{var styleSheets=document.styleSheets;for(var i=0;i<styleSheets.length;i++)
{var rules=styleSheets[i].rules;for(var j=0;j<rules.length;j++)
{if(rules[j].selectorText==strCssSelector)
{rules[j].style.filter='alpha(opacity = 100)';return true;}}}}
return false;};function SetOpac(block,value){block.style.opacity=value/100;block.style.filter='alpha(opacity='+value+')';if(block)
{if(document.all&&typeof window.opera=='undefined')
{if(block.filters&&block.filters.alpha)
block.filters.alpha.opacity=value;}
else if(block.style)
block.style.MozOpacity=value/100;if(block.style)
block.style.opacity=value/100;}}
function GetOpac(block)
{if(block.filters)
{if(block.filters.alpha)
return block.filters.alpha.opacity;else return 100;}
else if(block.style)
{if(block.style.MozOpacity)
return block.style.MozOpacity*100;else if(block.style.opacity)
return block.style.opacity;}}
function AvoidClip(div)
{if(GetLayerLeft(div)+GetLayerWidth(div)-3>GetLayerWidth(div.parentNode))
{var iLeft=Math.max(0,GetLayerWidth(div.parentNode)-GetLayerWidth(div)-3);div.style.left=iLeft+"px";}
if(GetLayerTop(div)+GetLayerHeight(div)-3>GetLayerHeight(div.parentNode))
{var iTop=Math.max(0,GetLayerHeight(div.parentNode)-GetLayerHeight(div)-3);div.style.top=iTop+"px";}}
function GetClientWidth()
{var iClientWidth=0;if(typeof(window.innerWidth)=='number'){iClientWidth=window.innerWidth;}else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){iClientWidth=document.documentElement.clientWidth;}else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){iClientWidth=document.body.clientWidth;}
return iClientWidth;}
function GetClientHeight()
{var iClientHeight=0;if(typeof(window.innerHeight)=='number'){iClientHeight=window.innerHeight;}else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){iClientHeight=document.documentElement.clientHeight;}else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){iClientHeight=document.body.clientHeight;}
return iClientHeight;}
function SetDivSize(div,iWidth,iHeight)
{div.style.width=iWidth+"px";div.style.height=iHeight+"px";}
function GetStyle(element,styleProp)
{if(element.currentStyle)
var y=element.currentStyle[styleProp];else if(window.getComputedStyle)
var y=document.defaultView.getComputedStyle(element,null).getPropertyValue(styleProp);return y;}
function WheelEventCalculateDelta(pEvent)
{var delta=0;if(!pEvent)pEvent=window.event;if(pEvent.wheelDelta){delta=pEvent.wheelDelta/120;if(window.opera)delta=-delta;}else if(pEvent.detail){delta=-pEvent.detail/3;}
if(delta)
return delta;}
function pausecomp(iMillis)
{var date=new Date();var curDate=null;do{curDate=new Date();}
while(curDate-date<iMillis);}
function getCookie(Name)
{var search=Name+"=";if(document.cookie.length>0)
{offset=document.cookie.indexOf(search);if(offset!=-1)
{offset+=search.length;end=document.cookie.indexOf(";",offset);if(end==-1)end=document.cookie.length;return unescape(document.cookie.substring(offset,end));}
return null;}}
function getBoolCookie(Name,bDefault)
{var val=getCookie(Name);if(val==null)
{if(bDefault)
return true;return false;}
if(val==true||val=='true'||val=='1')
return true;else
return false;}
function getIntCookie(Name,iDefault)
{var strCookie=getCookie(Name);if(strCookie==null)
{return iDefault;}
var iVal=parseInt(strCookie,10);if(isNaN(iVal))
return iDefault;return iVal;}
function getFloatCookie(Name,dDefault)
{var strCookie=getCookie(Name);if(strCookie==null)
{return dDefault;}
var dVal=parseFloat(strCookie);if(isNaN(dVal))
return dDefault;return dVal;}
function getStringCookie(Name,strDefault)
{var strCookie=getCookie(Name);if(strCookie==null)
return strDefault;return strCookie;}
function setCookie(cookieName,cookieValue,expire)
{var today=new Date();if(expire==null)
{expire=new Date();var nDays=5*365;expire.setTime(today.getTime()+3600000*24*nDays);}
document.cookie=cookieName+"="+escape(cookieValue)+";expires="+expire.toGMTString();}
function GetArrayLength(array)
{if(array!=null)
{var iUpperBound=array.length;while(iUpperBound--)
{if(array[iUpperBound]!=null)
return iUpperBound+1;}}
return 0;}
function DisableSelection(block)
{block.onselectstart=function(){return false;};block.onmousedown=function(){return false;};}
var g_bPngHackSupported=/MSIE (5\.5)|[6789]/.test(navigator.userAgent)&&navigator.platform=="Win32";function SetTransparentPngAsBg(block,src)
{if(g_bPngHackSupported&&block.runtimeStyle)
{block.runtimeStyle.filter=block.runtimeStyle.filter||"";if(/\.png$/.test(src.toLowerCase())){block.runtimeStyle.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+src+"',sizingMethod='scale')";block.style.backgroundImage="";}
else{block.runtimeStyle.filter="";}}
else
{block.style.backgroundImage="url('"+src+"')";}}
var BrowserDetect={init:function(){this.browser=this.searchString(this.dataBrowser)||"An unknown browser";this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||"an unknown version";this.OS=this.searchString(this.dataOS)||"an unknown OS";},searchString:function(data){for(var i=0;i<data.length;i++){var dataString=data[i].string;var dataProp=data[i].prop;this.versionSearchString=data[i].versionSearch||data[i].identity;if(dataString){if(dataString.indexOf(data[i].subString)!=-1)
return data[i].identity;}
else if(dataProp)
return data[i].identity;}},searchVersion:function(dataString){var index=dataString.indexOf(this.versionSearchString);if(index==-1)return;return parseFloat(dataString.substring(index+this.versionSearchString.length+1));},dataBrowser:[{string:navigator.userAgent,subString:"OmniWeb",versionSearch:"OmniWeb/",identity:"OmniWeb"},{string:navigator.vendor,subString:"Apple",identity:"Safari"},{prop:window.opera,identity:"Opera"},{string:navigator.vendor,subString:"iCab",identity:"iCab"},{string:navigator.vendor,subString:"KDE",identity:"Konqueror"},{string:navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:navigator.vendor,subString:"Camino",identity:"Camino"},{string:navigator.userAgent,subString:"Netscape",identity:"Netscape"},{string:navigator.userAgent,subString:"MSIE",identity:"Explorer",versionSearch:"MSIE"},{string:navigator.userAgent,subString:"Gecko",identity:"Mozilla",versionSearch:"rv"},{string:navigator.userAgent,subString:"Mozilla",identity:"Netscape",versionSearch:"Mozilla"}],dataOS:[{string:navigator.platform,subString:"Win",identity:"Windows"},{string:navigator.platform,subString:"Mac",identity:"Mac"},{string:navigator.platform,subString:"Linux",identity:"Linux"}]};BrowserDetect.init();function SetTransparentPng(img,src,width,height,alt)
{var blankSrc=GetAbsUrl("images/transparent.gif");if(g_bPngHackSupported&&img.runtimeStyle)
{if(/\.png$/.test(src.toLowerCase())){SetImage(img,blankSrc,width,height,alt);img.runtimeStyle.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+src+"',sizingMethod='scale')";}
else{img.runtimeStyle.filter="";SetImage(img,src,width,height,alt);}}
else
SetImage(img,src,width,height,alt);}
function AddEvent(obj,eventType,handler)
{if(obj.addEventListener){obj.addEventListener(eventType,handler,true);return true;}else if(obj.attachEvent){var r=obj.attachEvent("on"+eventType,handler);return r;}else{return false;}}
function IncludeJS(strUrl)
{var script=document.createElement('script');script.type='text/javascript';script.src=strUrl;document.getElementsByTagName('head')[0].appendChild(script);}
function IncludeCSS(strUrl)
{var link=document.createElement('link');link.rel='stylesheet';link.type='text/css';link.href=strUrl;document.getElementsByTagName('head')[0].appendChild(link);}
function AddBookmark(strUrl,strTitle)
{if(window.sidebar){window.sidebar.addPanel(strTitle,strUrl,'');return true;}
else if(window.external){window.external.AddFavorite(strUrl,strTitle);}}
function CreateRadioButton(strName,strID,strValue)
{var radio=null;if(document.all&&!window.opera&&document.createElement)
{if(strValue!=undefined)
radio=document.createElement("<input type='radio' name='"+strName+"' id='"+strID+"' value='"+strValue+"'/>");else
radio=document.createElement("<input type='radio' name='"+strName+"' id='"+strID+"'/>");}
else if(document.createElement&&document.createTextNode)
{radio=document.createElement("input");radio.type="radio";radio.name=strName;radio.id=strID;if(strValue!=undefined)
radio.value=strValue;}
return radio;}
function AddCssClass(div,strCSSClass)
{if(div.className=="")
{div.className=strCSSClass;}
else
{var allclasses=div.className.split(" ");for(var i=0;i<allclasses.length;i++)
{if(allclasses[i]==strCSSClass)
return;}
allclasses[allclasses.length]=strCSSClass;div.className=allclasses.join(" ");}}
function RemoveCssClass(div,strCSSClass)
{var allclasses=div.className.split(" ");var newclasses=new Array();for(var i=0;i<allclasses.length;i++)
{if(allclasses[i]!=strCSSClass)
{newclasses[newclasses.length]=allclasses[i];}}
div.className=newclasses.join(" ");}
function ReplaceCSSClass(div,strOldClass,strNewClass)
{var o=div.className;RemoveCssClass(div,strOldClass);var mid=div.className;AddCssClass(div,strNewClass);}
function RemoveCssClassPostfix(div,strPostfix)
{if(div.className)
{var allclasses=div.className.split(" ");for(var i=0;i<allclasses.length;i++)
{var iPos=allclasses[i].lastIndexOf(strPostfix);if(iPos==allclasses[i].length-strPostfix.length)
allclasses[i]=allclasses[i].substr(0,iPos);}
div.className=allclasses.join(" ");}}
function setBodySize(value)
{var obj=document.getElementsByTagName("body");obj=obj[0];if(!isNaN(value))
window.val=value;if(!value||value=="undefined")
window.val=100;if(!window.val||window.val=="undefined")
window.val=100;if((window.val<=50&&value=="down"))
return false;window.val=parseInt(window.val);if(value=="up"){window.val=window.val+20;}else if(value=="down"){window.val=window.val-20;}
obj.style.fontSize=window.val+"%";setCookie("bodyFontSize",window.val,null);}
function setActiveStyleSheet(title)
{var i,a,main;for(i=0;(a=document.getElementsByTagName("link")[i]);i++)
{var rel=a.getAttribute("rel");if(rel!=null&&rel.indexOf("style")!=-1&&a.getAttribute("title"))
{a.disabled=true;if(a.getAttribute("title")==title)a.disabled=false;}}}
function SetAllFlashOpaque()
{$(document).ready(function(){$("embed[wmode!=opaque]").attr("wmode","opaque");$("param[name=wmode]").remove();$("embed").before("<param name='wmode' value='opaque'>");$("object").wrap("<span></span>");});}

function Marquee(divMarquee)
{this.bEnabled=true;this.iMarqueeDelay=80;this.divMarquee=divMarquee;var me=this;this.Init=function()
{me.divMarquee.parentNode.style.position="relative";me.divMarquee.parentNode.style.overflow="hidden";me.divMarquee.style.position="absolute";me.divMarquee.style.whiteSpace="nowrap";me.divMarquee.style.left=Math.floor(GetLayerWidth(me.divMarquee.parentNode))+"px";AddEvent(me.divMarquee,"mouseover",me.Disable);AddEvent(me.divMarquee,"mouseout",me.Enable);me.MoveMarquee();}
this.Enable=function()
{me.bEnabled=true;me.MoveMarquee();}
this.Disable=function()
{me.bEnabled=false;}
this.MoveMarquee=function()
{if(me.bEnabled)
{var iParentWidth=GetLayerWidth(me.divMarquee.parentNode);var iLeft=GetLayerLeft(me.divMarquee);var iWidth=GetLayerWidth(me.divMarquee);if(iWidth<iParentWidth)
{me.divMarquee.style.left=Math.floor((iParentWidth-iWidth)/2)+"px";me.bEnabled=false;}
else
{if(iLeft<-iWidth)
iLeft=iParentWidth;else
iLeft-=2;me.divMarquee.style.left=iLeft+"px";window.setTimeout(me.MoveMarquee,me.iMarqueeDelay);}}}
me.Init();}
function ImgButton(img,iWidth,iHeight,srcDefault,srcOver,srcDown,srcActive,strAlt,bTransparent)
{this.img=img;this.iWidth=iWidth;this.iHeight=iHeight;this.srcDefault=srcDefault;this.srcOver=(srcOver!=undefined?srcOver:null);this.srcDown=(srcDown!=undefined?srcDown:null);this.srcActive=(srcActive!=undefined&&srcActive!=null&&srcActive.length>0?srcActive:srcDefault);this.strAlt=(strAlt!=undefined?strAlt:null);this.bTransparent=(bTransparent!=undefined?bTransparent:false);this.bActive=false;var me=this;this.SetImage=function(src)
{if(me.bTransparent)
{SetTransparentPng(me.img,src,me.iWidth,me.iHeight,me.strAlt);}
else
{SetImage(me.img,src,me.iWidth,me.iHeight,me.strAlt);}}
this.OnMouseOver=function()
{if(!me.bActive)
{if(me.srcOver!=null)
me.SetImage(me.srcOver);}}
this.OnMouseOut=function()
{if(me.bActive)
me.SetImage(me.srcActive);else
me.SetImage(me.srcDefault);}
this.OnMouseDown=function()
{if(me.srcDown!=null)
me.SetImage(me.srcDown);}
this.OnMouseUp=function()
{if(me.srcOver!=null)
me.SetImage(me.srcOver);}
this.SetActive=function(bActive)
{me.bActive=bActive;if(me.bActive)
me.SetImage(me.srcActive);else
me.SetImage(me.srcDefault);}
this.IsActive=function()
{return me.bActive;}
this.Init=function()
{me.SetImage(me.srcDefault);AddEvent(me.img,"mouseover",me.OnMouseOver);AddEvent(me.img,"mouseout",me.OnMouseOut);AddEvent(me.img,"mousedown",me.OnMouseDown);AddEvent(me.img,"mouseup",me.OnMouseUp);}
me.Init();}
function ImgLink(a,iWidth,iHeight,srcDefault,srcOver,srcDown,srcActive,strAlt,bTransparent)
{this.a=a;this.imgButton=null;var me=this;this.Create=function(a,iWidth,iHeight,srcDefault,srcOver,srcDown,srcActive,strAlt,bTransparent)
{a.setAttribute('href','javascript:void(0)');var img=NewTag('img',a);img.className='UI_input';me.imgButton=new ImgButton(img,iWidth,iHeight,srcDefault,srcOver,null,srcActive,"",bTransparent);AddEvent(img,"mouseover",function(){Tip(strAlt);});AddEvent(img,"mouseout",function(){UnTip();});AddEvent(a,"click",UnTip);}
this.SetActive=function(bActive)
{me.imgButton.SetActive(bActive);}
me.Create(a,iWidth,iHeight,srcDefault,srcOver,srcDown,srcActive,strAlt,bTransparent)}
function TextButton(divParent,divBefore)
{this.strText=null;this.strTextActive=null;this.divImgParent=null;this.divImgBefore=null;this.divTextParent=null;this.divTextBefore=null;this.imgButton=null;this.aText=null;this.aImage=null;this.strHref="";this.OnClick=null;var me=this;this.Create=function(divParent,divBefore)
{if(divParent!=null)
{me.divImgParent=me.divTextParent=divParent;me.divImgBefore=me.divTextBefore=divBefore;}}
this.SetHref=function(strLink)
{me.strHref=strLink;}
this.AddHref=function(a)
{if(me.strHref!="")
{a.setAttribute('href',me.strHref);a.setAttribute('target','_blank');}
else
a.setAttribute('href','javascript:void(0)');}
this.OnClickInternal=function()
{if(me.OnClick)
me.OnClick(me);}
this.SetActive=function(bActive)
{me.imgButton.SetActive(bActive);me.ShowText();}
this.IsActive=function()
{return me.imgButton.IsActive();}
this.SetImgParent=function(divParent,divBefore)
{me.divImgParent=divParent;me.divImgBefore=divBefore;}
this.SetTextParent=function(divParent,divBefore)
{me.divTextParent=divParent;me.divTextBefore=divBefore;}
this.CreateImage=function(iWidth,iHeight,srcDefault,srcOver,srcDown,srcActive,bTransparent)
{var a=NewTag('a',me.divImgParent,me.divImgBefore);me.AddHref(a);me.aImage=a;var img=NewTag('img',a);img.className='UI_icon';me.imgButton=new ImgButton(img,iWidth,iHeight,srcDefault,srcOver,null,srcActive,"",bTransparent);AddEvent(a,"click",me.OnClickInternal);return img;}
this.CreateText=function(strText,strTextActive)
{me.strText=strText;if(strTextActive==undefined||strTextActive==null)
me.strTextActive=strText;else
me.strTextActive=strTextActive;var a=NewTag('a',me.divTextParent,me.divTextBefore);me.AddHref(a);AddEvent(a,"click",me.OnClickInternal);AddEvent(a,"mouseover",me.imgButton.OnMouseOver);AddEvent(a,"mouseout",me.imgButton.OnMouseOut);AddEvent(a,"mousedown",me.imgButton.OnMouseDown);AddEvent(a,"mouseup",me.imgButton.OnMouseUp);me.aText=a;me.ShowText();return a;}
this.ShowText=function()
{if(me.aText)
{while(me.aText.firstChild)
me.aText.removeChild(me.aText.firstChild);if(me.imgButton.IsActive())
NewTextTag(me.strTextActive,me.aText);else
NewTextTag(me.strText,me.aText);}}
me.Create(divParent,divBefore);}
function Panel(divParent,divBefore)
{this.table=null;this.tr=null;var me=this;this.Create=function(divParent,divBefore)
{var table=NewTag('table',divParent,divBefore);table.cellPadding=0;table.cellSpacing=0;table.className='UI_panel_table';var tbody=NewTag('tbody',table);var tr=NewTag('tr',tbody);me.table=table;me.tr=tr;}
this.CreateCaption=function(strText,strImageUrl,iWidth,iHeight)
{var td=NewTag('td',me.tr);td.className="strong";if(strImageUrl!=null&&strImageUrl.length>0)
{var img=NewTag('img',td);img.className='UI_icon';SetImage(img,strImageUrl,iWidth,iHeight,"");}
var span=NewTag('span',td);return NewTextTag(strText,span);}
me.Create(divParent,divBefore);}
function ColorPanel(divParent,divBefore)
{this.table=null;this.td=null;var me=this;this.Create=function(divParent,divBefore)
{var table,tbody,tr,td;table=NewTag('table',divParent,divBefore);table.cellPadding=0;table.cellSpacing=0;table.className='UI_colorpanel';me.table=table;tbody=NewTag('tbody',table);tr=NewTag('tr',tbody);tr.className='UI_panel_top';td=NewTag('td',tr);td.className='UI_panel_left';td=NewTag('td',tr);td.className='UI_panel';td=NewTag('td',tr);td.className='UI_panel_right';tr=NewTag('tr',tbody);tr.className='UI_panel';td=NewTag('td',tr);td.className='UI_panel_left';td=NewTag('td',tr);td.className='UI_panel';me.td=td;td=NewTag('td',tr);td.className='UI_panel_right';tr=NewTag('tr',tbody);tr.className='UI_panel_bottom';td=NewTag('td',tr);td.className='UI_panel_left';td=NewTag('td',tr);td.className='UI_panel';td=NewTag('td',tr);td.className='UI_panel_right';}
this.CreateCaption=function(strText,strImageUrl,iWidth,iHeight)
{var div=NewTag('div',me.td);div.className="strong";if(strImageUrl!=null&&strImageUrl.length>0)
{var img=NewTag('img',div);img.className='UI_icon';SetImage(img,strImageUrl,iWidth,iHeight,"");}
return NewTextTag(strText,div);}
me.Create(divParent,divBefore);}
function WhitePanel(divParent,divBefore)
{this.table=null;this.td=null;var me=this;this.Create=function(divParent,divBefore)
{var table,tbody,tr,td;table=NewTag('table',divParent,divBefore);table.cellPadding=0;table.cellSpacing=0;table.className='UI_whitepanel';me.table=table;tbody=NewTag('tbody',table);tr=NewTag('tr',tbody);tr.className='UI_panel_top';td=NewTag('td',tr);td.className='UI_panel_left';td=NewTag('td',tr);td.className='UI_panel';td=NewTag('td',tr);td.className='UI_panel_right';tr=NewTag('tr',tbody);tr.className='UI_panel';td=NewTag('td',tr);td.className='UI_panel_left';td=NewTag('td',tr);td.className='UI_panel';me.td=td;td=NewTag('td',tr);td.className='UI_panel_right';tr=NewTag('tr',tbody);tr.className='UI_panel_bottom';td=NewTag('td',tr);td.className='UI_panel_left';td=NewTag('td',tr);td.className='UI_panel';td=NewTag('td',tr);td.className='UI_panel_right';}
me.Create(divParent,divBefore);}
function InputBox(divParent,divBefore)
{this.table=null;this.tr=null;this.tdInput=null;this.tdLeftRound=null;this.tdRightRound=null;this.input=null;var me=this;this.Create=function(divParent,divBefore)
{var table=NewTag('table',divParent,divBefore);table.cellPadding=0;table.cellSpacing=0;table.className='UI_input_container';var tbody=NewTag('tbody',table);var tr=NewTag('tr',tbody);me.table=table;me.tr=tr;me.CreateInput();}
this.CreateInput=function()
{var td=NewTag('td',me.tr);td.style.padding="0px";td.style.width="3px";var img=NewTag('img',td);img.className='UI_input';SetImage(img,"design/UI_input_text_left.gif",3,22,"");me.tdLeftRound=td;td=NewTag('td',me.tr);td.className='UI_input_text_container';td.style.padding="0px";var input=NewTag('input');input.setAttribute('type','text');input.className='UI_input_text';AddTag(input,td);me.tdInput=td;var td=NewTag('td',me.tr);td.style.padding="0px";td.style.width="3px";var img=NewTag('img',td);img.className='UI_input';SetImage(img,"design/UI_input_text_right.gif",3,22,"");me.tdRightRound=td;me.input=input;}
this.AppendTd=function()
{var td=NewTag('td',me.tr,null);return td;}
this.InsertTd=function()
{var td=NewTag('td',me.tr,me.tdInput.previousSibling);return td;}
this.AppendIconTd=function()
{var img=me.tdRightRound.firstChild;img.setAttribute('src',"design/UI_input_icon_right.gif");var td=NewTag('td',me.tr,me.tdRightRound);return td;}
me.Create(divParent,divBefore);}
function PasswordBox(divParent,divBefore)
{this.table=null;this.tr=null;this.tdInput=null;this.tdLeftRound=null;this.tdRightRound=null;this.input=null;var me=this;this.Create=function(divParent,divBefore)
{var table=NewTag('table',divParent,divBefore);table.cellPadding=0;table.cellSpacing=0;table.className='UI_input_container';var tbody=NewTag('tbody',table);var tr=NewTag('tr',tbody);var td=NewTag('td',tr);td.style.padding="0px";td.style.width="3px";var img=NewTag('img',td);img.className='UI_input';SetImage(img,"design/UI_input_text_left.gif",3,22,"");me.tdLeftRound=td;td=NewTag('td',tr);td.className='UI_input_text_container';td.style.padding="0px";var input=NewTag('input');input.setAttribute('type','password');input.className='UI_input_text';AddTag(input,td);me.tdInput=td;var td=NewTag('td',tr);td.style.padding="0px";td.style.width="3px";var img=NewTag('img',td);img.className='UI_input';SetImage(img,"design/UI_input_text_right.gif",3,22,"");me.tdRightRound=td;me.table=table;me.tr=tr;me.input=input;}
this.InsertTd=function()
{var td=NewTag('td',me.tr,me.tdInput.previousSibling);return td;}
me.Create(divParent,divBefore);}
function Menu(divParent,divBefore)
{this.table=null;this.tr=null;this.tdMiddle=null;var me=this;this.OnMenuItemClick=function(pEvent)
{var links=me.tr.getElementsByTagName('a');for(var i=0;i<links.length;i++)
{if(links[i].className=="selected")
links[i].className="";}
var a=GetEventSourceElement(pEvent);a.className="selected";}
this.CreateTdLeft=function()
{if(me.tr)
{var td=NewTag('td',me.tr,me.tdMiddle);td.className='UI_main_menu';var td_sep=NewTag('td',me.tr,me.tdMiddle);td_sep.className='UI_main_menu_separator';return td;}}
this.CreateTdRight=function()
{if(me.tr)
{var td_sep=NewTag('td',me.tr,me.tr.lastChild);td_sep.className='UI_main_menu_separator';var td=NewTag('td',me.tr,me.tr.lastChild);td.className='UI_main_menu';return td;}}
this.AddMenuItemLeft=function(strText,onClick,strLink)
{var td=me.CreateTdLeft();var a=NewTag('a',td);if(strLink!=null)
{a.setAttribute('href',strLink);a.setAttribute('target','_blank');}
else
a.setAttribute('href','javascript:void(0)');if(onClick!=null)
AddEvent(a,"click",onClick);if(strLink==null)
AddEvent(a,"click",me.OnMenuItemClick);NewTextTag(strText,a);return a;}
this.AddMenuItemRight=function(strText,onClick)
{var td=me.CreateTdRight();var a=NewTag('a',td);a.setAttribute('href','javascript:void(0)');if(onClick!=null)
AddEvent(a,"click",onClick);AddEvent(a,"click",me.OnMenuItemClick);NewTextTag(strText,a);return a;}
this.Create=function(divParent,divBefore)
{var table=NewTag('table',divParent,divBefore);table.cellPadding=0;table.cellSpacing=0;table.className='UI_main_menu_container';var tbody=NewTag('tbody',table);var tr=NewTag('tr',tbody);var td=NewTag('td',tr);td.className='UI_main_menu_left';td=NewTag('td',tr);td.className='UI_main_menu';this.tdMiddle=td;td=NewTag('td',tr);td.className='UI_main_menu_right';me.table=table;me.tr=tr;}
me.Create(divParent,divBefore);}
function Note(divParent,divBefore)
{this.table=null;this.th=null;this.td=null;var me=this;this.Create=function(divParent,divBefore)
{var table=NewTag('table',divParent,divBefore);table.cellPadding=0;table.cellSpacing=0;table.className='note';var tbody=NewTag('tbody',table);var tr=NewTag('tr',tbody);var th=NewTag('th',tr);tr=NewTag('tr',tbody);var td=NewTag('td',tr);me.table=table;me.th=th;me.td=td;}
this.CreateCaption=function(strText,strImageUrl,iWidth,iHeight)
{var td=NewTag('td',me.tr);td.className="strong";if(strImageUrl!=null&&strImageUrl.length>0)
{var img=NewTag('img',td);img.className='UI_icon';SetImage(img,strImageUrl,iWidth,iHeight,"");}
NewTextTag(strText,td);}
me.Create(divParent,divBefore);}
function Alert(divParent,divBefore)
{this.table=null;this.th=null;this.td=null;var me=this;this.Create=function(divParent,divBefore)
{var table=NewTag('table',divParent,divBefore);table.cellPadding=0;table.cellSpacing=0;table.className='alert';var tbody=NewTag('tbody',table);var tr=NewTag('tr',tbody);var th=NewTag('th',tr);tr=NewTag('tr',tbody);var td=NewTag('td',tr);me.table=table;me.th=th;me.td=td;}
this.CreateCaption=function(strText,strImageUrl,iWidth,iHeight)
{var td=NewTag('td',me.tr);td.className="strong";if(strImageUrl!=null&&strImageUrl.length>0)
{var img=NewTag('img',td);img.className='UI_icon';SetImage(img,strImageUrl,iWidth,iHeight,"");}
NewTextTag(strText,td);}
me.Create(divParent,divBefore);}
function AddThreeColRow(table,strCssClass)
{var strCssBase=strCssClass;var strEnd="_container";var iPos=strCssClass.length-strEnd.length;if(iPos>=0&&strCssClass.substr(iPos)==strEnd)
strCssBase=strCssClass.substr(0,iPos);var tbody=table.firstChild;if(!tbody)
tbody=NewTag('tbody',table);var tr=NewTag('tr',tbody);var td=NewTag('td',tr);td.className=strCssBase+'_left';var img=NewTag('img',td);SetImage(img,GetAbsUrl('design/clear.gif'),1,1);var tdMain=NewTag('td',tr);tdMain.className=strCssBase;var td=NewTag('td',tr);td.className=strCssBase+'_right';var img=NewTag('img',td);SetImage(img,GetAbsUrl('design/clear.gif'),1,1);return tdMain;}

Resizer=new function()
{this.iClientWidth=0;this.iClientHeight=0;this.iPrevClientWidth=0;this.iPrevClientHeight=0;this.iNormalClientWidth=0;this.iNormalClientHeight=0;this.iNormalWindowWidth=0;this.iNormalWindowHeight=0;this.OnResize=null;this.OnResizeEnded=null;this.OnMaximize=null;this.OnRestore=null;var me=this;this.Init=function()
{window.onresize=function(pEvent)
{me.setDivsSize();var iWidth=me.iClientWidth;var iHeight=me.iClientHeight;window.setTimeout(function(){me.ResizeMap(iWidth,iHeight),500});}
me.setDivsSize();if(me.OnResizeEnded!=null)
me.OnResizeEnded();me.iPrevClientWidth=me.iClientWidth;me.iPrevClientHeight=me.iClientHeight;}
this.calcSize=function()
{if(typeof(window.innerWidth)=='number'){me.iClientWidth=window.innerWidth;me.iClientHeight=window.innerHeight;}else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){me.iClientWidth=document.documentElement.clientWidth;me.iClientHeight=document.documentElement.clientHeight;}else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){me.iClientWidth=document.body.clientWidth;me.iClientHeight=document.body.clientHeight;}}
this.setAnElemHeight=function(elementId,minHeight,iOffset)
{var theElement=document.getElementById?document.getElementById(elementId):document.all?document.all[elementId]:null;if(theElement){theElement.style.height=Math.max(Math.round(me.iClientHeight-iOffset),minHeight)+"px";}}
this.setAnElemWidth=function(elementId,minWidth,iOffset)
{var theElement=document.getElementById?document.getElementById(elementId):document.all?document.all[elementId]:null;if(theElement){theElement.style.width=Math.max(Math.round(me.iClientWidth-iOffset),minWidth)+"px";}}
this.setDivsSize=function()
{me.calcSize();if(me.OnResize)
me.OnResize();}
this.GetClientWidth=function()
{return me.iClientWidth;}
this.GetClientHeight=function()
{return me.iClientHeight;}
this.ResizeMap=function(yourWidth,yourHeight)
{if((me.iClientWidth==yourWidth)&&(me.iClientHeight==yourHeight)&&((yourWidth!=me.iPrevClientWidth)||(yourHeight!=me.iPrevClientHeight)))
{var iDeltaX=me.iPrevClientWidth-me.iClientWidth;var iDeltaY=me.iPrevClientHeight-me.iClientHeight;me.iPrevClientWidth=me.iClientWidth;me.iPrevClientHeight=me.iClientHeight;if(me.OnResizeEnded!=null)
me.OnResizeEnded(iDeltaX,iDeltaY);}}
this.Maximize=function()
{me.calcSize();if(!isNaN(window.outerWidth))
me.iNormalWindowWidth=window.outerWidth;else
me.iNormalWindowWidth=0;if(!isNaN(window.outerHeight))
me.iNormalWindowHeight=window.outerHeight;else
me.iNormalWindowHeight=0;me.iNormalClientWidth=me.iClientWidth;me.iNormalClientHeight=me.iClientHeight;window.moveTo(0,0);window.resizeTo(window.screen.availWidth,window.screen.availHeight);me.calcSize();if(me.iNormalWindowWidth<=0||me.iNormalWindowHeight<=0)
{me.iNormalWindowWidth=me.iNormalClientWidth+(window.screen.availWidth-me.iClientWidth);me.iNormalWindowHeight=me.iNormalClientHeight+(window.screen.availHeight-me.iClientHeight);}
if(me.OnMaximize)
me.OnMaximize();}
this.Restore=function()
{if(me.iNormalWindowWidth>0&&me.iNormalWindowHeight>0)
window.resizeTo(me.iNormalWindowWidth,me.iNormalWindowHeight);if(me.OnRestore)
me.OnRestore();}}

function Ajax(){this.req=null;this.url=null;this.method='GET';this.async=true;this.status=null;this.statusText='';this.postData=null;this.readyState=null;this.responseText=null;this.responseXML=null;this.handleResp=null;this.handleReadyStateChange=null;this.responseFormat='text',this.mimeType=null;var me=this;this.setMimeType=function(mimeType){me.mimeType=mimeType;};this.setHandlerErr=function(funcRef){me.handleErr=funcRef;};this.setHandlerBoth=function(funcRef){me.handleResp=funcRef;me.handleErr=funcRef;};this.init=function(){if(!me.req){try{me.req=new XMLHttpRequest();}
catch(e){try{me.req=new ActiveXObject('MSXML2.XMLHTTP');}
catch(e){try{me.req=new ActiveXObject('Microsoft.XMLHTTP');}
catch(e){return false;}}}}
return me.req;};this.doReq=function(){if(!me.init()){alert('Could not create XMLHttpRequest object.');return;}
me.req.open(me.method,me.url,me.async);if(me.mimeType){try{req.overrideMimeType(me.mimeType);}
catch(e){}}
var myonreadystatechange=function(){var resp=null;me.readyState=me.req.readyState;if(me.handleReadyStateChange)
me.handleReadyStateChange();if(me.req.readyState==4){switch(me.responseFormat){case'text':resp=me.req.responseText;break;case'xml':resp=me.req.responseXML;break;case'object':resp=req;break;}
if(me.req.status>=200&&me.req.status<=299){me.handleResp(resp);}
else{if(me.handleErr!=null&&me.handleErr!=undefined)
me.handleErr(resp);}}};if(me.async)
me.req.onreadystatechange=myonreadystatechange;me.req.setRequestHeader('Content-Type','application/x-www-form-urlencoded;charset=UTF-8');me.req.send(me.postData);if(!me.async)
{myonreadystatechange();}};this.handleErr=function(){var errorWin;try{errorWin=window.open('','errorWin');errorWin.document.body.innerHTML=me.responseText;}
catch(e){alert('An error occurred, but the error message cannot be '
+'displayed. This is probably because of your browser\'s '
+'pop-up blocker.\n'
+'Please allow pop-ups from this web site if you want to '
+'see the full error messages.\n'
+'\n'
+'Status Code: '+me.req.status+'\n'
+'Status Description: '+me.req.statusText);}};this.abort=function(){if(me.req){me.req.onreadystatechange=function(){};me.req.abort();me.req=null;}};this.doGet=function(url,hand,format){me.url=url;me.handleResp=hand;me.responseFormat=format||'text';me.doReq();};this.doPost=function(url,params,hand,format){me.method="POST";me.url=url;me.postData=params;me.handleResp=hand;me.responseFormat=format||"text";me.doReq();}}

var g_arrAjaxList=new Array();function CommandHandler(strServerUrl,strSessionID,strAppID,strLangID)
{var me=this;this.bUseAjax=true;this.strServerUrl=((strServerUrl!=undefined)&&(strServerUrl!=null)&&(strServerUrl!="")?strServerUrl:location.protocol+"//"+location.host+location.pathname);this.strSessionID=(strSessionID!=undefined?strSessionID:"");this.strAppID=(strAppID!=undefined?strAppID:null);this.strLangID=(strLangID!=undefined?strLangID:null);this.OnCommandReady=null;this.OnCommandError=null;this.OnReadyStateChange=null;this.AddAjax=function(ajax,iTag)
{ajax.iTag=(iTag!=undefined?iTag:null);var iNew=-1;for(var i=0;i<g_arrAjaxList.length;i++)
{if(g_arrAjaxList[i]==null||g_arrAjaxList[i].readyState==4)
{iNew=i;break;}}
if(iNew<0){iNew=g_arrAjaxList.length;}
g_arrAjaxList[iNew]=ajax;}
this.GetState=function(iTag)
{if(iTag==undefined)
iTag=null;var iState=0;for(var i=0;i<g_arrAjaxList.length;i++)
{if(g_arrAjaxList[i]!=null)
{if(iTag!=null&&g_arrAjaxList[i].iTag!=iTag)
{continue;}
if(iState==0||g_arrAjaxList[i].readyState<iState)
iState=g_arrAjaxList[i].readyState;}}
return iState;}
this.CreateCommandID=function()
{return Math.round(Math.random()*10000);}
this.GetCommandUrl=function(strFunction,iCommandID)
{var url=me.strServerUrl;if(iCommandID==null)
iCommandID=me.CreateCommandID();url+='?Command='+strFunction+'&sessionID='+me.strSessionID+'&iCommandID='+iCommandID;if(me.strAppID!=null)
url+='&appID='+me.strAppID;if(me.strLangID!=null)
url+='&lang='+me.strLangID;return url;}
this.CallJs=function(strUrl)
{var iStartPos=strUrl.indexOf("iImageID=")+9;var iEndPos=strUrl.indexOf("&",iStartPos);var iImageID=0;if(iEndPos>0)
iImageID+=parseInt(strUrl.substring(iStartPos,iEndPos));if(isNaN(iImageID))
iImageID=0;var script=document.createElement('script');script.type='text/javascript';script.src=strUrl;document.getElementsByTagName('head')[0].appendChild(script);}
this.CallAjax=function(strFunction,strParams,iTag,handler,handlerParam,bAsync)
{var iCommandID=me.CreateCommandID();if(handler==undefined)
handler=null;var hand=function(strResult){{if(strResult!=null&&strResult.length>0)
{if(strResult.charAt(0)=="<")
{location.href="Handler.ashx";}
if(handler)
handler(eval(strResult),handlerParam,iCommandID);else
eval(strResult);if(me.OnCommandReady)
{try{me.OnCommandReady(iCommandID);}
catch(exp){if(me.OnCommandError)
me.OnCommandError(exp,iCommandID);}}}
else
{if(me.OnCommandError)
{try{me.OnCommandError("");}
catch(exp){}}}}}
if(iTag==undefined)
iTag=null;var ajax=new Ajax();if(bAsync!=null&&!bAsync)
ajax.async=false;me.AddAjax(ajax,iTag);if(me.OnCommandError!=null)
ajax.setHandlerErr(me.OnCommandError);ajax.handleReadyStateChange=function()
{if(me.OnReadyStateChange)
{try{me.OnReadyStateChange(me.GetState(iTag),iTag);}
catch(e){alert("Exception in CommandHandler.OnReadyStateChange");}}}
ajax.doPost(me.GetCommandUrl(strFunction,iCommandID),strParams,hand,"text");return iCommandID;}
this.CallFunction=function(strFunction,strParams,iTag,handler,handlerParam)
{if(me.bUseAjax)
return me.CallAjax(strFunction,strParams,iTag,handler,handlerParam,true);else
me.CallJs(me.GetUrl(strFunction,strParams));}
this.CallSyncFunction=function(strFunction,strParams,iTag,handler,handlerParam)
{var iCommandID=me.CallAjax(strFunction,strParams,iTag,handler,handlerParam,false);return iCommandID;}
this.GetUrl=function(strFunction,strParams)
{var strUrl=me.GetCommandUrl(strFunction);if(strParams!=null&&strParams!=undefined)
{strUrl+="&"+strParams;}
return strUrl;}}

function VisualPoiListItem(marker,pPOIBOX,iIndex,strName,bDetailed)
{this.m_pMarker=marker;this.m_pPOIBOX=pPOIBOX;this.m_iIndex=iIndex;this.m_strName=strName;this.m_trPOIItem=null;this.m_aPOIName=null;this.m_arrNames=null;this.m_arrValues=null;this.m_iTypeId=marker.GetProperty("nTypeID");this.m_bDetailed=bDetailed;this.m_divDetails=null;this.OnMouseOverPOIName=null;this.OnMouseOutPOIName=null;this.OnClickPOIName=null;this.OnClickLoupe=null;this.m_bDetailsHasDownloadedFromServer=false;var me=this;this.Create=function()
{var tr=me.m_pPOIBOX.panelPoiList.tr;if(tr.firstChild)
tr=NewTag('tr',tr.parentNode);me.m_trPOIItem=tr;tr.className=me.m_pMarker.GetProperty("list_css_classname");var td=NewTag('td',tr);td.className='list_order';var span=NewTag('span',td);NewTextTag(me.m_iIndex+'.',span);td=NewTag('td',tr);td.className="list_data";var a=NewTag('a',td);a.setAttribute('href','javascript:void(0)');NewTextTag(me.m_strName,a);me.m_aPOIName=a;AddEvent(a,'click',me.OnClickPOIName);AddEvent(a,'mouseover',me.OnMouseOverPOIName);AddEvent(a,'mouseout',me.OnMouseOutPOIName);td=NewTag('td',tr);td.className="list_show";var a=NewTag('a',td);if(me.OnClickLoupe!=null)
{new ImgLink(a,12,15,"design/ICON_display_off.gif","design/ICON_display_on.gif",null,null,g_Babel.GetWord("ShowAddress"),false);AddEvent(a,'click',me.OnClickLoupe);}
var tr=NewTag('tr',tr.parentNode);var td=NewTag('td',tr);td.colSpan=3;var hr=NewTag('hr',td);hr.className='dotted';if(me.m_bDetailed==true)
{me.ShowDetails();}
else
{me.m_bDetailed=false;}}
this.GetTableRow=function()
{return me.m_trPOIItem;}
this.AddArrNames=function(arrNames)
{if(me.m_arrNames!=null)
{delete me.m_arrNames;me.m_arrNames=null;}
me.m_arrNames=arrNames;}
this.AddArrValues=function(arrValues)
{if(me.m_arrValues!=null)
{delete me.m_arrValues;me.m_arrValues=null;}
me.m_arrValues=arrValues;}
this.DetailsDataArrivedPOIBOX=function(result)
{me.m_iTypeId=result.arrRecords[0].nTypeID;var j;for(j=1;j<result.arrRecords[0].arrValues.length;j++)
{me.m_arrNames.push(result.arrRecords[0].arrNames[j]);me.m_arrValues.push(result.arrRecords[0].arrValues[j]);};me.m_bDetailsHasDownloadedFromServer=true;me.ShowDetails();}
this.ShowDetails=function()
{var iServerID=me.m_pMarker.GetProperty("get_details_from_server");if((iServerID!="???")&&(me.m_bDetailsHasDownloadedFromServer==false))
{g_TopoliszMap.NoSessionServer.CallFunction("SearchPoi","iID="+iServerID,0,me.DetailsDataArrivedPOIBOX);return;}
if(me.m_divDetails==null)
{me.m_divDetails=NewTag('div',me.m_aPOIName.parentNode);}
else
{me.m_divDetails.parentNode.removeChild(me.m_divDetails);me.m_divDetails=NewTag('div',me.m_aPOIName.parentNode);}
if((me.m_iTypeId!="")&&(me.m_iTypeId!="???"))
{NewTag('br',me.m_divDetails);NewTextTag(g_Babel.GetWord("PoiType")+": "+g_Babel.GetWord("poi"+me.m_iTypeId),me.m_divDetails);}
var i;for(i=1;i<me.m_arrNames.length;i++)
{var listPoiPropertyNames=[g_Babel.GetWord("PoiType"),"Cím","Telefon","Fax","Email","Web","Nyitva"];if(listPoiPropertyNames.indexOf(me.m_arrNames[i])!=-1)
{var brDetail=NewTag('br',me.m_divDetails);var img=NewTag("img",me.m_divDetails);SetImage(img,"images/transparent.gif",1,1,"VALAMI");if(me.m_pPOIBOX.pMap.GetLang()=="hu")
NewTextTag(me.m_arrNames[i]+": "+me.m_arrValues[i],me.m_divDetails);else
NewTextTag(me.m_arrValues[i],me.m_divDetails);}}
me.m_bDetailed=true;}
this.HideDetails=function()
{try
{if(me.m_divDetails!=null)
{while(me.m_divDetails.firstChild)
{me.m_divDetails.removeChild(me.m_divDetails.firstChild);}}}
catch(x)
{alert("1"+x);}
me.m_bDetailed=false;}
this.SwitchDetails=function()
{if(me.m_bDetailed)
me.HideDetails();else
me.ShowDetails();}}
function LayerPoi(strID,iX,iY,strName,wgsX,wgsY)
{this.strID=(strID!=undefined&&strID!=null?strID:"");this.iX=(iX!=undefined?iX:0);this.iY=(iY!=undefined?iY:0);this.strName=(strName!=undefined&&strName!=null?strName:"");this.divPoiListItem=null;this.pMap=null;this.pPOIBOX=null;this.divDetails=null;this.divLabel=null;this.divLabelDetails=null;this.pVPLI=null;var me=this;this.RemoveBox=function()
{if(me.pPOIBOX!=null)
{me.pPOIBOX.DeselectPOI();}}
this.MouseOverEventHandler=function()
{if((me.pPOIBOX!=null))
{me.pMap.RemovePinBoxes("findpoi");me.pPOIBOX.SelectPOI(me);}}
this.MouseClickEventHandler=function()
{if(me.pPOIBOX!=null)
{me.pMap.RemovePinBoxes("findpoi");me.pPOIBOX.SelectPOI(me);me.pPOIBOX.ShowHideDetailsOfLayerPoi(me);}}
this.MouseOutEventHandler=function()
{}}
function POIBOX(div,pMap,type)
{this.pMap=pMap;this.div=div;this.type=type;this.divPois=null;this.panelPoiList=null;this.pPager=null;this.aDetails=null;this.divDetails=null;var me=this;this.divSelectedPoi=null;this.imgFocus=null;this.divFocus=null;this.sSelectedPOIColor="Red";this.sNormalPOIColor="#70706e";this.bDetailsRequestIsInProgress=false;this.Init=function()
{if(me.type=="layertype")
{me.pMap.OnPoiOnGridListChanged=me.OnPoiOnGridListChanged;me.pMap.OnMapViewChanged=me.OnMapViewChanged;}
else if(me.type=="searchtype")
{me.pMap.OnMarkerListChanged=me.OnMarkerListChanged;}}
this.SetDiv=function(div)
{me.div=div;}
this.Show=function()
{var panel=new Panel(me.div);if(me.type=="searchtype")
panel.CreateCaption(g_Babel.GetWord('SearchResults'),"design/ICON_info_off.gif",14,14);me.divPois=NewTag('div',me.div);AddCssClass(me.divPois,"poi_list")}
this.Unhide=function()
{if(me.div)
Show(me.div);}
this.Hide=function()
{if(me.div)
Hide(me.div);}
this.AddHeader=function(sCaption)
{var divHeader=NewTag("div",me.divPois);divHeader.className="POIHeader";NewTextTag(sCaption,divHeader);return divHeader;}
this.AddFindPoi=function(marker)
{var strPOIName=marker.GetLabelCaption();var iSerial=marker.GetProperty("pinnumber");var bDetailed=(marker==me.pMap.pActualMarker);var ptrVPLI=new VisualPoiListItem(marker,me,iSerial,strPOIName,bDetailed);marker.pVPLI=ptrVPLI;ptrVPLI.AddArrNames(marker.arrNames);ptrVPLI.AddArrValues(marker.arrValues);ptrVPLI.OnMouseOverPOIName=function()
{if(me.pMap.pFixedMarker!=marker)
{me.pMap.iMustVisibleMarkerSID=0;me.pMap.pFixedMarker=null;}
{me.pMap.RemovePinBoxes();if(marker.pLabel!=null)
marker.pLabel.DrawBox(marker,me.pMap.divPoiParent);}}
ptrVPLI.OnMouseOutPOIName=function()
{{if(marker.pLabel)
marker.pLabel.RemoveBox();}}
ptrVPLI.OnClickPOIName=function()
{ptrVPLI.SwitchDetails();}
ptrVPLI.OnClickLoupe=function()
{var ServerID=marker.GetProperty("get_wgs_from_server");if(ServerID!="???")
me.pMap.iMustVisibleMarkerSID=ServerID;else
{marker.bLabelBoxMustBeVisible=true;}
if(marker.HasWGSCoords())
{me.pMap.ZoomToPoint(marker.dX,marker.dY,150);window.setTimeout(function(){window.location="#idMap";},500);}
else if(ServerID!="???")
{me.pMap.NoSessionServer.CallFunction("SearchPoi","iID="+ServerID,0,ptrVPLI.OnClickLoupe_Callback,null);}}
ptrVPLI.OnClickLoupe_Callback=function(result,funcAfter)
{marker.dX=result.arrRecords[0].dX;marker.dY=result.arrRecords[0].dY;me.pMap.ZoomToPoint(marker.dX,marker.dY,400);window.setTimeout(function(){window.location="#idMap";},500);if(funcAfter!=null)
funcAfter();}
ptrVPLI.Create();}
this.ResetFindPoi=function()
{me.DeselectPOI();me.Clear();me.pMap.pMarkers.DeleteAllWithType("findpoi");}
this.ResetLayerPoi=function()
{me.DeselectPOI();me.Clear();}
this.AddPOIs=function(arrPOIRecords)
{var panel=new Panel(me.divPois);panel.CreateCaption(arrPOIRecords.length+" "+g_Babel.GetWord('SearchResultCount'),"design/ICON_list_off.gif",14,14);DeleteChildren(me.pMap.pGridMain.mainGridDiv,"layerpoinumber");if(arrPOIRecords.length==0)
{}
else if(arrPOIRecords.length<51)
{var whitepanel=new WhitePanel(me.divPois);me.panelPoiList=new Panel(whitepanel.td);var i;me.pMap.pGridMain.mainGridDiv.style.visibility="visible";for(i=0;i<arrPOIRecords.length;i++)
{var marker=arrPOIRecords[i];marker.SetProperty("pinnumber",i+1);me.AddFindPoi(marker);marker.pLabel.DrawSign();}}
else if(arrPOIRecords.length>=51)
{var note=new Note(me.divPois);NewTextTag(g_Babel.GetWord("capProposal"),note.th);var ul=NewTag('ul',note.td);var li=NewTag('li',ul);NewTextTag(g_Babel.GetWord('NarrowTheResultSet'),li);var i;for(i=0;i<arrPOIRecords.length;i++)
{arrPOIRecords[i].pPOIBOX=me;}}}
this.WriteNoResultMessage=function()
{var note=new Note(me.divPois);NewTextTag(g_Babel.GetWord("capProposal"),note.th);var ul=NewTag('ul',note.td);var li=NewTag('li',ul);NewTextTag(g_Babel.GetWord('NoPoiWereFound'),li);}
this.DeselectPOI=function()
{if(me.divSelectedPoi)
{me.divSelectedPoi.style.color=me.sNormalPOIColor;me.divSelectedPoi.style.fontStyle="Normal";me.divSelectedPoi.divLabel=null;}
if(me.imgFocus)
{if(me.imgFocus.parentNode!=null)
me.imgFocus.parentNode.removeChild(me.imgFocus);me.imgFocus=null;}
if(me.divFocus)
{if(me.divFocus.parentNode!=null)
me.divFocus.parentNode.removeChild(me.divFocus);me.divFocus=null;}
me.divSelectedPoi=null;}
this.IsSelected=function(divPOI)
{return(divPOI==me.divSelectedPoi);}
this.CreatePager=function(iFirst,iLast,bHasNextPage,iResultPerPages,iVisiblePages)
{var divPager=NewTag("div",me.div);var iStartPageNumber=Math.floor(iFirst/iResultPerPages)+1;var iEndPageNumber=Math.floor(iLast/iResultPerPages)+1;var iPagesNumber=iEndPageNumber;if(bHasNextPage)iPagesNumber=iPagesNumber+1;me.pPager=new DrawPager(divPager,iVisiblePages,iStartPageNumber,iPagesNumber);return me.pPager;}
this.OnChangeLang=function()
{}
g_Babel.AddListener(this.OnChangeLang);this.OnPoiOnGridListChanged=function()
{me.ClearPoiList();if(me.pMap)
me.AddPOIs(me.pMap.GetPoisInView());}
this.OnMarkerListChanged=function()
{var actualMarkerExists=false;me.ClearPoiList();if(me.pMap)
{var i;var whitepanel=new WhitePanel(me.divPois);me.panelPoiList=new Panel(whitepanel.td);for(i=0;i<me.pMap.pMarkers.arrMarkers.length;i++)
{var marker=me.pMap.pMarkers.arrMarkers[i];if(marker==me.pMap.pActualMarker)
actualMarkerExists=true;if(marker)
{if((marker.mainType=="findpoi"))
{me.AddFindPoi(marker);}}}}}
this.OnMapViewChanged=function()
{me.ClearPoiList();if(me.pMap)
me.AddPOIs(me.pMap.GetPoisInView());}
this.ClearPoiList=function()
{if(me.divPois)
{while(me.divPois.firstChild)
me.divPois.removeChild(me.divPois.firstChild);}}
this.Clear=function()
{while(me.div.firstChild)
me.div.removeChild(me.div.firstChild);me.divPois=NewTag('div',me.div);}
me.Init();}

var globalDivFlash=null;document.oncontextmenu=OnContextMenuFunc;function OnContextMenuFunc(pEvent)
{if(g_TopoliszPageData.GetActiveMap()!=null)
return false;else
return true;};function TopoliszPageData()
{this.pMap=null;this.pPreviousNotNullActiveMap=null;var me=this;this.SetActiveMap=function(map)
{if(me.pMap!=null)
{me.pPreviousNotNullActiveMap=me.pMap;}
me.pMap=map;};this.GetActiveMap=function(){return me.pMap};this.GetPreviousNotActiveMap=function(){return me.pPreviousNotNullActiveMap};}
g_TopoliszPageData=new TopoliszPageData();function DrawRouteStruct()
{this.bNewPoint=false;this.bDrawRoute=false;}
function PropertyChangedEventListener(strProperty,funcOnChanged)
{this.strProperty=strProperty;this.funcOnChanged=funcOnChanged;}
CTopoliszMap.prototype.arrInstances=new Array();function CTopoliszMap(strSessionID,divMap,bHasMiniMap,bCanLooseFocus)
{this.m_bRasterLevel=true;this.m_bPaleMapGridImage=false;this.m_arrLevelInfo=null;this.m_bRubberMode=false;this.m_bRubberDrawing=false;this.rubberDiv=null;this.rubberDivTop=0;this.rubberDivLeft=0;this.rubberDivBottom=0;this.rubberDivRight=0;this.m_bZoomRectVsMoveModeInverted=false;this.bExternalMouseHandling=false;this.bLabelHasPanoramaButton=true;this.bLabelHasStartButton=true;this.bLabelHasStopButton=true;this.bLabelHasThroughButton=true;this.arrInstances[this.arrInstances.length]=this;this.bPreviewIsOn=false;this.strSessionID=strSessionID;this.divMap=divMap;this.divFace=null;this.arrPois=new Array();this.arrPoisOnGrid=new Array();this.OnPoiOnGridListChanged=null;this.OnMarkerListChanged=null;this.OnMapViewChanged=null;this.pMapPalette=null;this.graphics=null;this.polyline=null;this.bMouseDown=false;this.iMouseDownX=0;this.iMouseDownY=0;this.iMouseUpX=0;this.iMouseUpY=0;this.iMouseMoveStartX=0;this.iMouseMoveStartY=0;this.iMouseMoveEndX=0;this.iMouseMoveEndY=0;this.iMousePosX=0;this.iMousePosY=0;this.pGridMain=null;this.iMapViewWidth=0;this.iMapViewHeight=0;this.arrStates=new Array();this.iActiveState=-1;this.bSkipNextStateChange=false;this.pRouteSearch=null;this.pTextResult=null;this.iMapGridItemWidth=(g_RasterMapInfo!=null?g_RasterMapInfo.iSectionWidth:150);this.iMapGridItemHeight=(g_RasterMapInfo!=null?g_RasterMapInfo.iSectionHeight:150);this.iGridHeight=Math.ceil(screen.availHeight/this.iMapGridItemHeight)+1;this.iGridWidth=Math.ceil(screen.availWidth/this.iMapGridItemWidth)+1;this.iMapWidth=this.iMapGridItemWidth*this.iGridWidth;this.iMapHeight=this.iMapGridItemHeight*this.iGridHeight;this.DEFAULT_MINIMAP_LEVEL=0;this.DIFF_MAP_LEVELS=5;this.MAP_DEFAULT_LEVEL=3;this.MAP_MINIMUM_LEVEL=3;this.MAP_MAXIMUM_LEVEL=-1;this.ArgZoom_ZoomPosX=0;this.ArgZoom_ZoomPosY=0;this.pixeldensity=10;this.InciServer=null;this.NoSessionServer=null;this.ReadSessionServer=null;this.bMainMapMode=true;this.bHasMiniMap=bHasMiniMap;this.pConnectedMainMap=null;this.pConnectedMiniMap=null;this.pMiniMapFrame=null;this.bMiniMapVisible=false;this.animDiv=null;this.ratiometerDiv=null;this.bZooming=false;this.iZoomingLevelChange=0;this.pZoomSrc=undefined;this.bFrameMouseDown=false;this.iFrameMouseX;this.iFrameMouseY;this.iFrameMouseStartX;this.iFrameMouseStartY;this.graphics=null;this.DistMeter=null;this.bDistanceMeasuring=false;this.pDistanceDisplay=null;this.pDistancePoly=new CPolyline();this.bDrawRouteHappening=false;this.bDrawDistMeasureHappening=false;this.bDrawHidFile=false;this.strDrawTrfEdgeVT="";this.strDrawTrfNodeVT="";this.strDrawRunParams="";this.iMapDivBorderWidth=3;this.bUserMovedByMouse=false;this.bUserMovedEndedFlag=false;this.bUserMoving=false;this.pLastStateFromServer=null;this.iMovingSinceLastServerStateX=0;this.iMovingSinceLastServerStateY=0;this.AutoScrollDY=0;this.AutoScrollDX=0;this.bAutoScrollEnabled=false;this.bMouseOverMapView=false;this.iAutoScrollMargin=15;this.bAutoScrolling=false;this.divFaceBorderTop=null;this.divFaceBorderLeft=null;this.divFaceBorderBottom=null;this.divFaceBorderRight=null;this.imgFaceBorderTop=null;this.imgFaceBorderLeft=null;this.imgFaceBorderBottom=null;this.imgFaceBorderRight=null;this.AutoMoveLimit=0;this.AutoMoveLimitStartValue=1000;this.pMarkers=new Markers();this.pLabels=new Array();this.pRouteSearch=null;this.bDisplayPOIBanner=true;this.bDisplayCoords=getBoolCookie('bDisplayCoords',false);this.bPickMode=false;this.strPickMode="internal";this.bMouseEventsAreSet=false;this.divPoiParent=null;this.divPrintPreview=null;this.sPoiLayers="";this.pMouseOverLayerPoi=null;this.pMouseOverPin=null;this.pLastMouseOverPin=null;this.bMouseLongOverTimingEnabled=true;this.bCursorOnMapPalette=false;this.bOuterMoving=false;this.bWheeling=false;this.iWheelingDeltaSum=0;this.pFixedMarker=null;this.arrDrawRouteCallbackListeners=new Array();this.bEnableMapCaption=true;this.divMapCaption=null;this.divMapCopyright=null;this.divToolTip=null;this.bZoomingHappens=false;this.divAddressFormatHelp=null;this.bFocused=true;this.strRole="mainmap";this.iMainGridImageOpacity=100;this.m_bPickingForbidden=false;this.m_bMouseWheelZoomEnabled=true;this.m_bMapAlwaysFocused=false;this.bUserPickEnabled=true;this.iScrollMagicNumber=4;this.m_bCanLooseFocus=bCanLooseFocus==undefined?true:bCanLooseFocus;var m_bDrawTMC=false;var m_bDrawTMCWeather=false;this.arrTMCTextTable=[];var m_bDrawUTV=false;var m_arrUTVCameras=[];var m_dUTVMinX=0;var m_dUTVMinY=0;var m_dUTVMaxX=0;var m_dUTVMaxY=0;var m_bDrawPTStopsGlobal=false;var m_bDrawPTStopsLocal=false;var m_bDrawDailyNews=false;this.m_bDrawNORC=false;this.m_arrDrawnPois=new Array();this.strDefaultCountry="Magyarország";this.iMustVisibleMarkerSID=0;this.bZoomCalled=false;this.bInitPhase=true;this.arrPropertyChangedListeners=[];this.iLabelDesignVersion=2;this.strCopyrightText="";this.bLayerPoiRedrawNeeded=false;this.HandleAddress=null;var me=this;this.SetScrollMagicNumber=function(value){me.iScrollMagicNumber=value;}
this.EnableMouseWheelZoom=function()
{me.m_bMouseWheelZoomEnabled=true;}
this.DisableMouseWheelZoom=function()
{me.m_bMouseWheelZoomEnabled=false;}
this.SetMapAlwaysFocused=function()
{me.m_bCanLooseFocus=false;me.SetFocus();}
this.PageInitEnded=function()
{me.bInitPhase=false;}
this.SetCopyrightText=function(value)
{me.strCopyrightText=value;}
this.GetTMCState=function()
{if(me.arrTMCTextTable!=null&&me.arrTMCTextTable.length>0)
return me.arrTMCTextTable[0];return"";}
this.GetTMCStateExt=function()
{var ret=me.GetTMCState();if(m_bDrawTMC&&m_bDrawTMCWeather)
ret="B"+ret;else if(m_bDrawTMC&&!m_bDrawTMCWeather)
ret="T"+ret;else if(!m_bDrawTMC&&m_bDrawTMCWeather)
ret="W"+ret;return ret;}
this.Get_bDrawTMC=function()
{return m_bDrawTMC;}
this.Get_bDrawTMCWeather=function()
{return m_bDrawTMCWeather;}
this.GetTMCText=function(iIndex)
{if(me.arrTMCTextTable!=null)
{if(0<iIndex&&iIndex<me.arrTMCTextTable.length)
return me.arrTMCTextTable[iIndex];}
return"";}
this.SetFocus=function()
{if((me.bFocused==false))
{me.bFocused=true;me.VisualiseFocusState();}}
this.UnSetFocus=function()
{if((me.bFocused==true&&me.m_bCanLooseFocus))
{me.bFocused=false;me.VisualiseFocusState();}}
this.SetMoveMode=function()
{me.m_bRubberMode=false;me.m_bRubberDrawing=false;if(me.rubberDiv)
{if(me.rubberDiv.parentNode)
me.rubberDiv.parentNode.removeChild(me.rubberDiv);}
if(me.pMapPalette.ZoomRectImgButton!=null)
me.pMapPalette.ZoomRectImgButton.SetActive(false);if(me.pMapPalette.MoveModeImgButton!=null)
me.pMapPalette.MoveModeImgButton.SetActive(true);me.SetFocus();me.SetNormalCursor();}
this.SetZoomRectMode=function()
{me.m_bRubberMode=true;me.m_bRubberDrawing=false;if(me.pMapPalette.ZoomRectImgButton!=null)
me.pMapPalette.ZoomRectImgButton.SetActive(true);if(me.pMapPalette.MoveModeImgButton!=null)
me.pMapPalette.MoveModeImgButton.SetActive(false);me.SetFocus();me.SetNormalCursor();}
this.ScrollPageToMap=function()
{if(me.divMap!=null)
location.hash=me.divMap.id;}
this.VisualiseFocusState=function()
{if(me.strRole!="minimap")
{if(me.divFace!=null)
{if(me.bFocused==true)
{me.divFace.style.border="3px solid #999999";}
else
{me.divFace.style.border="3px double #CCCCCC";}}
me.SetNormalCursor();}}
this.AddDrawRouteCallbackListener=function(pFunction)
{var bExists=false;var i;for(i=0;i<me.arrDrawRouteCallbackListeners.length;i++)
{var pListenerFunc=me.arrDrawRouteCallbackListeners[i];if(pListenerFunc==pFunction)
{bExists=true;break;}}
if((bExists==false)&&(pFunction!=null))
me.arrDrawRouteCallbackListeners.push(pFunction);}
this.CallDrawRouteCallbackListeners=function()
{var i;for(i=0;i<me.arrDrawRouteCallbackListeners.length;i++)
{var pListenerFunc=me.arrDrawRouteCallbackListeners[i];if(pListenerFunc!=null)
pListenerFunc();}}
this.FillLevelInfo=function()
{m_arrLevelInfo=new Array();var i;for(i=0;i<g_RasterMapInfo.iLevels;i++)
{m_arrLevelInfo.push(g_RasterMapInfo.arrLevels[i].dPixelDensityXMeter);}}
this.Init=function()
{if(me.strRole=="mainmap")
{document.onkeypress=me.OnKeyDown;}
me.FillLevelInfo();me.pixeldensity=me.GetInitialPixelDensity();me.className="CTopoliszMap";me.InciServer=new CommandHandler(g_strHandlerUrl,me.strSessionID,g_strAppID,g_strLangID);me.InciServer.OnReadyStateChange=me.OnReadyStateChangeInternal;me.InciServer.OnCommandReady=me.OnCommandReadyInternal;me.InciServer.OnCommandError=me.OnCommandErrorInternal;me.NoSessionServer=new CommandHandler(g_strNoSessionHandlerUrl,me.strSessionID,g_strAppID,g_strLangID);me.NoSessionServer.OnReadyStateChange=me.OnReadyStateChangeInternal;me.NoSessionServer.OnCommandReady=me.OnCommandReadyInternal;me.NoSessionServer.OnCommandError=me.OnCommandErrorInternal;me.ReadSessionServer=new CommandHandler(g_strReadSessionHandlerUrl,me.strSessionID,g_strAppID,g_strLangID);me.ReadSessionServer.OnReadyStateChange=me.OnReadyStateChangeInternal;me.ReadSessionServer.OnCommandReady=me.OnCommandReadyInternal;me.ReadSessionServer.OnCommandError=me.OnCommandErrorInternal;if(me.divMap)
me.SetMapDiv(me.divMap);if(me.bHasMiniMap&&me.divMap)
{me.CreateZoomAnim();me.CreateToolTip();}
if(me.strRole!="minimap")
{me.CreateRatioMeter(false);me.CreateToolTip();if(me.strRole=="mainmap")
{m_bDrawTMC=false;m_bDrawTMCWeather=false;m_bDrawPTStopsGlobal=false;m_bDrawPTStopsLocal=false;}}
if(me.strRole=="minimap")
{m_bDrawPTStopsGlobal=false;m_bDrawPTStopsLocal=false;m_bDrawDailyNews=false;}
me.VisualiseFocusState();if(me.bMainMapMode)
{me.SetScrollEvents();}
if(me.OnCreate)
{try{me.OnCreate(me);}
catch(exp){if(me.OnError)
me.OnError(exp,'CTopoliszMap.OnCreate');}}
if(me.strRole=="minimap")
{me.divMap.style.border="2px solid Orange";}
me.CreateCopyrightLabel();}
this.InitGrid=function()
{if(!me.pConnectedMainMap)
{var toplogo=NewTag("img",me.divMap);toplogo.id=divMap.id+"toplogo";toplogo.className="toplogo";toplogo.src=GetAbsUrl("images/t.gif");toplogo.alt="Topolisz";if(g_strAppID.toLowerCase()=="trafficnav"){NewTag("br",me.divMap);var logo=NewTag("img",me.divMap);logo.id=divMap.id+"trafficnavlogo";logo.className="trafficnavlogo";logo.src=GetAbsUrl("images/buttonpalette/logo_trafficnav.png");logo.alt="TrafficNav";}}
else
me.bEnableMapCaption=false;if(me.pGridMain==null)
{me.pGridMain=new CMapGrid(0,0,me.iGridHeight-1,me.iGridWidth-1,me,0,0);var mgd=me.pGridMain.CreateGrid();me.graphics=new Graphics(mgd.id);}
if(me.pConnectedMiniMap)
me.pConnectedMiniMap.InitGrid();me.graphics=new Graphics(me.pGridMain.mainGridDiv.id);me.DistMeter=new DistanceMeter(me.graphics,0,0,me.pGridMain.mainGridDiv,me.pDistancePoly);}
this.CopyMarkersAndPois=function(baby)
{delete baby.pMarkers;baby.pMarkers=me.pMarkers.Clone();delete baby.arrPois;baby.arrPois=me.arrPois.slice(0);}
this.SetAsMiniMap=function(pConnectedMainMap)
{me.bMainMapMode=false;me.pConnectedMainMap=pConnectedMainMap;me.pConnectedMainMap.pConnectedMiniMap=me;me.pConnectedMainMap.divMap.appendChild(me.divMap);me.divMap.style.visibility="visible";me.iGridHeight=2;me.iGridWidth=2;me.SetBorderThickness(0);}
this.GetMapGridItemWidth=function()
{return me.iMapGridItemWidth;}
this.GetMapGridItemHeight=function()
{return me.iMapGridItemHeight;}
this.GetMapGridWidthInPixel=function()
{return me.iMapGridItemWidth*me.pGridMain.GetWidth();}
this.GetMapGridHeightInPixel=function()
{return me.iMapGridItemHeight*me.pGridMain.GetHeight();}
this.GetMapViewWidth=function()
{return me.iMapViewWidth;}
this.GetMapViewHeight=function()
{return me.iMapViewHeight;}
this.GetMapWidth=function()
{return me.iMapWidth;}
this.GetMapHeight=function()
{return me.iMapHeight;}
this.GetMapGridItem=function()
{var pGridItem=new CMapGridItem(me);AddTag(pGridItem.div,me.divMap);return pGridItem;}
this.GetSessionID=function()
{return me.strSessionID;}
this.SetSessionID=function(strSessionID)
{me.strSessionID=strSessionID;}
this.SetMouseUp=function(iUpX,iUpY)
{this.iMouseUpX=iUpX;this.iMouseUpY=iUpY;}
this.SetMouseDown=function(iDownX,iDownY)
{me.iMouseDownX=iDownX;me.iMouseDownY=iDownY;}
this.SetMouseMoveStart=function(iUpX,iUpY)
{this.iMouseMoveStartX=iUpX;this.iMouseMoveStartY=iUpY;}
this.SetMouseMoveEnd=function(iDownX,iDownY)
{me.iMouseMoveEndX=iDownX;me.iMouseMoveEndY=iDownY;}
this.GetMapDivWidth=function()
{return GetLayerWidth(me.divMap);}
this.GetMapDivHeight=function()
{return GetLayerHeight(me.divMap);}
this.IsInView=function(x,y)
{var mvw=me.GetMapViewWidth();var mvh=me.GetMapViewHeight();var mvvx=me.pGridMain.GetMapViewVectorX();var mvvy=me.pGridMain.GetMapViewVectorY();if((x>=mvvx)&&(x<=mvvx+mvw)&&(y>=mvvy)&&(y<=mvvy+mvh))
{return true;}
return false;}
this.WriteIntoStatusBar=function(strInput)
{var str=window.status+" "+strInput;var len=str.length;var from=Math.max(0,len-100);var to=len;window.status=str.substr(from,to);}
this.MoveMap=function()
{me.pGridMain.sMoveCallbackOn="true";var iMoveX=me.iMouseMoveEndX-me.iMouseMoveStartX;var iMoveY=me.iMouseMoveEndY-me.iMouseMoveStartY;var bItWasARealMove=me.MoveMapYX(iMoveY,iMoveX);me.bUserMovedByMouse=me.bUserMovedByMouse||bItWasARealMove;return bItWasARealMove;}
this.MoveMainMapInsteadOfMiniMap=function()
{if((me.pConnectedMainMap!=null))
{document.onselectstart=function(){return false;};me.pConnectedMainMap.pGridMain.sMoveCallbackOn="true";var miniMapLevel=me.GetLevel();var mainMapLevel=me.pConnectedMainMap.GetLevel();var miniMapPixelDensity=me.GetPixelDensity();var mainMapPixelDensity=me.GetPixelDensityFromLevel(mainMapLevel);var ratio=1/(mainMapPixelDensity/miniMapPixelDensity);var iMoveX=(me.iMouseMoveEndX-me.iMouseMoveStartX)*ratio;var iMoveY=(me.iMouseMoveEndY-me.iMouseMoveStartY)*ratio;var bItWasARealMove=me.pConnectedMainMap.MoveMapYX(iMoveY,iMoveX,"MoveMainMapInsteadOfMiniMap",true);me.pConnectedMainMap.bUserMovedByMouse=me.pConnectedMainMap.bUserMovedByMouse||bItWasARealMove;}}
this.MoveMapYX=function(iMoveY,iMoveX)
{me.HidePrintPreview();if(me.bUserMoving==false)
me.UserMovingStarted();me.bUserMoving=true;return me.pGridMain.Move(-iMoveY,-iMoveX);}
this.MoveMapYX_outer=function(iMoveY,iMoveX)
{me.HidePrintPreview();me.pGridMain.Move(-iMoveY,-iMoveX);me.bOuterMoving=true;}
this.MovedCallback=function()
{if(me.bDrawRouteHappening==false)
me.RearrangeLabels();else
{var types=["start","through","stop"];me.HidePinLabelsMulti(types);}
if(me.OnMapViewChanged)
{try{me.OnMapViewChanged();}
catch(exp)
{if(me.OnError)
me.OnError(exp,'OnMapViewChanged');}}
if(me.bUserMovedEndedFlag==true)
{me.bUserMovedEndedFlag=false;me.UserMovingEnded();}
if(me.bOuterMoving==true)
{me.OnStateChanged(me.pLastStateFromServer,me.iMovingSinceLastServerStateX,me.iMovingSinceLastServerStateY);me.bOuterMoving=false;}
if(me.bMainMapMode)
{me.MoveMiniMapSync();}
if(!me.bMainMapMode)
{me.MoveMainMapSync();}}
this.MoveMiniMapSync=function()
{if(me.bMiniMapVisible)
{var mainMapLevel=me.GetLevel();var miniMapLevel=me.pConnectedMiniMap.GetLevel();var mainMapPixelDensity=me.GetPixelDensity();var miniMapPixelDensity=me.GetPixelDensityFromLevel(miniMapLevel);var ratio=mainMapPixelDensity/miniMapPixelDensity;var iCol=(me.pGridMain.GetViewAbsoluteLeft()+(me.GetMapViewWidth())/2)*ratio-(me.pConnectedMiniMap.GetMapViewWidth())/2;var iRow=(me.pGridMain.GetViewAbsoluteTop()+(me.GetMapViewHeight())/2)*ratio-(me.pConnectedMiniMap.GetMapViewHeight())/2;me.pConnectedMiniMap.pGridMain.sMoveCallbackOn="rearrangeframe";me.pConnectedMiniMap.MoveMapTo(iRow,iCol);}}
this.MoveMainMapSync=function()
{if((me.pConnectedMainMap!=null))
{var miniMapLevel=me.GetLevel();var mainMapLevel=me.pConnectedMainMap.GetLevel();var miniMapPixelDensity=me.GetPixelDensity();var mainMapPixelDensity=me.GetPixelDensityFromLevel(mainMapLevel);var ratio=1/(mainMapPixelDensity/miniMapPixelDensity);var iCol=(me.pGridMain.GetViewAbsoluteLeft()+me.GetMapViewWidth()/2)*ratio-me.pConnectedMainMap.GetMapViewWidth()/2;var iRow=(me.pGridMain.GetViewAbsoluteTop()+me.GetMapViewHeight()/2)*ratio-me.pConnectedMainMap.GetMapViewHeight()/2;me.pConnectedMainMap.pGridMain.sMoveCallbackOn="false";me.pConnectedMainMap.MoveMapTo(iRow,iCol);}}
this.MoveMapTo=function(iRow,iCol)
{me.pGridMain.MoveTo(iRow,iCol);}
this.ZoomToCenter=function(iTop,iLeft,N)
{var MVW=me.GetMapViewWidth();var MVH=me.GetMapViewHeight();var newLevel=me.GetLevel()+N;if(newLevel>me.GetMaximumLevel())
newLevel=me.GetMaximumLevel();var oldPixelDensity=me.GetPixelDensity();var newPixelDensity=me.GetPixelDensityFromLevel(newLevel);var beforeAbsY=me.pGridMain.GetViewAbsoluteTop()+iTop;var beforeAbsX=me.pGridMain.GetViewAbsoluteLeft()+iLeft;var afterAbsY=oldPixelDensity/newPixelDensity*beforeAbsY;var afterAbsX=oldPixelDensity/newPixelDensity*beforeAbsX;var AbsX=afterAbsX-MVW/2;var AbsY=afterAbsY-MVH/2;var PixDen=me.GetPixelDensityFromLevel(newLevel);me.pGridMain.RemoveZoomPreview();var PreviewZoomPosX=MVW/2;var PreviewZoomPosY=MVH/2;if(me.GetMapViewWidth()>me.GetActiveWidthFromLevel(newLevel))
PreviewZoomPosX=me.GetMapViewWidth()/2;if(me.GetMapViewHeight()>me.GetActiveHeightFromLevel(newLevel))
PreviewZoomPosY=me.GetMapViewHeight()/2;var PreviewMoveX=iLeft-MVW/2;var PreviewMoveY=iTop-MVH/2;if(me.bPreviewIsOn)
me.pGridMain.ZoomPreview(oldPixelDensity/newPixelDensity,PreviewZoomPosX,PreviewZoomPosY,-PreviewMoveX,-PreviewMoveY);me.ZoomMap(PixDen,AbsX,AbsY,0,0);}
this.ValidateEventSource=function(pEvent)
{for(var src=GetEventSourceElement(pEvent).parentNode;src!=null;src=src.parentNode)
{if(src==me.divPoiParent)
return false;if(src==me.divMap)
return true;if(src.nodeName.toLowerCase()=="body")
return true;}
return true;}
this.OnMapClick=function(pEvent)
{var xxx=GetEventXNew(pEvent)-GetAbsLayerLeft(me.pGridMain.mainGridDiv);var yyy=GetEventYNew(pEvent)-GetAbsLayerTop(me.pGridMain.mainGridDiv);var obj=GetEventSourceElement(pEvent);var pPoiMouseOver=me.GetPoiNearXY(xxx,yyy);if(pPoiMouseOver!=null)
{if((obj.className=="face")||(obj.className=="poiParent"))
me.OnMouseClickLayerPoi(pPoiMouseOver);}
var pPinMouseOver=me.pMarkers.GetPinNearXY(xxx,yyy);if(pPinMouseOver!=null)
{if((obj.className=="face")||(obj.className=="poiParent"))
pPinMouseOver.OnLabelSignClick();}
return false;}
this.OnMapDblClick=function(pEvent)
{if(!me.ValidateEventSource(pEvent))
return true;if(me.bMainMapMode==true)
{if(me.bDistanceMeasuring==true)
{me.OnOffMeasureDistance();}
else
{}}}
this.OnMouseDown=function(pEvent)
{return me.OnMouseDownFunc(pEvent);}
this.OnMouseDownFunc=function(pEvent)
{var srcCheck=me.ValidateEventSource(pEvent);if(me.bFocused==false)
{me.SetFocus();me.m_bPickingForbidden=true;}
else
{me.m_bPickingForbidden=false;}
if(globalDivFlash!=null)
{globalDivFlash.style.display="none";globalDivFlash.parentNode.style.border="3px solid Orange";}
var xx=GetEventXNew(pEvent)-GetAbsLayerLeft(me.pGridMain.mainGridDiv);var yy=GetEventYNew(pEvent)-GetAbsLayerTop(me.pGridMain.mainGridDiv);if(me.BeforeMouseDown)
{me.BeforeMouseDown(pEvent,xx,yy);}
if(me.bExternalMouseHandling)
{if(me.OnMouseDownExternal)
me.OnMouseDownExternal(pEvent,xx,yy);}
else
{if(!me.bExternalMouseHandling&&me.bDistanceMeasuring)
{if(me.bDrawDistMeasureHappening==false)
{me.DrawDistMeasure(xx,yy);}
return false;}
var realRubberMode=me.m_bRubberMode;if(IsRightClick(pEvent)==true)
{if(realRubberMode==true)
realRubberMode=false;else
realRubberMode=true;me.m_bZoomRectVsMoveModeInverted=true;}
else
me.m_bZoomRectVsMoveModeInverted=false;me.SetNormalCursor();var x=GetEventXNew(pEvent)-GetAbsLayerLeft(me.divFace);var y=GetEventYNew(pEvent)-GetAbsLayerTop(me.divFace);if(!me.bExternalMouseHandling&&(realRubberMode==true)&&(me.m_bRubberDrawing==false))
{me.rubberDiv=NewTag("div",me.divFace);me.rubberDiv.style.position="absolute";me.rubberDiv.style.border="2px solid Red";me.rubberDiv.style.height="0px";me.rubberDiv.style.width="0px";me.rubberDiv.style.top=GetEventYNew(pEvent)-GetAbsLayerTop(me.divFace)-8+"px";me.rubberDiv.style.left=GetEventXNew(pEvent)-GetAbsLayerLeft(me.divFace)-8+"px";me.rubberDivBottom=me.rubberDivTop=GetEventYNew(pEvent)-GetAbsLayerTop(me.divFace)-8;me.rubberDivRight=me.rubberDivLeft=GetEventXNew(pEvent)-GetAbsLayerLeft(me.divFace)-8;me.rubberDiv.onmouseup=function(){g_TopoliszPageData.SetActiveMap(me);me.SetFocus();};me.m_bRubberDrawing=true;}
{me.bPickMode=true;me.bMouseDown=true;me.SetMouseDown(x,y);StopEventPropagation(pEvent);return false;}}
StopEventPropagation(pEvent);return false;}
this.bMouseWheelEnabled=true;this.OnMouseWheel=function(pEvent)
{if(!me.m_bMouseWheelZoomEnabled)
return;try
{var delta=WheelEventCalculateDelta(pEvent);var pMap=g_TopoliszPageData.GetActiveMap();if((pMap!=null)&&(pMap.bFocused==true))
{if((pMap!=null))
{if(pMap.bMainMapMode)
{if(pMap.bWheeling==false)
{pMap.bWheeling=true;setTimeout(pMap.WheelZoom,30);}
pMap.iWheelingDeltaSum+=delta;StopEventPropagation(pEvent);return false;}}
else
{me.bMouseWheelEnabled=false;}}
else
{var pPrevActMap=g_TopoliszPageData.GetPreviousNotActiveMap();if(pPrevActMap!=null)
pPrevActMap.UnSetFocus();}
return true;}
catch(e)
{}}
this.WheelZoom=function()
{if(globalDivFlash!=null)
{globalDivFlash.style.display="none";globalDivFlash.parentNode.style.border="3px solid Orange";}
me.pZoomSrc=me.className;var iTick=me.iWheelingDeltaSum/me.iScrollMagicNumber;var iAbsTick=Math.abs(iTick);var iSign=iTick/iAbsTick;var iRoundAbsTick=Math.round(iAbsTick);var iDiffLevel=iRoundAbsTick*iSign;me.ZoomByLevel(iDiffLevel);me.bWheeling=false;me.iWheelingDeltaSum=0;}
this.UserMovingStarted=function()
{}
this.UserMovingEnded=function()
{me.bUserMoving=false;var dMinX=me.pGridMain.dWgsLowerLeftX;var dMinY=me.pGridMain.dWgsLowerLeftY;var dMaxX=me.pGridMain.dWgsUpperRightX;var dMaxY=me.pGridMain.dWgsUpperRightY;var Params="";Params+='dMinX='+dMinX;Params+='&dMinY='+dMinY;Params+='&dMaxX='+dMaxX;Params+='&dMaxY='+dMaxY;me.NoSessionServer.CallFunction("MapRectToSettlement",Params,0,me.MapRectToSettlementCallback);}
this.MapRectToSettlementCallback=function(caption)
{me.ShowMapCaption(caption);me.OnStateChanged(me.pLastStateFromServer,me.iMovingSinceLastServerStateX,me.iMovingSinceLastServerStateY,caption);}
this.OnMouseUp=function(pEvent)
{return me.OnMouseUpFunc(pEvent);}
this.OnMouseUpFunc=function(pEvent)
{var srcCheck=me.ValidateEventSource(pEvent);var xx=GetEventXNew(pEvent)-GetAbsLayerLeft(me.pGridMain.mainGridDiv);var yy=GetEventYNew(pEvent)-GetAbsLayerTop(me.pGridMain.mainGridDiv);if(me.BeforeMouseUp)
me.BeforeMouseUp(pEvent,xx,yy);if(me.bExternalMouseHandling)
{if(me.OnMouseUpExternal)
me.OnMouseUpExternal(pEvent,xx,yy);}
else
{me.m_bZoomRectVsMoveModeInverted=false;me.SetNormalCursor();if(me.m_bRubberDrawing==true)
{me.rubberDiv.parentNode.removeChild(me.rubberDiv);me.m_bRubberDrawing=false;var mapwidth=me.GetMapDivWidth();var mapheight=me.GetMapDivHeight();var rubberwidth=Math.abs(me.rubberDivRight-me.rubberDivLeft);var rubberheight=Math.abs(me.rubberDivBottom-me.rubberDivTop);if((rubberwidth>10)&&(rubberheight>10))
{var Z1=mapwidth/rubberwidth;var Z2=mapheight/rubberheight;var Z3=Math.min(Z1,Z2);var Z4=Math.log(Z3)/Math.log(2);Z=Math.round(Z4);if(me.GetLevel()!=me.GetMaximumLevel())
{me.ZoomToCenter((me.rubberDivTop+me.rubberDivBottom)/2,(me.rubberDivLeft+me.rubberDivRight)/2,Z);}}}
if(me.bFrameMouseDown)
{me.pMiniMapFrame.divSecFrame.style.visibility="hidden";me.pMiniMapFrame.divSecFrameFill.style.visibility="hidden";me.bFrameMouseDown=false;var x=GetEventXNew(pEvent);var y=GetEventYNew(pEvent);var iMoveX=-(x-me.iFrameMouseStartX);var iMoveY=-(y-me.iFrameMouseStartY);if((iMoveX!=0)||(iMoveY!=0))
{var miniMapLevel=me.GetLevel();var mainMapLevel=me.pConnectedMainMap.GetLevel();var miniMapPixelDensity=me.GetPixelDensity();var mainMapPixelDensity=me.GetPixelDensityFromLevel(mainMapLevel);var ratio=1/(mainMapPixelDensity/miniMapPixelDensity);me.pConnectedMainMap.pGridMain.sMoveCallbackOn="true";me.pConnectedMainMap.bUserMovedEndedFlag=true;me.pConnectedMainMap.MoveMapYX(Math.floor(iMoveY*ratio),Math.floor(iMoveX*ratio));}}
else if(me.bMouseDown==true)
{{var x=GetEventXNew(pEvent)-GetAbsLayerLeft(me.divFace);var y=GetEventYNew(pEvent)-GetAbsLayerTop(me.divFace);me.SetMouseUp(x,y);var bSamePlaceUpAndDown=false;if((me.iMouseUpX==me.iMouseDownX)&&(me.iMouseUpY==me.iMouseDownY))
bSamePlaceUpAndDown=true;me.bMouseDown=false;if(bSamePlaceUpAndDown&&!me.pConnectedMainMap&&(me.m_bPickingForbidden==false))
{if(srcCheck==true)
{if((me.pMouseOverLayerPoi==null)&&(me.pMouseOverPin==null))
me.UserPicked(pEvent);}
else
{return true;}}
else
{if(me.bUserMovedByMouse==true)
{if(me.pGridMain.AllowMove==true)
{me.bUserMovedByMouse=false;me.UserMovingEnded();}
else
{me.bUserMovedEndedFlag=true;}}}}}}
return false;}
this.OnMouseMoveOnDocument=function(pEvent)
{try
{var pActMap=g_TopoliszPageData.GetActiveMap();if(g_TopoliszPageData.GetActiveMap()==me)
{me.OnMouseMove(pEvent);}
me.OnMouseMoveOnDocumentHandler(pEvent);}
catch(e)
{}}
this.OnMouseMoveOnDocumentHandler=function(pEvent)
{if(me.pMapPalette)
{var div=me.pMapPalette.pSlider.slider;var l=GetAbsLayerLeft(div);var t=GetAbsLayerTop(div);var r=l+GetLayerWidth(div);var b=t+GetLayerHeight(div);var x=GetEventXNew(pEvent);var y=GetEventYNew(pEvent);if((l<=x)&&(x<=r)&&(y<=b-3)&&(t+3<=y))
{if(me.bCursorOnMapPalette==false)
{me.pMapPalette.SliderOnMouseOver();me.bCursorOnMapPalette=true;}}else if(me.bCursorOnMapPalette==true)
{me.pMapPalette.SliderOnMouseOut();me.bCursorOnMapPalette=false;}}}
this.OnMouseUpOnDocument=function(pEvent)
{try
{if((g_TopoliszPageData.GetActiveMap()==me)||(me.m_bRubberDrawing))
{me.OnMouseUp(pEvent);}
else
{me.UnSetFocus();}}
catch(e)
{}}
this.OnMouseMove=function(pEvent)
{try
{me.bMouseWheelEnabled=true;me.bMouseOverMapView=true;me.bPickMode=false;var xx=GetEventXNew(pEvent)-GetAbsLayerLeft(me.pGridMain.mainGridDiv);var yy=GetEventYNew(pEvent)-GetAbsLayerTop(me.pGridMain.mainGridDiv);if(me.BeforeMouseMove)
me.BeforeMouseMove(pEvent,xx,yy);if(me.bExternalMouseHandling)
{if(me.OnMouseMoveExternal)
me.OnMouseMoveExternal(pEvent,xx,yy)}
else
{if(me.m_bRubberDrawing==true)
{var top=me.rubberDivTop;var left=me.rubberDivLeft;var bottom=GetEventYNew(pEvent)-GetAbsLayerTop(me.divFace)
var right=GetEventXNew(pEvent)-GetAbsLayerLeft(me.divFace);var temp=0;me.rubberDivBottom=bottom;me.rubberDivTop=top;me.rubberDivLeft=left;me.rubberDivRight=right;if(top>bottom){temp=bottom;bottom=top;top=temp;}
if(left>right){temp=right;right=left;left=temp;}
me.rubberDiv.style.top=top+"px";me.rubberDiv.style.left=left+"px";me.rubberDiv.style.height=bottom-top-5+"px";me.rubberDiv.style.width=right-left-5+"px";}
else if(me.bDistanceMeasuring)
{if(me.bDrawDistMeasureHappening==false)
{me.DistMeter.MoveDistCursor(xx,yy);}}
me.OnMouseMoveFunc(pEvent);}
StopEventPropagation(pEvent);}
catch(e)
{}
return false;}
this.OnMouseMoveFunc=function(pEvent)
{var obj=GetEventSourceElement(pEvent);var xxx=GetLayerX(pEvent);var yyy=GetLayerY(pEvent);if(me.bFrameMouseDown)
{var obj=GetEventSourceElement(pEvent);var ty1=GetLayerTop(me.pMiniMapFrame.divFrame);var ty2=GetLayerTop(me.pMiniMapFrame.divSecFrame);if(obj.className=="minimapframe")
{xxx+=GetLayerLeft(me.pMiniMapFrame.divFrame);yyy+=GetLayerTop(me.pMiniMapFrame.divFrame);}
else if(obj.className=="minimapsecframe")
{xxx+=GetLayerLeft(me.pMiniMapFrame.divSecFrame);yyy+=GetLayerTop(me.pMiniMapFrame.divSecFrame);}
var LT=GetAbsLayerTop(me.pMiniMapFrame.divSecFrame)-GetAbsLayerTop(me.divFace);var LL=GetAbsLayerLeft(me.pMiniMapFrame.divSecFrame)-GetAbsLayerLeft(me.divFace);var NewLeft=(LL+xxx-me.iFrameMouseX);var NewTop=(LT+yyy-me.iFrameMouseY);var border=-3;if(BrowserDetect.browser=="Firefox")
border=3;me.pMiniMapFrame.divSecFrame.style.left=NewLeft+border+"px";me.pMiniMapFrame.divSecFrame.style.top=NewTop+border+"px";me.pMiniMapFrame.divSecFrameFill.style.left=NewLeft+border+"px";me.pMiniMapFrame.divSecFrameFill.style.top=NewTop+border+"px";me.iFrameMouseX=xxx;me.iFrameMouseY=yyy;}
else if(g_TopoliszPageData.GetActiveMap()==me)
{var xx=GetEventXNew(pEvent)-GetAbsLayerLeft(me.divFace);var yy=GetEventYNew(pEvent)-GetAbsLayerTop(me.divFace);me.iMousePosX=xx;me.iMousePosY=yy;me.SetMouseMoveEnd(xx,yy);if(me.m_bRubberDrawing==false)
{if(me.bMouseDown)
{if((me.bHasMiniMap)||(me.pConnectedMainMap==null))
me.MoveMap();else
{me.MoveMainMapInsteadOfMiniMap();}}
else
{if
(((me.iMousePosY>0)&&(me.iMousePosX>0)&&(me.iMousePosY<me.GetMapViewHeight())&&(me.iMousePosX<me.GetMapViewWidth()))&&((me.iMousePosY<me.iAutoScrollMargin)||(me.iMousePosX<me.iAutoScrollMargin)||(me.iMousePosY>me.GetMapViewHeight()-me.iAutoScrollMargin)||(me.iMousePosX>me.GetMapViewWidth()-me.iAutoScrollMargin)))
{if(me.bAutoScrolling==false)
{me.AutoMoveLimit=me.AutoMoveLimitStartValue;window.setTimeout(me.AutoScroll,500);}}
var xxx=GetEventXNew(pEvent)-GetAbsLayerLeft(me.pGridMain.mainGridDiv);var yyy=GetEventYNew(pEvent)-GetAbsLayerTop(me.pGridMain.mainGridDiv);var pPin=me.pMarkers.GetPinNearXY(xxx,yyy);if((obj.className=="face")||(obj.className=="poiParent"))
{if((pPin!=null)&&(pPin!=me.pMouseOverPin))
{me.pMouseOverPin=pPin;me.pLastMouseOverPin=pPin;if(pPin.bLongMouseOver==false)
pPin.OnLabelSignMouseOver();else if(me.bMouseLongOverTimingEnabled)
{me.bMouseLongOverTimingEnabled=false;setTimeout(me.OnMouseLongOverTimer,500);}}}
var evX=GetEventXNew(pEvent);var evY=GetEventYNew(pEvent);var limitpix=me.pMarkers.GetMouseOutDistance();var sqlimitpix=limitpix*limitpix;var idx;for(idx=0;idx<me.pMarkers.arrMarkers.length;idx++)
{var pM=me.pMarkers.arrMarkers[idx];if(pM!=null)
{var cond1=false;if(pM.IsSignless())
{if(((pM.iPixX-xxx)*(pM.iPixX-xxx))+((pM.iPixY-yyy)*(pM.iPixY-yyy))>sqlimitpix)
{cond1=true;if(pM==me.pMouseOverPin)
me.pMouseOverPin=null;}}
else
{var w=pM.GetProperty("pin_img_width");var h=pM.GetProperty("pin_img_height");var rx=pM.GetProperty("pin_img_refx");var ry=pM.GetProperty("pin_img_refy");var mar=10;if((xxx>pM.iPixX+w-rx+mar)||(xxx<pM.iPixX-rx-mar)||(yyy>pM.iPixY+h-ry+mar)||(yyy<pM.iPixY-ry-mar))
{cond1=true;if(pM==me.pMouseOverPin)
me.pMouseOverPin=null;}}
if(pM.IsLabelBoxVisible())
{var cond2=false;if(pM.pLabel!=null)
{var iMargin=5;var l=GetAbsLayerLeft(pM.pLabel.divLabelBox2)-iMargin;var r=GetAbsLayerRight(pM.pLabel.divLabelBox2)+iMargin;var t=GetAbsLayerTop(pM.pLabel.divLabelBox2)-iMargin;var b=GetAbsLayerBottom(pM.pLabel.divLabelBox2)+iMargin;if((evX<l)||(evX>r)||(evY<t)||(evY>b))
{cond2=true;}}
if(cond1&&cond2)
{me.OnLabelSignMouseOut(pM);}}}}}}
me.SetMouseMoveStart(xx,yy);}}
this.OnMouseLongOverTimer=function()
{if(me.pMouseOverPin!=null)
me.pMouseOverPin.OnLabelSignMouseOver();me.bMouseLongOverTimingEnabled=true;}
this.AutoScroll=function()
{me.AutoScrollDY=0;me.AutoScrollDX=0;if(me.bAutoScrollEnabled&&me.bMouseOverMapView)
{if
(((me.iMousePosY>0)&&(me.iMousePosX>0)&&(me.iMousePosY<me.GetMapViewHeight())&&(me.iMousePosX<me.GetMapViewWidth()))&&((me.iMousePosY<me.iAutoScrollMargin)||(me.iMousePosX<me.iAutoScrollMargin)||(me.iMousePosY>me.GetMapViewHeight()-me.iAutoScrollMargin)||(me.iMousePosX>me.GetMapViewWidth()-me.iAutoScrollMargin)))
{var VY=me.iMousePosY-me.GetMapViewHeight()/2;var VX=me.iMousePosX-me.GetMapViewWidth()/2;var L=Math.sqrt(VY*VY+VX*VX);VY=VY/L*6;VX=VX/L*6;if((me.iMousePosY<me.iAutoScrollMargin/2)||(me.iMousePosX<me.iAutoScrollMargin/2)||(me.iMousePosY>me.GetMapViewHeight()-me.iAutoScrollMargin/2)||(me.iMousePosX>me.GetMapViewWidth()-me.iAutoScrollMargin/2))
{VY*=2;VX*=2;}
me.AutoScrollDX=-VX;me.AutoScrollDY=-VY;}
if(((me.AutoScrollDY!=0)||(me.AutoScrollDX!=0))&&(me.AutoMoveLimit>0))
{me.pGridMain.sMoveCallbackOn="true";me.AutoMoveLimit-=Math.sqrt(me.AutoScrollDY*me.AutoScrollDY+Math.round(me.AutoScrollDX)*Math.round(me.AutoScrollDX));me.MoveMapYX(Math.round(me.AutoScrollDY),Math.round(me.AutoScrollDX));me.bAutoScrolling=true;window.setTimeout(me.AutoScroll,100);}
else if(me.bAutoScrolling)
{me.bAutoScrolling=false;me.UserMovingEnded();}}}
this.OnMouseOver=function(pEvent)
{try
{var pActMap=g_TopoliszPageData.GetActiveMap();if(pActMap==null)
g_TopoliszPageData.SetActiveMap(me);else if(pActMap.bMouseDown==false)
g_TopoliszPageData.SetActiveMap(me);}
catch(e)
{}}
this.OnMouseOut=function(pEvent)
{try
{if((pEvent==undefined)||(pEvent==null))
pEvent=window.event;var relTarg=pEvent.relatedTarget||pEvent.toElement;if(relTarg.className!="face"&&relTarg.className!="poiParent"&&relTarg.className!="anim_main"&&relTarg.className!="anim_br"&&relTarg.className!="anim_bl"&&relTarg.className!="anim_tr"&&relTarg.className!="anim_tl")
{var pActMap=g_TopoliszPageData.GetActiveMap();if((pActMap==me)&&(pActMap.bMouseDown==false))
{g_TopoliszPageData.SetActiveMap(null);me.bMouseOverMapView=false;var AutoScrollFinishedByMouseOut=false;if(me.bAutoScrolling)
{me.bAutoScrolling=false;AutoScrollFinishedByMouseOut=true;}
if((me.bUserMovedByMouse==true)||(AutoScrollFinishedByMouseOut==true))
{if(me.pGridMain.AllowMove==true)
{me.bUserMovedByMouse=false;me.UserMovingEnded();}
else
{me.bUserMovedEndedFlag=true;}}}}}
catch(e)
{}}
this.GetMapDiv=function()
{return me.divMap;}
this.SetMouseEvents=function()
{if(me.bMouseEventsAreSet==false)
{me.divFace.onclick=me.OnMapClick;me.divFace.ondblclick=me.OnMapDblClick;me.divFace.onmousedown=me.OnMouseDown;if(window.addEventListener)
{document.addEventListener('mousemove',me.OnMouseMoveOnDocument,false);}
else
{document.attachEvent('onmousemove',me.OnMouseMoveOnDocument,false);}
if(window.addEventListener)
{window.addEventListener('mouseup',me.OnMouseUpOnDocument,false);}
else
{document.attachEvent('onmouseup',me.OnMouseUpOnDocument,false);}
me.divFace.onmouseout=me.OnMouseOut;me.divFace.onmouseover=me.OnMouseOver;me.bMouseEventsAreSet=true;}}
this.SetMapDiv=function(divMap)
{me.divMap=divMap;if(divMap.className=="")
divMap.className="map";divMap.style.overflow="hidden";var clipLeft=GetLayerLeft(divMap);var clipTop=GetLayerTop(divMap);var clipRight=clipLeft+GetLayerWidth(divMap);var clipBottom=clipTop+GetLayerHeight(divMap);this.iMapViewWidth=clipRight-clipLeft-me.iMapDivBorderWidth;this.iMapViewHeight=clipBottom-clipTop-me.iMapDivBorderWidth;me.divFace=NewTag("div",me.divMap);me.divFace.id=divMap.id+"face";me.divFace.className="face";me.divFace.style.width=Math.max(0,(GetLayerWidth(divMap)-2*me.iMapDivBorderWidth))+"px";me.divFace.style.height=Math.max(0,(GetLayerHeight(divMap)-2*me.iMapDivBorderWidth))+"px";me.divFace.style.cursor="pointer";me.divPrintPreview=NewTag('div',me.divFace);me.divPrintPreview.className="printPreview";me.divPrintPreview.style.width=me.iMapWidth;me.divPrintPreview.style.height=me.iMapHeight;me.divPoiParent=NewTag('div',me.divFace);me.divPoiParent.className="poiParent";me.divPoiParent.style.width=me.iMapWidth;me.divPoiParent.style.height=me.iMapHeight;me.divPoiParent.style.top="0px";me.divPoiParent.style.left="0px";me.SetMouseEvents();}
this.GetMapPinLabelTopMargin=function()
{var margin=0;if(me.strRole=="mainmap")
{var divButtonPalette=GetBlock("idMapButtonPalette");if(divButtonPalette!=null)
margin=GetLayerBottom(divButtonPalette);}
return margin;}
this.CreateFaceBorder=function()
{var BorderOpacity=10;setAlpha(".faceborder");me.divFaceBorderTop=NewTag("div",me.divMap);me.divFaceBorderTop.className="faceborder";me.divFaceBorderTop.style.width=Math.max(0,GetLayerWidth(divMap)-2*me.iMapDivBorderWidth)+"px";me.divFaceBorderTop.style.height=me.iAutoScrollMargin+"px";me.divFaceBorderTop.style.top=0+"px";SetOpac(me.divFaceBorderTop,BorderOpacity);me.divFaceBorderTop.style.visibility="hidden";me.imgFaceBorderTop=NewTag("img",me.divMap);me.imgFaceBorderTop.className="faceborder";me.imgFaceBorderTop.style.left=Math.max(0,(GetLayerWidth(divMap)-2*me.iMapDivBorderWidth-9)/2)+"px";me.imgFaceBorderTop.style.top=0+"px";me.imgFaceBorderTop.style.visibility="hidden";SetImage(me.imgFaceBorderTop,GetAbsUrl('images/mapctrl/faceborder_top.png'),9,9,"");me.divFaceBorderBottom=NewTag("div",me.divMap);me.divFaceBorderBottom.className="faceborder";me.divFaceBorderBottom.style.width=Math.max(0,GetLayerWidth(divMap)-2*me.iMapDivBorderWidth)+"px";me.divFaceBorderBottom.style.height=me.iAutoScrollMargin+"px";me.divFaceBorderBottom.style.bottom=0+"px";SetOpac(me.divFaceBorderBottom,BorderOpacity);me.divFaceBorderBottom.style.visibility="hidden";me.imgFaceBorderBottom=NewTag("img",me.divMap);me.imgFaceBorderBottom.className="faceborder";me.imgFaceBorderBottom.style.left=Math.max(0,(GetLayerWidth(divMap)-2*me.iMapDivBorderWidth-9)/2)+"px";me.imgFaceBorderBottom.style.bottom=0+"px";me.imgFaceBorderBottom.style.visibility="hidden";SetImage(me.imgFaceBorderBottom,GetAbsUrl('images/mapctrl/faceborder_bottom.png'),9,9,"");me.divFaceBorderLeft=NewTag("div",me.divMap);me.divFaceBorderLeft.className="faceborder";me.divFaceBorderLeft.style.width=me.iAutoScrollMargin+"px";me.divFaceBorderLeft.style.height=Math.max(0,GetLayerHeight(divMap)-2*me.iMapDivBorderWidth-2*me.iAutoScrollMargin)+"px";me.divFaceBorderLeft.style.top=me.iAutoScrollMargin+"px";me.divFaceBorderLeft.style.left=0+"px";SetOpac(me.divFaceBorderLeft,BorderOpacity);me.divFaceBorderLeft.style.visibility="hidden";me.imgFaceBorderLeft=NewTag("img",me.divMap);me.imgFaceBorderLeft.className="faceborder";me.imgFaceBorderLeft.style.left=0+"px";me.imgFaceBorderLeft.style.top=Math.max(0,(GetLayerHeight(divMap)-2*me.iMapDivBorderWidth-2*me.iAutoScrollMargin+9)/2)+"px";me.imgFaceBorderLeft.style.visibility="hidden";SetImage(me.imgFaceBorderLeft,GetAbsUrl('images/mapctrl/faceborder_left.png'),9,9,"");me.divFaceBorderRight=NewTag("div",me.divMap);me.divFaceBorderRight.className="faceborder";me.divFaceBorderRight.style.width=me.iAutoScrollMargin+"px";me.divFaceBorderRight.style.height=Math.max(0,GetLayerHeight(divMap)-2*me.iMapDivBorderWidth-2*me.iAutoScrollMargin)+"px";me.divFaceBorderRight.style.top=me.iAutoScrollMargin+"px";me.divFaceBorderRight.style.right=0+"px";me.divFaceBorderRight.style.visibility="hidden";SetOpac(me.divFaceBorderRight,BorderOpacity);me.imgFaceBorderRight=NewTag("img",me.divMap);me.imgFaceBorderRight.className="faceborder";me.imgFaceBorderRight.style.right=0+"px";me.imgFaceBorderRight.style.top=Math.max(0,(GetLayerHeight(divMap)-2*me.iMapDivBorderWidth-2*me.iAutoScrollMargin+9)/2)+"px";me.imgFaceBorderRight.style.visibility="hidden";SetImage(me.imgFaceBorderRight,GetAbsUrl('images/mapctrl/faceborder_right.png'),9,9,"");}
this.GetPoiParentDiv=function()
{return me.divPoiParent;}
this.RearrangeFaceBorder=function()
{if(me.divFaceBorderTop)
{me.divFaceBorderTop.style.width=Math.max(0,GetLayerWidth(divMap)-2*me.iMapDivBorderWidth)+"px";me.divFaceBorderTop.style.height=me.iAutoScrollMargin+"px";me.divFaceBorderTop.style.top=0+"px";me.imgFaceBorderTop.style.left=Math.max(0,(GetLayerWidth(divMap)-2*me.iMapDivBorderWidth-9)/2)+"px";me.divFaceBorderBottom.style.width=Math.max(0,GetLayerWidth(divMap)-2*me.iMapDivBorderWidth)+"px";me.divFaceBorderBottom.style.height=me.iAutoScrollMargin+"px";me.divFaceBorderBottom.style.bottom=0+"px";me.imgFaceBorderBottom.style.left=Math.max(0,(GetLayerWidth(divMap)-2*me.iMapDivBorderWidth-9)/2)+"px";me.divFaceBorderLeft.style.width=me.iAutoScrollMargin+"px";me.divFaceBorderLeft.style.height=Math.max(0,GetLayerHeight(divMap)-2*me.iMapDivBorderWidth-2*me.iAutoScrollMargin)+"px";me.divFaceBorderLeft.style.top=me.iAutoScrollMargin+"px";me.divFaceBorderLeft.style.left=0+"px";me.imgFaceBorderLeft.style.top=Math.max(0,(GetLayerHeight(divMap)-2*me.iMapDivBorderWidth-2*me.iAutoScrollMargin+9)/2)+"px";me.divFaceBorderRight.style.width=me.iAutoScrollMargin+"px";me.divFaceBorderRight.style.height=Math.max(0,GetLayerHeight(divMap)-2*me.iMapDivBorderWidth-2*me.iAutoScrollMargin)+"px";me.divFaceBorderRight.style.top=me.iAutoScrollMargin+"px";me.divFaceBorderRight.style.right=0+"px";me.imgFaceBorderRight.style.top=Math.max(0,(GetLayerHeight(divMap)-2*me.iMapDivBorderWidth-2*me.iAutoScrollMargin+9)/2)+"px";}}
this.SetVisibilityBorders=function(bVisibilityHorizontal,bVisibilityVertical)
{if(me.iAutoScrollMargin<=0)
{bVisibilityHorizontal=false;bVisibilityVertical=false;}
if(!me.bDistanceMeasuring)
{bVisibilityHorizontal=false;bVisibilityVertical=false;}
if((bVisibilityHorizontal)&&(bVisibilityVertical))
{if(!me.divFacBorderLeft)
me.CreateFaceBorder();me.divFaceBorderLeft.style.top=me.iAutoScrollMargin+"px";me.divFaceBorderLeft.style.height=Math.max(0,GetLayerHeight(me.divMap)-2*me.iMapDivBorderWidth-2*me.iAutoScrollMargin)+"px";me.divFaceBorderRight.style.top=me.iAutoScrollMargin+"px";me.divFaceBorderRight.style.height=Math.max(0,GetLayerHeight(me.divMap)-2*me.iMapDivBorderWidth-2*me.iAutoScrollMargin)+"px";me.divFaceBorderTop.style.visibility="visible";me.divFaceBorderBottom.style.visibility="visible";me.divFaceBorderLeft.style.visibility="visible";me.divFaceBorderRight.style.visibility="visible";me.imgFaceBorderTop.style.visibility="visible";me.imgFaceBorderBottom.style.visibility="visible";me.imgFaceBorderLeft.style.visibility="visible";me.imgFaceBorderRight.style.visibility="visible";}
else if((!bVisibilityHorizontal)&&(!bVisibilityVertical))
{if(me.divFaceBorderBottom)
{me.divFaceBorderTop.style.visibility="hidden";me.divFaceBorderBottom.style.visibility="hidden";me.divFaceBorderLeft.style.visibility="hidden";me.divFaceBorderRight.style.visibility="hidden";me.imgFaceBorderTop.style.visibility="hidden";me.imgFaceBorderBottom.style.visibility="hidden";me.imgFaceBorderLeft.style.visibility="hidden";me.imgFaceBorderRight.style.visibility="hidden";}}
else if((bVisibilityHorizontal)&&(!bVisibilityVertical))
{if(!me.divFaceBorderLeft)
me.CreateFaceBorder();me.divFaceBorderLeft.style.top="0px";me.divFaceBorderLeft.style.height=Math.max(0,GetLayerHeight(me.divMap)-2*me.iMapDivBorderWidth)+"px";me.divFaceBorderRight.style.top="0px";me.divFaceBorderRight.style.height=Math.max(0,GetLayerHeight(me.divMap)-2*me.iMapDivBorderWidth)+"px";me.divFaceBorderTop.style.visibility="hidden";me.divFaceBorderBottom.style.visibility="hidden";me.divFaceBorderLeft.style.visibility="visible";me.divFaceBorderRight.style.visibility="visible";me.imgFaceBorderTop.style.visibility="hidden";me.imgFaceBorderBottom.style.visibility="hidden";me.imgFaceBorderLeft.style.visibility="visible";me.imgFaceBorderRight.style.visibility="visible";}
else if((!bVisibilityHorizontal)&&(bVisibilityVertical))
{if(!me.divFaceBorderTop)
me.CreateFaceBorder();me.divFaceBorderTop.style.visibility="visible";me.divFaceBorderBottom.style.visibility="visible";me.divFaceBorderLeft.style.visibility="hidden";me.divFaceBorderRight.style.visibility="hidden";me.imgFaceBorderTop.style.visibility="visible";me.imgFaceBorderBottom.style.visibility="visible";me.imgFaceBorderLeft.style.visibility="hidden";me.imgFaceBorderRight.style.visibility="hidden";}
me.bAutoScrollEnabled=(bVisibilityHorizontal||bVisibilityVertical);}
this.SetBorderThickness=function(iThickness)
{me.iAutoScrollMargin=iThickness;if(me.divFaceBorderTop)
{me.divFaceBorderTop.style.height=me.iAutoScrollMargin+"px";me.divFaceBorderBottom.style.height=me.iAutoScrollMargin+"px";me.divFaceBorderLeft.style.width=me.iAutoScrollMargin+"px";me.divFaceBorderRight.style.width=me.iAutoScrollMargin+"px";me.divFaceBorderLeft.style.top=me.iAutoScrollMargin+"px";me.divFaceBorderLeft.style.height=Math.max(0,GetLayerHeight(me.divMap)-2*me.iMapDivBorderWidth-2*me.iAutoScrollMargin)+"px";me.divFaceBorderRight.style.top=me.iAutoScrollMargin+"px";me.divFaceBorderRight.style.height=Math.max(0,GetLayerHeight(me.divMap)-2*me.iMapDivBorderWidth-2*me.iAutoScrollMargin)+"px";}}
this.SetScrollEvents=function()
{if(me.bMainMapMode)
{if(window.addEventListener)
{window.addEventListener('DOMMouseScroll',me.OnMouseWheel,false);window.addEventListener('mousewheel',me.OnMouseWheel,false);}
else
{document.attachEvent('onmousewheel',me.OnMouseWheel,false);}}}
this.SetMapToDefaultLevelAndPosition=function()
{me.ZoomMap(me.GetPixelDensityFromLevel(me.MAP_DEFAULT_LEVEL),me.GetCenterPosX(me.MAP_DEFAULT_LEVEL),me.GetCenterPosY(me.MAP_DEFAULT_LEVEL),0,0);}
this.GetCenterPosX=function(iLevel)
{var A=me.GetActiveWidthFromLevel(iLevel);var V=me.GetMapViewWidth();return Math.floor((A-V)/2);}
this.GetCenterPosY=function(iLevel)
{var A=me.GetActiveHeightFromLevel(iLevel);var V=me.GetMapViewHeight();return Math.floor((A-V)/2);}
this.SetLang=function(strLang)
{g_Babel.SetLang(strLang);}
this.GetLang=function()
{return g_Babel.GetLang();}
this.Show=function()
{me.divMap.style.visibility="visible";}
this.Hide=function()
{me.divMap.style.visibility="hidden";}
this.GetInitialPixelDensity=function()
{if(me.bHasMiniMap)
{return me.GetPixelDensityFromLevel(me.MAP_DEFAULT_LEVEL);}
else
{return me.GetPixelDensityFromLevel(me.DEFAULT_MINIMAP_LEVEL);}}
this.ZoomOut=function()
{me.pZoomSrc=this.className;me.ZoomByLevel(-1);}
this.ZoomIn=function()
{me.pZoomSrc=this.className;me.ZoomByLevel(+1);}
this.ZoomByLevel=function(iDiffLevel)
{me.iZoomingLevelChange+=iDiffLevel;if(me.bZooming==false)
{me.bZooming=true;window.setTimeout(me.ZoomByLevelMain,250);}}
this.ZoomByLevelMain=function(bForced)
{var iDiffLevel=me.iZoomingLevelChange;me.iZoomingLevelChange=0;me.bZooming=false;var oldLevel=me.GetLevel();var newLevel=oldLevel+iDiffLevel;if(newLevel>me.GetMaximumLevel())
newLevel=me.GetMaximumLevel();if(newLevel<me.GetMinimumLevel())
newLevel=me.GetMinimumLevel();if((oldLevel!=newLevel)||bForced==true)
{var oldPixelDensity=me.GetPixelDensity();var newPixelDensity=me.GetPixelDensityFromLevel(newLevel);var ZoomPosX=0;var ZoomPosY=0;if(me.pZoomSrc=="CTopoliszMap")
{ZoomPosX=me.iMousePosX;ZoomPosY=me.iMousePosY;}
else
{if(me.GetMapViewWidth()<=me.GetActiveWidth())
ZoomPosX=me.GetMapViewWidth()/2;else
ZoomPosX=me.GetActiveWidth()/2;if(me.GetMapViewHeight()<=me.GetActiveHeight())
ZoomPosY=me.GetMapViewHeight()/2;else
ZoomPosY=me.GetActiveHeight()/2;}
var beforeAbsY=me.pGridMain.GetViewAbsoluteTop();var beforeAbsX=me.pGridMain.GetViewAbsoluteLeft();var afterAbsY=oldPixelDensity/newPixelDensity*(beforeAbsY+ZoomPosY)-ZoomPosY;var afterAbsX=oldPixelDensity/newPixelDensity*(beforeAbsX+ZoomPosX)-ZoomPosX;var PreviewZoomPosX=ZoomPosX;var PreviewZoomPosY=ZoomPosY;if(me.GetMapViewWidth()>me.GetActiveWidthFromLevel(newLevel))
PreviewZoomPosX=me.GetMapViewWidth()/2;if(me.GetMapViewHeight()>me.GetActiveHeightFromLevel(newLevel))
PreviewZoomPosY=me.GetMapViewHeight()/2;if(me.bPreviewIsOn)
me.pGridMain.ZoomPreview(oldPixelDensity/newPixelDensity,PreviewZoomPosX,PreviewZoomPosY,0,0);me.ZoomMap(newPixelDensity,afterAbsX,afterAbsY,ZoomPosX,ZoomPosY);}}
this.SetSlider=function()
{if(me.pMapPalette)
{var Level=me.GetLevel()-me.GetMinimumLevel();var LevelNumber=me.GetLevelNumber();var value=Level/(LevelNumber-1);if(me.pMapPalette.pSlider)
me.pMapPalette.pSlider.setPercentY(1-value);}}
this.GetPixelDensity=function()
{return me.pixeldensity;}
this.ZoomModifiedBySlider=function(sliderPercent)
{var oldPixelDensity=me.GetPixelDensity();var newLevel=Math.round((1-sliderPercent)*(me.GetLevelNumber()-1))+me.GetMinimumLevel();var newPixelDensity=me.GetPixelDensityFromLevel(newLevel);var oldLevel=me.GetLevel();var ZoomPosX=0;var ZoomPosY=0;ZoomPosX=me.GetMapViewWidth()/2;ZoomPosY=me.GetMapViewHeight()/2;if(oldLevel!=newLevel)
{var beforeAbsY=me.pGridMain.GetViewAbsoluteTop();var beforeAbsX=me.pGridMain.GetViewAbsoluteLeft();var afterAbsY=oldPixelDensity/newPixelDensity*(beforeAbsY+ZoomPosY)-ZoomPosY;var afterAbsX=oldPixelDensity/newPixelDensity*(beforeAbsX+ZoomPosX)-ZoomPosX;if(me.bPreviewIsOn)
me.pGridMain.ZoomPreview(oldPixelDensity/newPixelDensity,ZoomPosX,ZoomPosY,0,0);me.ZoomMap(newPixelDensity,afterAbsX,afterAbsY,ZoomPosX,ZoomPosY);}}
this.ZoomMap=function(PixelDensity,PosX,PosY,ZoomPosX,ZoomPosY)
{if(PixelDensity>me.GetMaxPixelDensity())PixelDensity=me.GetMaxPixelDensity();if(PixelDensity<me.GetMinPixelDensity())PixelDensity=me.GetMinPixelDensity();me.StartZoom(PixelDensity,PosX,PosY,ZoomPosX,ZoomPosY);}
this.ZoomMiniMapSync=function(PixelDensity,ZoomPosX,ZoomPosY,bUsePreview)
{if(me.bMiniMapVisible)
{var mainMapLevel=me.GetLevelFromPixelDensity(PixelDensity);var levelDiff=me.DIFF_MAP_LEVELS;var miniMapLevel=mainMapLevel-levelDiff;if(miniMapLevel<0)miniMapLevel=0;var mainMapPixelDensity=PixelDensity;var miniMapPixelDensity=me.GetPixelDensityFromLevel(miniMapLevel);var ratio=mainMapPixelDensity/miniMapPixelDensity;var iCol=(me.pGridMain.GetViewAbsoluteLeft()+me.GetMapViewWidth()/2)*ratio-me.pConnectedMiniMap.GetMapViewWidth()/2;var iRow=(me.pGridMain.GetViewAbsoluteTop()+me.GetMapViewHeight()/2)*ratio-me.pConnectedMiniMap.GetMapViewHeight()/2;var MiniPosX=iCol;var MiniPosY=iRow;if((me.bMiniMapVisible)&&(bUsePreview))
{var FrameTop=me.pConnectedMiniMap.pMiniMapFrame.GetFrameTop();var FrameLeft=me.pConnectedMiniMap.pMiniMapFrame.GetFrameLeft();var PreViewX=ZoomPosX*ratio+FrameTop+3;var PreViewY=ZoomPosY*ratio+FrameLeft+3;me.pConnectedMiniMap.pGridMain.ZoomPreview(me.pConnectedMiniMap.GetPixelDensity()/miniMapPixelDensity,PreViewX,PreViewY,0,0);}
me.pConnectedMiniMap.ZoomMap(miniMapPixelDensity,MiniPosX,MiniPosY,0,0);}}
this.StartZoom=function(PixelDensity,PosX,PosY,ZoomPosX,ZoomPosY)
{var iNewLevel=me.GetLevelFromPixelDensity(PixelDensity);var bRasterZoom=(me.GetMaximumRasterLevel()>iNewLevel)?true:false;var types=["start","through","stop"];me.HidePinLabelsMulti(types);me.HidePois();me.HidePrintPreview();me.HideRoute();me.HideDistMeasure();me.pGridMain.SetMainGridImage("",100);me.pGridMain.SetMainGridImageSec("",100);if(me.DistMeter)
{me.DistMeter.ClearRubberLine();me.DistMeter.ClearCursors();}
var isIn=true;if(PixelDensity>me.pixeldensity)isIn=false;if((ZoomPosX!=0)&&(ZoomPosY!=0))
me.ShowZoomAnimation(ZoomPosY,ZoomPosX,isIn);if(me.GetActiveWidthFromLevel(iNewLevel)<me.GetMapViewWidth())
PosX=me.GetCenterPosX(iNewLevel);if(me.GetActiveHeightFromLevel(iNewLevel)<me.GetMapViewHeight())
PosY=me.GetCenterPosY(iNewLevel);var iNewTop=me.pGridMain.GetTopFromAbsCoordY(PosY);var iNewLeft=me.pGridMain.GetLeftFromAbsCoordX(PosX);var iGridWidth=me.pGridMain.GetWidth();var iGridHeight=me.pGridMain.GetHeight();me.ArgZoom_ZoomPosX=ZoomPosX;me.ArgZoom_ZoomPosY=ZoomPosY;var iViewDeltaX=me.GetMapViewWidth();var iViewDeltaY=me.GetMapViewHeight();var iNewViewOffsetY=me.pGridMain.GetMapViewVectorYFromAbsCoordY(PosY);var iNewViewOffsetX=me.pGridMain.GetMapViewVectorXFromAbsCoordX(PosX);var Params='iLevel='+iNewLevel;Params+='&iMinRow='+iNewTop;Params+='&iMinCol='+iNewLeft;Params+='&iMaxRow='+(iNewTop+iGridHeight-1);Params+='&iMaxCol='+(iNewLeft+iGridWidth-1);Params+='&iViewOffsetX='+(iNewViewOffsetX);Params+='&iViewOffsetY='+(iNewViewOffsetY);Params+='&iViewDeltaX='+(iViewDeltaX);Params+='&iViewDeltaY='+(iViewDeltaY);me.bZoomingHappens=true;me.bZoomCalled=true;me.NoSessionServer.CallFunction("DrawRasterMap",Params,0,me.EndZoomMain);}
this.EndZoomMain=function(serverResponse,clientParam,iCommandID)
{me.bZoomingHappens=false;if(!serverResponse)
return;me.m_bRasterLevel=(serverResponse.arrUrls.length!=0);me.SetPalingGridImage();if(!me.m_bRasterLevel)
{me.iMainGridImageOpacity=100;}
if(me.pConnectedMiniMap)
{if(!me.pConnectedMiniMap.m_bRasterLevel)
{me.pConnectedMiniMap.iMainGridImageOpacity=100;}}
me.ShowMapCaption(serverResponse.strCaption);me.pLastStateFromServer=serverResponse;me.iMovingSinceLastServerStateX=0;me.iMovingSinceLastServerStateY=0;me.pixeldensity=me.GetPixelDensityFromLevel(serverResponse.iLevel);me.iMapWidth=me.GetMapCols()*me.GetMapGridItemWidth();me.iMapHeight=me.GetMapRows()*me.GetMapGridItemHeight();me.pGridMain.ShowMainGridImage();me.pGridMain.LoadLevel2(serverResponse);me.SetSlider();me.SetMovingRights();if(me.bMainMapMode)
{me.ZoomMiniMapSync(me.pixeldensity,me.ArgZoom_ZoomPosX,me.ArgZoom_ZoomPosY,true);}
if(me.pMiniMapFrame)
me.pMiniMapFrame.ReArrange();me.RearrangeRatioMeter();me.OnStateChanged(serverResponse,0,0);me.DrawRoute();me.DrawDistMeasure();me.RearrangePois();me.ShowPois();me.SetNormalCursor();}
this.SetPalingGridImage=function(bPaleMapGridImage)
{if(bPaleMapGridImage!=undefined)
me.m_bPaleMapGridImage=bPaleMapGridImage;if(me.m_bPaleMapGridImage&&me.m_bRasterLevel)
me.iMainGridImageOpacity=50;else
me.iMainGridImageOpacity=100;}
this.SetMovingRights=function()
{if(me.GetActiveWidth()<me.GetMapViewWidth())
{me.pGridMain.bCanMoveX=false;PosX=0;}
else
{me.pGridMain.bCanMoveX=true;}
if(me.GetActiveHeight()<me.GetMapViewHeight())
{me.pGridMain.bCanMoveY=false;PosY=0;}
else
{me.pGridMain.bCanMoveY=true;}
me.SetVisibilityBorders(me.pGridMain.bCanMoveX,me.pGridMain.bCanMoveY);}
this.GetLevelNumber=function()
{return me.GetMaximumLevel()-me.GetMinimumLevel()+1;}
this.GetMinimumLevel=function()
{if(me.bHasMiniMap)
return me.MAP_MINIMUM_LEVEL;else
return 0;}
this.GetMaximumLevelByServer=function()
{try
{return g_RasterMapInfo!=null?g_RasterMapInfo.iLevels-1:0;}
catch(e)
{return 0;}}
this.GetMaximumLevel=function()
{if((me.MAP_MAXIMUM_LEVEL>-1)&&(me.MAP_MAXIMUM_LEVEL<=me.GetMaximumLevelByServer()))
return me.MAP_MAXIMUM_LEVEL;else
return me.GetMaximumLevelByServer();}
this.GetMaximumRasterLevel=function()
{if((me.MAP_MAXIMUM_LEVEL>-1)&&(me.MAP_MAXIMUM_LEVEL<=me.GetMaximumLevelByServer()))
return me.MAP_MAXIMUM_LEVEL;else
return me.GetMaximumLevelByServer();}
this.GetLevelFromPixelDensity=function(PixelDensity)
{try
{var minLevel=me.GetMinimumLevel();var maxLevel=me.GetMaximumLevel();if(m_arrLevelInfo!=null)
{for(i=minLevel;i<maxLevel+1;i++)
{if(m_arrLevelInfo[i]==PixelDensity)
return i;}
return maxLevel;}}
catch(e)
{}
return 0;}
this.GetLevelFromPixelDensityNonExact=function(PixelDensity)
{try
{var minLevel=me.GetMinimumLevel();var maxLevel=me.GetMaximumLevel();if(m_arrLevelInfo!=null)
{for(i=minLevel;i<maxLevel+1;i++)
{if(m_arrLevelInfo[i]<PixelDensity)
return i;}
return maxLevel;}}
catch(e)
{}
return 0;}
this.GetLevel=function()
{return me.GetLevelFromPixelDensity(me.pixeldensity);}
this.GetMaxPixelDensity=function()
{return m_arrLevelInfo!=null?m_arrLevelInfo[me.GetMinimumLevel()]:0;}
this.GetMinPixelDensity=function()
{return m_arrLevelInfo!=null?m_arrLevelInfo[me.GetMaximumLevel()]:0;}
this.GetPixelDensityFromLevel=function(Level)
{try
{return m_arrLevelInfo!=null?m_arrLevelInfo[Level]:0;}
catch(e)
{return 0;}}
this.GetMapColsFromLevel=function(Level)
{if(g_RasterMapInfo.iLevels>Level)
return g_RasterMapInfo.arrLevels[Level].iCols;return 0;}
this.GetMapRowsFromLevel=function(Level)
{if(g_RasterMapInfo.iLevels>Level)
return g_RasterMapInfo.arrLevels[Level].iRows;return 0;}
this.GetMapCols=function()
{return g_RasterMapInfo!=null?g_RasterMapInfo.arrLevels[me.GetLevel()].iCols:0;}
this.GetMapRows=function()
{return g_RasterMapInfo!=null?g_RasterMapInfo.arrLevels[me.GetLevel()].iRows:0;}
this.GetActiveWidth=function()
{return g_RasterMapInfo!=null?g_RasterMapInfo.arrLevels[me.GetLevel()].iActiveWidth:0;}
this.GetActiveHeight=function()
{return g_RasterMapInfo!=null?g_RasterMapInfo.arrLevels[me.GetLevel()].iActiveHeight:0;}
this.GetActiveWidthFromLevel=function(iLevel)
{return g_RasterMapInfo!=null?g_RasterMapInfo.arrLevels[iLevel].iActiveWidth:0;}
this.GetActiveHeightFromLevel=function(iLevel)
{return g_RasterMapInfo!=null?g_RasterMapInfo.arrLevels[iLevel].iActiveHeight:0;}
this.ZoomToScale=function(wgsX,wgsY,strScale)
{var dRadius=me.GetRadiusMeter(strScale);me.ZoomToPoint(wgsX,wgsY,dRadius,null);}
this.GetRadiusMeter=function(strScale)
{var dRadius;switch(strScale)
{case"Country":dRadius=160000;break;case"Region":dRadius=30000;break;case"Settlement":dRadius=3000;break;case"Street":dRadius=300;break;default:dRadius=160000;}
return dRadius;}
this.ZoomToPoint=function(wgsX,wgsY,dRadius,pfOuterCallback)
{var types=["start","through","stop"];me.HidePinLabelsMulti(types);me.HidePois();me.DistMeter.ClearRubberLine();me.DistMeter.ClearCursors();me.HideRoute();me.HideDistMeasure();var iViewDeltaX=me.GetMapViewWidth();var iViewDeltaY=me.GetMapViewHeight();var iGridDeltaX=me.GetMapGridItemWidth()*me.iGridWidth;var iGridDeltaY=me.GetMapGridItemHeight()*me.iGridHeight;var Params="";Params+='dCenterX='+wgsX;Params+='&dCenterY='+wgsY;Params+='&dRadius='+dRadius;Params+='&iViewDeltaX='+iViewDeltaX;Params+='&iViewDeltaY='+iViewDeltaY;Params+='&iGridDeltaX='+iGridDeltaX;Params+='&iGridDeltaY='+iGridDeltaY;me.bZoomCalled=true;me.NoSessionServer.CallFunction("DrawRasterMapCenter",Params,0,me.ZoomToPointCallback,pfOuterCallback);me.pGridMain.RemoveZoomPreview();}
this.ZoomToPointCallback=function(result,pfOuterCallback,iCommandID)
{me.ArgZoom_ZoomPosX=0;me.ArgZoom_ZoomPosY=0;me.EndZoomMain(result,null,iCommandID);if(pfOuterCallback)
pfOuterCallback();}
this.ZoomToRect=function(dMinX,dMinY,dMaxX,dMaxY,pfOuterCallback)
{var iViewDeltaX=me.GetMapViewWidth();var iViewDeltaY=me.GetMapViewHeight();var iGridDeltaX=me.GetMapGridItemWidth()*me.iGridWidth;var iGridDeltaY=me.GetMapGridItemHeight()*me.iGridHeight;if((iViewDeltaX<=0)||(iViewDeltaY<=0)||(iGridDeltaX<=0)||(iGridDeltaY<=0)||(dMinX>dMaxX)||(dMinY>dMaxY))
return;var types=["start","through","stop"];me.HidePinLabelsMulti(types);me.HidePois();me.DistMeter.ClearRubberLine();me.DistMeter.ClearCursors();me.HideRoute();me.HideDistMeasure();var Params="";Params+='dMinX='+dMinX;Params+='&dMinY='+dMinY;Params+='&dMaxX='+dMaxX;Params+='&dMaxY='+dMaxY;Params+='&iViewDeltaX='+iViewDeltaX;Params+='&iViewDeltaY='+iViewDeltaY;Params+='&iGridDeltaX='+iGridDeltaX;Params+='&iGridDeltaY='+iGridDeltaY;me.bZoomCalled=true;me.NoSessionServer.CallFunction("DrawRasterMapRectangle",Params,0,me.ZoomToRectCallback,pfOuterCallback);me.pGridMain.RemoveZoomPreview();}
this.ZoomToRectCallback=function(result,pfOuterCallback,iCommandID)
{me.ArgZoom_ZoomPosX=0;me.ArgZoom_ZoomPosY=0;me.EndZoomMain(result,null,iCommandID);if(pfOuterCallback)
pfOuterCallback();}
this.ZoomToDefault=function(pfOuterCallback)
{if(g_RasterMapInfo!=null)
me.ZoomToRect(g_RasterMapInfo.wgsMapMinX,g_RasterMapInfo.wgsMapMinY,g_RasterMapInfo.wgsMapMaxX,g_RasterMapInfo.wgsMapMaxY,pfOuterCallback);}
this.DrawRoute=function()
{me.bDrawRouteHappening=true;var dMinX=me.pGridMain.dWgsLowerLeftX;var dMinY=me.pGridMain.dWgsLowerLeftY;var dMaxX=me.pGridMain.dWgsUpperRightX;var dMaxY=me.pGridMain.dWgsUpperRightY;var iGridWidth=me.GetMapGridWidthInPixel();var iGridHeight=me.GetMapGridHeightInPixel();var CommonParams="";CommonParams+='dMinX='+dMinX;CommonParams+='&dMinY='+dMinY;CommonParams+='&dMaxX='+dMaxX;CommonParams+='&dMaxY='+dMaxY;CommonParams+='&iGridWidth='+iGridWidth;CommonParams+='&iGridHeight='+iGridHeight;CommonParams+='&dPixelDensity='+me.GetPixelDensity();if(me.OnPoiDrawBegins)
{try{me.OnPoiDrawBegins();}
catch(exp){if(me.OnError)
me.OnError(exp,'CTopoliszMap.OnPoiDrawBegins');}}
var i=0;var strPoiIDs="";var strPoiXs="";var strPoiYs="";for(i=0;i<me.arrPois.length;i++)
{if(me.arrPois[i]!=null)
{if(strPoiIDs!="")
{strPoiIDs+='|';strPoiXs+='|';strPoiYs+='|';}
strPoiIDs+=me.arrPois[i].strID;strPoiXs+=me.arrPois[i].dX;strPoiYs+=me.arrPois[i].dY;}}
var Params1="";Params1+='bDrawRoute=1';if(me.m_bRasterLevel==false)
Params1+='&bDrawMap=1';else
Params1+='&bDrawMap=0';Params1+='&arrPoiIDs='+strPoiIDs;Params1+='&arrPoiX='+strPoiXs;Params1+='&arrPoiY='+strPoiYs;Params1+='&arrPoiTypeIDs='+me.GetPoiLayers();me.pMarkers.DeleteAllWithType("tmc");me.pMarkers.DeleteAllWithType("lpoi");me.pMarkers.DeleteAllWithType("ptstop");Params1+='&'+me.pMarkers.GetUrl();Params1+='&bDrawHidFile='+me.bDrawHidFile;Params1+='&strDrawTrfEdgeVT='+me.strDrawTrfEdgeVT;Params1+='&strDrawTrfNodeVT='+me.strDrawTrfNodeVT;Params1+='&strDrawRuns='+me.strDrawRunParams;Params1=CommonParams+"&"+Params1;var pDRS1=new DrawRouteStruct();pDRS1.bDrawRoute=true;pDRS1.bNewPoint=false;me.HideRoute();me.HideDistMeasure();me.RemovePinLabelsSpec();var divParent=me.divPoiParent;if(divParent!=null)
{while(divParent.firstChild)
divParent.removeChild(divParent.firstChild);me.RemoveLayerPOIBoxes();var types=["start","through","stop"];me.RemovePinLabelsExclusiveMulti(types);}
var iViewOffsX=me.pGridMain.iMapViewVectorX;var iViewOffsY=me.pGridMain.iMapViewVectorY;var iViewW=me.GetMapViewWidth();var iViewH=me.GetMapViewHeight();Params1+='&iViewOffsetX='+iViewOffsX;Params1+='&iViewOffsetY='+iViewOffsY;Params1+='&iViewDeltaX='+iViewW;Params1+='&iViewDeltaY='+iViewH;me.pGridMain.SetMainGridImage("",me.iMainGridImageOpacity);me.ReadSessionServer.CallFunction("DrawMapPersonal",Params1,0,me.DrawRouteCallback,pDRS1);if(m_bDrawTMC||m_bDrawPTStopsGlobal||m_bDrawPTStopsLocal||m_bDrawTMCWeather)
{var bDrawTMC=(m_bDrawTMC||m_bDrawTMCWeather);var Params2=CommonParams;Params2+='&bDrawRoute=0';Params2+='&bDrawMap=0';Params2+='&bDrawTMC='+bDrawTMC;Params2+='&strTMCState='+me.GetTMCStateExt();Params2+='&strDrawTrfMode=false';Params2+='&iViewOffsetX='+iViewOffsX;Params2+='&iViewOffsetY='+iViewOffsY;Params2+='&iViewDeltaX='+iViewW;Params2+='&iViewDeltaY='+iViewH;Params2+='&bDrawPTStopsGlobal='+m_bDrawPTStopsGlobal;Params2+='&bDrawPTStopsLocal='+m_bDrawPTStopsLocal;me.pGridMain.SetMainGridImageSec("",100);me.ReadSessionServer.CallFunction("DrawMapPersonal",Params2,0,me.DrawRouteCallbackTMC,pDRS1);}}
this.DrawPois=function()
{me.DrawRoute();}
this.DrawDistMeasure=function(iNewDistancePixelPointX,iNewDistancePixelPointY)
{var bNewPoint=false;if((iNewDistancePixelPointX!=undefined)&&(iNewDistancePixelPointY!=undefined))
bNewPoint=true;me.bDrawDistMeasureHappening=true;var dMinX=me.pGridMain.dWgsLowerLeftX;var dMinY=me.pGridMain.dWgsLowerLeftY;var dMaxX=me.pGridMain.dWgsUpperRightX;var dMaxY=me.pGridMain.dWgsUpperRightY;var iGridWidth=me.GetMapGridWidthInPixel();var iGridHeight=me.GetMapGridHeightInPixel();var CommonParams="";CommonParams+='dMinX='+dMinX;CommonParams+='&dMinY='+dMinY;CommonParams+='&dMaxX='+dMaxX;CommonParams+='&dMaxY='+dMaxY;CommonParams+='&iGridWidth='+iGridWidth;CommonParams+='&iGridHeight='+iGridHeight;if(me.pDistancePoly.PointNum>0||bNewPoint)
{var Params2="";Params2+='bDrawRoute=0';if(me.pDistancePoly.PointNum>0)
{Params2+='&arrDistX='+me.pDistancePoly.GetXs();Params2+='&arrDistY='+me.pDistancePoly.GetYs();}
Params2=CommonParams+"&"+Params2;if(bNewPoint)
{Params2+='&iDistNextPointX='+iNewDistancePixelPointX;Params2+='&iDistNextPointY='+iNewDistancePixelPointY;}
var iViewOffsX=me.pGridMain.iMapViewVectorX;var iViewOffsY=me.pGridMain.iMapViewVectorY;var iViewW=me.GetMapViewWidth();var iViewH=me.GetMapViewHeight();Params2+='&iViewOffsetX='+iViewOffsX;Params2+='&iViewOffsetY='+iViewOffsY;Params2+='&iViewDeltaX='+iViewW;Params2+='&iViewDeltaY='+iViewH;me.NoSessionServer.CallFunction("DrawMapPersonal",Params2,0,me.DrawDistMeasureCallback,bNewPoint);}
else
me.bDrawDistMeasureHappening=false;}
this.DrawPrintPreview=function()
{me.bDrawPrintPreviewHappening=true;var pMapData=me.GetMapData();var dMinX=pMapData.dMinX;var dMinY=pMapData.dMinY;var dMaxX=pMapData.dMaxX;var dMaxY=pMapData.dMaxY;var iGridWidth=me.GetMapViewWidth();var iGridHeight=me.GetMapViewHeight();var CommonParams="";CommonParams+='dMinX='+dMinX;CommonParams+='&dMinY='+dMinY;CommonParams+='&dMaxX='+dMaxX;CommonParams+='&dMaxY='+dMaxY;CommonParams+='&iGridWidth='+iGridWidth;CommonParams+='&iGridHeight='+iGridHeight;CommonParams+='&dPixelDensity='+me.GetPixelDensity();var Params1="";Params1+='bDrawRoute=1';Params1+='&bDrawMap=1';var bDrawTMC=(m_bDrawTMC||m_bDrawTMCWeather);Params1+='&bDrawTMC='+bDrawTMC;if(bDrawTMC)
{Params1+='&strTMCState='+me.GetTMCStateExt();}
Params1=CommonParams+"&"+Params1;var iViewOffsX=me.pGridMain.iMapViewVectorX;var iViewOffsY=me.pGridMain.iMapViewVectorY;var iViewW=me.GetMapViewWidth();var iViewH=me.GetMapViewHeight();Params1+='&iViewOffsetX='+iViewOffsX;Params1+='&iViewOffsetY='+iViewOffsY;Params1+='&iViewDeltaX='+iViewW;Params1+='&iViewDeltaY='+iViewH;me.ReadSessionServer.CallSyncFunction("DrawMapPersonal",Params1,0,me.DrawPrintPreviewCallback);}
AddEvent(window,"beforeprint",function(){if(me.bMainMapMode)
{me.DrawPrintPreview;}});this.DrawPrintPreviewCallback=function(result,pClientParam,iCommandID)
{var strImageUrl=result.strUrl;me.divPrintPreview.style.left="0px";me.divPrintPreview.style.top="0px";me.divPrintPreview.style.width=me.GetMapViewWidth()+"px";me.divPrintPreview.style.height=me.GetMapViewHeight()+"px";while(me.divPrintPreview.firstChild)
me.divPrintPreview.removeChild(me.divPrintPreview.firstChild);var img=NewTag('img',me.divPrintPreview);SetImage(img,strImageUrl,me.GetMapViewWidth(),me.GetMapViewHeight(),"");me.divPrintPreview.style.display="block";me.bDrawPrintPreviewHappening=false;}
this.HidePrintPreview=function()
{me.divPrintPreview.style.display="none";}
this.HideRoute=function()
{if(me.pGridMain)
me.pGridMain.HideMainGridImage();}
this.HideDistMeasure=function()
{if(me.pGridMain)
me.pGridMain.HideDistMeasure();}
this.ShowDistMeasure=function()
{me.pGridMain.ShowDistMeasure();}
this.ShowRoute=function()
{}
this.DrawRouteCallbackTMC=function(result,pClientParam,iCommandID)
{var strImageUrl=result.strUrl;me.pGridMain.SetMainGridImageSec(strImageUrl,100);if(result.arrTMCTextTable!=null&&result.arrTMCTextTable.length>0)
{me.arrTMCTextTable=result.arrTMCTextTable;}
var SetDrawBoxContentData=function(marker,tmc)
{var TMCDrawBoxContentData=function(divParent)
{if(divParent!=null)
{var divData=NewTag("div",divParent);divData.style.width="200px";var arrLines=me.GetTMCText(tmc.iEventDescriptionIndex).split("<br/>");for(var iLine=0;iLine<arrLines.length;iLine++)
{NewTextTag(arrLines[iLine],divData);if(iLine<arrLines.length-1)
NewTag("br",divData);}
var arrLines=me.GetTMCText(tmc.iTMCTextIndex).split("<br/>");if((arrLines.length>1)||((arrLines.length==1)&&(arrLines[0]!="")))
{var divData=$("<div style='padding-top:0.4em'></div>").appendTo(divParent);for(var iLine=0;iLine<arrLines.length;iLine++)
{var iPos=arrLines[iLine].indexOf(':');if(iPos>0)
{divData.append("<span style='font-weight:bold;font-size:110%'>"+arrLines[iLine].substr(0,iPos+1)+"</span>");divData.append(arrLines[iLine].substr(iPos+1));}
else
{divData.append(arrLines[iLine]);}
divData.append("<br/>");}}}};marker.DrawBoxContentData=TMCDrawBoxContentData;var k=22;k++;return k;}
for(var iTMC=0;iTMC<result.arrTMCEvents.length;iTMC++)
{var tmc=result.arrTMCEvents[iTMC];var marker=new Marker(me,"tmc",0,0,null,null);SetDrawBoxContentData(marker,tmc);marker.SetProperty("start_button",false);marker.SetProperty("through_button",false);marker.SetProperty("stop_button",false);marker.SetProperty("panorama_button",false);marker.SetProperty("pinnumber",0);marker.SetProperty("handle_details",false);marker.SetProperty("div_label_sign_class","marker");marker.SetProperty("pin_img_width",27);marker.SetProperty("pin_img_height",27);marker.SetProperty("pin_img_refx",13);marker.SetProperty("pin_img_refy",13);marker.SetProperty("delete_marker_on_label_close",false);marker.SetProperty("caption",me.GetTMCText(tmc.iLocationDescriptionIndex).split('<br/>').join(' '));marker.SetProperty("show_coordinates",me.bDisplayCoords);marker.SetProperty("fix_label_on_click",true);marker.bLongMouseOver=true;me.pMarkers.Add(marker)
if(marker!=null)
{marker.iPixX=tmc.iX;marker.iPixY=tmc.iY;var pinlabel=me.CreatePinLabel(marker);pinlabel.DrawSign();}}
var SetDrawBoxContentDataPTStop=function(marker,tmc)
{var PTStopDrawBoxContentData=function(divParent)
{if(divParent!=null)
{var divData=NewTag("div",divParent);NewTextTag("hahó",divData);}};marker.DrawBoxContentData=PTStopDrawBoxContentData;}
for(var iPTStop=0;iPTStop<result.arrPTStops.length;iPTStop++)
{var ptstop=result.arrPTStops[iPTStop];var marker=new Marker(me,"ptstop",0,0,null,null);marker.SetProperty("start_button",me.bLabelHasStartButton);marker.SetProperty("through_button",false);marker.SetProperty("stop_button",me.bLabelHasStopButton);marker.SetProperty("panorama_button",me.bLabelHasPanoramaButton);marker.SetProperty("pinnumber",0);marker.SetProperty("handle_details",false);marker.SetProperty("div_label_sign_class","marker");marker.SetProperty("pin_img_width",10);marker.SetProperty("pin_img_height",10);marker.SetProperty("pin_img_refx",0);marker.SetProperty("pin_img_refy",5);marker.SetProperty("label_dy",-5);marker.SetProperty("delete_marker_on_label_close",false);marker.SetProperty("show_coordinates",me.bDisplayCoords);marker.SetProperty("fix_label_on_click",true);marker.bMouseOverEnabled=true;marker.bLongMouseOver=true;marker.ptstop=ptstop;var ptstopDrawBox_Custom=function(label)
{if(label.pMarker.GetProperty("get_all_data_from_server")!="???")
{if((label.pMarker.bContentLoaded)&&(label==null))
{window.status="<teszt null>";}
if((label.pMarker.bContentLoaded)&&(label!=null))
{label.DrawBox_Default();}
else
{var iID=label.pMarker.GetProperty("get_all_data_from_server");me.NoSessionServer.CallFunction("GetPTStopData","id="+iID+"&dX="+label.pMarker.dX+"&dY="+label.pMarker.dY,0,me.MarkerDataArrived,label.pMarker);}}
else
{me.MarkerDataArrived(label.pMarker.ptstop,label.pMarker);}}
marker.DrawBox_Custom=ptstopDrawBox_Custom;if(ptstop.strName=="")
{marker.SetProperty("get_all_data_from_server",ptstop.nID);marker.bContentLoaded=false;}
else
{marker.bContentLoaded=true;}
me.pMarkers.Add(marker)
if(marker!=null)
{marker.iPixX=ptstop.iPxlX;marker.iPixY=ptstop.iPxlY;marker.dX=ptstop.dWgsX;marker.dY=ptstop.dWgsY;var pinlabel=me.CreatePinLabel(marker);pinlabel.DrawSign();}}}
this.DrawRouteCallback=function(result,pClientParam,iCommandID)
{if(result==null)
{me.bDrawRouteHappening=false;me.CallDrawRouteCallbackListeners();return;}
var strImageUrl=result.strUrl;me.pGridMain.SetMainGridImage(strImageUrl,me.iMainGridImageOpacity);me.RearrangePois();me.ShowPois();var divParent=me.divPoiParent;if(divParent!=null)
{if(me.OnPoiDraw)
{try
{var iPoi;for(iPoi=0;iPoi<result.arrPois.length;iPoi++)
{if(result.arrPois[iPoi].strID.substr(0,4)!="pbp_")
me.OnPoiDraw(divParent,result.arrPois[iPoi].strID,result.arrPois[iPoi].iX,result.arrPois[iPoi].iY);}}
catch(exp){if(me.OnError)
me.OnError(exp,'CTopoliszMap.OnPoiDraw');}}
if(me.OnPoiDrawEnded)
{try{me.OnPoiDrawEnded();}
catch(exp){if(me.OnError)
me.OnError(exp,'CTopoliszMap.OnPoiDrawEnds');}}}
var iLabel;var bFixedMarkerFound=false;for(iLabel=result.arrMapLabels.length-1;iLabel>=0;iLabel--)
{var label=result.arrMapLabels[iLabel];var marker=me.pMarkers.Find(label.ID);if(marker!=null)
{marker.iPixX=label.iPixX;marker.iPixY=label.iPixY;var pinlabel=me.CreatePinLabel(marker);pinlabel.DrawSign();if(marker.bLabelBoxMustBeVisible)
{pinlabel.DrawBox();me.pFixedMarker=marker;bFixedMarkerFound=true;}}}
var SetDrawBoxContentDataLayerPoi=function(marker,lpoi)
{var LayerPoiDrawBoxContentData=function(divParent)
{if(divParent!=null)
{var divData=NewTag("div",divParent);}};marker.DrawBoxContentData=LayerPoiDrawBoxContentData;return 0;}
for(var iLayerPoi=0;iLayerPoi<result.arrPois.length;iLayerPoi++)
{var lpoi=result.arrPois[iLayerPoi];if(lpoi.strID.substr(0,4)=="pbp_")
{if(me.bDisplayPOIBanner){me.ShowPoiBannerPoi(lpoi);}
continue;}
var marker=new Marker(me,"lpoi",0,0,null,null);SetDrawBoxContentDataLayerPoi(marker,lpoi);marker.SetProperty("start_button",me.bLabelHasStartButton);marker.SetProperty("through_button",me.bLabelHasThroughButton);marker.SetProperty("stop_button",me.bLabelHasStopButton);marker.SetProperty("panorama_button",me.bLabelHasPanoramaButton);marker.SetProperty("pinnumber",0);marker.SetProperty("handle_details",true);marker.SetProperty("div_label_sign_class","marker");marker.SetProperty("pin_img_width",27);marker.SetProperty("pin_img_height",27);marker.SetProperty("pin_img_refx",0);marker.SetProperty("pin_img_refy",9);marker.SetProperty("fix_label_on_click",true);marker.SetProperty("delete_marker_on_label_close",false);marker.SetProperty("caption",lpoi.strName);marker.SetProperty("show_coordinates",me.bDisplayCoords);marker.SetProperty("get_details_from_server",lpoi.strID);marker.SetProperty("get_wgs_from_server",lpoi.strID);marker.SetProperty("label_dx",0);marker.SetProperty("label_dy",-9);marker.SetProperty("pinnumbercolor","Black");if(lpoi.iImageID>1)
{marker.SetProperty("label_css_classname",marker.GetProperty("label_css_classname")+" priority_label");marker.SetProperty("list_css_classname",marker.GetProperty("list_css_classname")+" priority_label");}
marker.DrawBoxContentData=function(divLabelBoxContent)
{if(marker.GetProperty("show_coordinates")==true)
{var iServerID=marker.GetProperty("get_wgs_from_server");if(iServerID!="???")
me.NoSessionServer.CallFunction("SearchPoi","iID="+iServerID,0,me.LayerPOIWGSDataArrived,divLabelBoxContent);}}
me.pMarkers.Add(marker)
if(marker!=null)
{marker.iPixX=lpoi.iX;marker.iPixY=lpoi.iY;var pinlabel=me.CreatePinLabel(marker);pinlabel.DrawSign();if(lpoi.strID==me.iMustVisibleMarkerSID)
{bFixedMarkerFound=true;marker.bLabelBoxMustBeVisible=true;me.iMustVisibleMarkerSID=0;me.pFixedMarker=marker;}
if(marker.bLabelBoxMustBeVisible)
pinlabel.DrawBox();}}
if(!bFixedMarkerFound)
me.pFixedMarker=null;else if(me.pFixedMarker!=null)
me.OnLabelSignClick(me.pFixedMarker);if(me.OnMarkerListChanged){me.OnMarkerListChanged();}
if(me.OnPoiOnGridListChanged)
me.OnPoiOnGridListChanged();me.ShowRoute();me.ShowDistMeasure();me.bDrawRouteHappening=false;if(me.bHasMiniMap==false)
me.divMap.style.display="";me.CallDrawRouteCallbackListeners();}
this.GetPoiBannerMoverContent=function(poi)
{if((typeof(g_pPoiBannerCampaign)!="undefined")&&g_pPoiBannerCampaign!=null)
{var iLength=g_pPoiBannerCampaign.arrContentTemplates.length;var iIndex=Math.min(Math.floor(Math.random()*iLength),iLength-1);if(iIndex>=0&&iIndex<iLength)
{var strTemplate=unescape(g_pPoiBannerCampaign.arrContentTemplates[iIndex]);strTemplate=strTemplate.replace("[Caption]",poi.strCaption);return unescape(strTemplate);}}
return"";}
var m_pbpTimer=null;this.ShowPoiBannerPoi=function(poi)
{if((typeof(g_pPoiBannerCampaign)!="undefined")&&g_pPoiBannerCampaign!=null)
{var divPoiParent=me.GetPoiParentDiv();var iID=parseInt(poi.strID.substr(4),10);if(iID>0)
{var poidata=null;if(g_pPoiBannerCampaign.arrPois!=null)
{for(var i=0;i<g_pPoiBannerCampaign.arrPois.length;i++)
{if(g_pPoiBannerCampaign.arrPois[i].nID==iID)
{poidata=g_pPoiBannerCampaign.arrPois[i];break;}}}
if(poidata)
{var div=NewTag("div");var img=NewTag("img",div);SetImage(img,poidata.strIconUrl,poidata.iIconWidth,poidata.iIconHeight,"");div.style.position="absolute";div.style.left=Math.round(poi.iX-poidata.iIconWidth/2)+"px";div.style.top=Math.round(poi.iY-poidata.iIconHeight/2)+"px";AddTag(div,divPoiParent);var followlink=function(pEvent)
{window.open(poidata.strLinkUrl);};var removebox=function()
{$(".pbp_mover").remove();};var timer=null;var stoptimer=function()
{if(m_pbpTimer!=null)
{window.clearTimeout(m_pbpTimer);m_pbpTimer=null;}}
var starttimer=function()
{stoptimer();m_pbpTimer=window.setTimeout(function()
{removebox();},1250);};$(div).hover(function(pEvent)
{removebox();stoptimer();var d2=NewTag('div');d2.className="pbp_mover";d2.style.position="absolute";d2.style.zIndex="4000";d2.style.left=Math.round(poi.iX-poidata.iIconWidth/2)+"px";d2.style.top=Math.round(poi.iY+poidata.iIconHeight/2)+"px";$(d2).append(me.GetPoiBannerMoverContent(poidata)).wrap("<div/>");$(d2).hover(stoptimer,removebox);$(d2).click(followlink);$(this).after(d2);var offsetFace=$(me.divFace).offset();var widthFace=$(me.divFace).innerWidth();var heightFace=$(me.divFace).innerHeight();var offsetBox=$(d2).offset();var widthBox=$(d2).outerWidth();var heightBox=$(d2).outerHeight();if(offsetBox.left+widthBox>offsetFace.left+widthFace||offsetBox.top+heightBox>offsetFace.top+heightFace)
{var iNewBoxLeft=offsetBox.left;var iNewBoxTop=offsetBox.top;if(offsetBox.left+widthBox>offsetFace.left+widthFace)
{iNewBoxLeft=(offsetFace.left+widthFace)-(widthBox+3);}
if(offsetBox.top+heightBox>offsetFace.top+heightFace)
{iNewBoxTop=(offsetFace.top+heightFace)-(heightBox+3);}
$(d2).offset({left:iNewBoxLeft,top:iNewBoxTop});}},starttimer);$(img).click(followlink);}}}}
this.LayerPOIWGSDataArrived=function(result,divLabelBoxContent)
{try
{var divCoord=NewTag('div',divLabelBoxContent,divLabelBoxContent.firstChild);NewTextTag(FormatCoordG(result.arrRecords[0].dX,result.arrRecords[0].dY),divCoord);divCoord.ondragstart=function(){return false;};divCoord.onselectstart=function(){return false;};}
catch(e)
{}}
this.DrawDistMeasureCallback=function(result,bNewPoint)
{var strImageUrl=result.strUrl;while(me.pGridMain.mainGridDistMeasureImageDiv.firstChild)
me.pGridMain.mainGridDistMeasureImageDiv.removeChild(me.pGridMain.mainGridDistMeasureImageDiv.firstChild);me.pGridMain.SetMainGridDistMeasureImage(strImageUrl);me.DistMeter.SetPixelDensity(me.pixeldensity);me.pDistancePoly.SetPointsPixelX(result.arrDistPolylinePixelX);me.pDistancePoly.SetPointsPixelY(result.arrDistPolylinePixelY);var iMousePosInGridX=me.iMousePosX+me.pGridMain.GetMapViewVectorX();var iMousePosInGridY=me.iMousePosY+me.pGridMain.GetMapViewVectorY();if(bNewPoint)
{me.pDistancePoly.AddPoint(result.dLastDistPointY,result.dLastDistPointX);me.pDistancePoly.dDistanceMeter=result.dDistanceMeter;}
me.DistMeter.ClearRubberLine();me.DistMeter.ClearCursors();if(me.pDistanceDisplay)
me.pDistanceDisplay.displayLastDist.lastChild.nodeValue="0 km";if(result.arrDistPolylinePixelX!=null&&result.arrDistPolylinePixelX.length>0)
{me.DistMeter.Init();me.DistMeter.AddDistPoint(me.pDistancePoly.GetLastPointPixelX(),me.pDistancePoly.GetLastPointPixelY());me.DistMeter.SetEndPoint(iMousePosInGridX,iMousePosInGridY);var divParent=me.pGridMain.mainGridDistMeasureImageDiv;for(var i=0;i<result.arrDistPolylinePixelX.length;i++)
{var divPoint=NewTag("div");divPoint.style.position="absolute";divPoint.style.left=(result.arrDistPolylinePixelX[i]-10)+"px";divPoint.style.top=(result.arrDistPolylinePixelY[i]-10)+"px";var img=NewTag("img");SetTransparentPng(img,GetAbsUrl("images/mapctrl/distance_point.png"),21,21);AddTag(img,divPoint);AddTag(divPoint,divParent);}}
me.bDrawDistMeasureHappening=false;}
this.GetPoisInView=function()
{var i;var arrPoisInView=new Array();for(i=0;i<me.pMarkers.arrMarkers.length;i++)
{var poiOnGrid=me.pMarkers.arrMarkers[i];if(poiOnGrid!=null)
{if(poiOnGrid.mainType!="lpoi")
continue;if(me.IsInView(poiOnGrid.iPixX,poiOnGrid.iPixY))
arrPoisInView.push(poiOnGrid);}}
return arrPoisInView;}
this.SetPoiList=function(arrPois)
{me.arrPois=(arrPois!=null?arrPois:new Array());}
this.GetPoiList=function()
{return me.arrPois;}
this.SetPoiOnGridList=function(arrPoisOnGrid)
{if(me.arrPoisOnGrid!=null)
{delete me.arrPoisOnGrid;me.arrPoisOnGrid=null;}
me.arrPoisOnGrid=new Array();var i;for(i=0;i<arrPoisOnGrid.length;i++)
{if(typeof(LayerPoi)!="undefined")
{var pSmallPoi=new LayerPoi(arrPoisOnGrid[i].strID,arrPoisOnGrid[i].iX,arrPoisOnGrid[i].iY,arrPoisOnGrid[i].strName);pSmallPoi.pMap=me;me.arrPoisOnGrid.push(pSmallPoi);}}
if(me.OnPoiOnGridListChanged)
me.OnPoiOnGridListChanged();}
this.GetPoiOnGridList=function()
{return me.arrPoisOnGrid;}
this.OnPoiDrawBegins=function()
{}
this.OnPoiDraw=function(divParent,strID,iX,iY)
{}
this.OnPoiDrawEnded=function()
{}
this.OnLabelDraw=function(tmTopoliszMap,pMapLabel,pMarker)
{}
this.GetPoiTypes=function()
{return g_arrPoiTypes;}
this.SearchPoi=function(pPoiQuery,callback_function,callback_param)
{if(pPoiQuery!=null)
{var strParams="nID="+pPoiQuery.nID
+"&strFilter="+pPoiQuery.strFilter
+"&strType="+pPoiQuery.strType
+"&iFirst="+pPoiQuery.iFirst
+"&iLast="+pPoiQuery.iLast;if(pPoiQuery.bHasRect)
{strParams+="&dMinX="+pPoiQuery.dMinX+"&dMinY="+pPoiQuery.dMinY
+"&dMaxX="+pPoiQuery.dMaxX+"&dMaxY="+pPoiQuery.dMaxY;}
me.NoSessionServer.CallFunction('SearchPoi',strParams,0,callback_function,callback_param);}}
this.GetPoiTypeName=function(strPoiTypeId)
{if(g_arrPoiTypes!=null)
{for(var i=0;i<g_arrPoiTypes.length;i++)
{var pType=g_arrPoiTypes[i];if(strPoiTypeId==pType.iID)
return pType.strName;}}
return"";}
this.SaveState=function()
{var mapdata=me.arrStates[me.iActiveState];var strState="dX="+mapdata.dCenterX
+"&dY="+mapdata.dCenterY
+"&dRadius="+mapdata.dRadius
+"&lang="+me.GetLang();if(me.pRouteSearch!=null)
{var arrAddressList=me.pRouteSearch.GetAddressList();var iAddress;var strAddresses='',strX='',strY='';for(iAddress=0;iAddress<arrAddressList.length;iAddress++)
{if(strAddresses!="")
{strAddresses+='|';strX+='|';strY+='|';}
strAddresses+=encodeURIComponent(arrAddressList[iAddress].strAddress);strX+=arrAddressList[iAddress].dX;strY+=arrAddressList[iAddress].dY;}
if(strAddresses!="")
{strState+="&bToll="+(me.pRouteSearch.bUseTolledRoute?1:0);strState+="&bFerry="+(me.pRouteSearch.bUseFerry?1:0);strState+="&bDirtyRoad="+(me.pRouteSearch.bUseDirtyRoad?1:0);strState+="&arrAddresses="+strAddresses+"&arrX="+strX+"&arrY="+strY;}
if(me.pRouteSearch)
{strState+="&traffictype="+me.pRouteSearch.strTrafficType;strState+="&icarOptim="+me.pRouteSearch.iCarOptim;}}
if(me.pMarkers!=null)
{var arrMarkers=me.pMarkers.arrMarkers;var iMarker;var strMarkerCaptions='',dMarkersXs='',dMarkersYs='',strMarkerTypes='';for(iMarker=0;iMarker<arrMarkers.length;iMarker++)
{var actMarker=arrMarkers[iMarker];if(actMarker!=null)
{if(strMarkerCaptions!="")
{strMarkerCaptions+='|';dMarkersXs+='|';dMarkersYs+='|';strMarkerTypes+='|';}
var oAddr=actMarker.ToAddress();strMarkerCaptions+=oAddr.strAddress;dMarkersXs+=oAddr.dX;dMarkersYs+=oAddr.dY;strMarkerTypes+=actMarker.mainType;}}
if(strMarkerCaptions!="")
{strState+="&strMarkerCaptions="+strMarkerCaptions;strState+="&strMarkerTypes="+strMarkerTypes;strState+="&dMarkerXs="+dMarkersXs;strState+="&dMarkerYs="+dMarkersYs;}}
var the_res="";var i;for(i=0;i<strState.length;++i)
{var to_code_charcode=strState.charCodeAt(i);var char_to_code=strState.charAt(i);var coded_charcode;var coded_char;if((to_code_charcode>=48)&&(to_code_charcode<=57))
{the_res+=String.fromCharCode(57-to_code_charcode+48);}
else if((to_code_charcode>=97)&&(to_code_charcode<=122))
{the_res+=String.fromCharCode(122-to_code_charcode+97);}
else
{var firstOrdNum=Math.floor(to_code_charcode/26);var secOrdNum=to_code_charcode%26;var firstCodedChar=String.fromCharCode(firstOrdNum+65);var secCodedChar=String.fromCharCode(secOrdNum+65);the_res+=firstCodedChar;the_res+=secCodedChar;}}
return the_res;}
this.DecodeState=function(encStrState)
{var strState="";var j=0;while(j<encStrState.length)
{var code=encStrState.charCodeAt(j);if((code>=48)&&(code<=57))
{strState+=String.fromCharCode(57-code+48);j++;}
else if((code>=97)&&(code<=122))
{strState+=String.fromCharCode(122-code+97);j++;}
else
{var firstCode=encStrState.charCodeAt(j)-65;var secCode=encStrState.charCodeAt(j+1)-65;var ch=String.fromCharCode(firstCode*26+secCode);strState+=ch;j++;j++;}}
return strState;}
this.ParseState=function(strState)
{var parsed=new Object();arrParams=strState.split('&');parsed.dX=200;parsed.dY=200;parsed.dRadius=200;parsed.lang="";parsed.arrAddresses=null;parsed.arrX=null;parsed.arrY=null;parsed.bToll=null;parsed.bFerry=null;parsed.bDirtyRoad=null;parsed.arrMarkerCaptions=null;parsed.arrMarkerTypes=null;parsed.arrMarkerXs=null;parsed.arrMarkerYs=null;parsed.trafficType=null;parsed.iCarOptim=null;for(var i=0;i<arrParams.length;i++)
{var arrValues=arrParams[i].split('=');if(arrValues.length>=2)
{var strCommand=arrValues[0].toLowerCase();switch(strCommand)
{case'dx':parsed.dX=arrValues[1];break;case'dy':parsed.dY=arrValues[1];break;case'dradius':parsed.dRadius=arrValues[1];break;case'lang':parsed.lang=arrValues[1];break;case'btoll':parsed.bToll=(parseInt(arrValues[1])!=0?true:false);break;case'bferry':parsed.bFerry=(parseInt(arrValues[1])!=0?true:false);break;case'bdirtyroad':parsed.bDirtyRoad=(parseInt(arrValues[1])!=0?true:false);break;case'arraddresses':parsed.arrAddresses=arrValues[1].split('|');break;case'arrx':parsed.arrX=arrValues[1].split('|');break;case'arry':parsed.arrY=arrValues[1].split('|');break;case'strmarkercaptions':parsed.arrMarkerCaptions=arrValues[1].split('|');break;case'strmarkertypes':parsed.arrMarkerTypes=arrValues[1].split('|');break;case'dmarkerxs':parsed.arrMarkerXs=arrValues[1].split('|');break;case'dmarkerys':parsed.arrMarkerYs=arrValues[1].split('|');break;case'traffictype':parsed.trafficType=arrValues[1];break;case'icaroptim':parsed.iCarOptim=arrValues[1];break;}}}
return parsed;}
this.LoadState=function(encStrState)
{var strState=me.DecodeState(encStrState);if(strState.length<1)
{me.Reset();return;}
var parsed=me.ParseState(strState);if(parsed.trafficType!=null)
me.pRouteSearch.SetTrafficType(parsed.trafficType);if(parsed.bToll!=null)
me.pRouteSearch.bUseTolledRoute=parsed.bToll;if(parsed.bFerry!=null)
me.pRouteSearch.bUseFerry=parsed.bFerry;if(parsed.bDirtyRoad!=null)
me.pRouteSearch.bUseDirtyRoad=parsed.bDirtyRoad;if(parsed.iCarOptim!=null)
me.pRouteSearch.iCarOptim=parsed.iCarOptim;if(parsed.dX!=null&&parsed.dY!=null)
me.ZoomToPoint(parsed.dX,parsed.dY,parsed.dRadius);if(parsed.arrAddresses!=null&&parsed.arrAddresses.length>0)
{var myArr=new Array();for(var i=0;i<parsed.arrAddresses.length;i++)
{myArr[i]=new CSimpleAddress();myArr[i].strAddress=decodeURIComponent(parsed.arrAddresses[i]);myArr[i].dX=parsed.arrX[i];myArr[i].dY=parsed.arrY[i];}
me.pRouteSearch.SetAddressList(myArr);if(parsed.arrAddresses.length>1)
me.pRouteSearch.FindRoute(false);me.pRouteSearch.Show();}
if(parsed.arrMarkerCaptions!=null&&parsed.arrMarkerCaptions.length>0)
{var myArr=new Array();for(var i=0;i<parsed.arrMarkerCaptions.length;i++)
{var address=new CSimpleAddress();address.strAddress=parsed.arrMarkerCaptions[i];address.dX=parsed.arrMarkerXs[i];address.dY=parsed.arrMarkerYs[i];me.AddMarker(address,parsed.arrMarkerTypes[i],0,0);}}}
this.AddMarker=function(address,type,iPixX,iPixY,divDetails)
{var pin_css_class="marker";if(me.iLabelDesignVersion==2)
pin_css_class="marker_v2";var pin_img_url=GetAbsUrl("images/mapctrl/marker.gif");if(me.iLabelDesignVersion==2)
pin_img_url=GetAbsUrl("images/label/f_7.png");if(type=="stop")
{pin_img_url=GetAbsUrl("images/mapctrl/marked_red.gif");if(me.iLabelDesignVersion==2)
pin_img_url=GetAbsUrl("images/label/f_2.png");}
else if(type=="start")
{pin_img_url=GetAbsUrl("images/mapctrl/marked_green.gif");if(me.iLabelDesignVersion==2)
pin_img_url=GetAbsUrl("images/label/f_4.png");}
var dX=address.dX;var dY=address.dY;var arrNames=null;var arrValues=null;var marker=new Marker(me,type,dX,dY,arrNames,arrValues);marker.SetProperty("start_button",me.bLabelHasStartButton);marker.SetProperty("through_button",me.bLabelHasThroughButton);marker.SetProperty("stop_button",me.bLabelHasStopButton);marker.SetProperty("panorama_button",me.bLabelHasPanoramaButton);marker.SetProperty("pin_css_class",pin_css_class);marker.SetProperty("div_label_sign_class","marker");marker.SetProperty("pin_img_url",pin_img_url);marker.SetProperty("pin_img_width",27);marker.SetProperty("pin_img_height",27);if(me.iLabelDesignVersion==2)
{marker.SetProperty("pin_img_refx",11);marker.SetProperty("pin_img_refy",30);marker.SetProperty("label_dx",0);marker.SetProperty("label_dy",-11);}
else
{marker.SetProperty("pin_img_refx",2);marker.SetProperty("pin_img_refy",14);}
marker.SetProperty("delete_marker_on_label_close",(type=="pick"));marker.SetProperty("fix_label_on_click",true);if((address.strAddress!="")&&(address.strAddress!=undefined))
{marker.SetProperty("caption",address.strAddress);marker.SetProperty("Cím",address.strAddress);}
if((address.strName!="")&&(address.strName!=undefined))
{marker.SetProperty("caption",address.strName);marker.SetProperty("Név",address.strName);}
marker.SetProperty("show_coordinates",me.bDisplayCoords);var bDetails=!((divDetails==undefined)||(divDetails==null));marker.SetProperty("handle_details",bDetails);if(bDetails)
marker.SetProperty("details_to_show",divDetails);marker.SetPixelCoordinates(iPixX,iPixY);me.pMarkers.Add(marker);var label=me.CreatePinLabel(marker);label.DrawSign();return marker;}
this.Reset=function()
{if(me.pRouteSearch)
me.pRouteSearch.SetAddressList(null);me.pMarkers.DeleteAll();me.InciServer.CallFunction("DeleteRoute","",0,me.SetMapToDefaultLevelAndPosition());}
this.GetMapData=function()
{if(me.iActiveState>=0)
return me.arrStates[me.iActiveState];return null;}
this.PixelToWgs=function(iX,iY)
{var mapdata=me.arrStates[me.iActiveState];iX-=mapdata.iViewportOffsetX;iY-=mapdata.iViewportOffsetY;var wgsCoord=new CSimplePoi("",0,0);wgsCoord.dX=mapdata.dMinX+(mapdata.dMaxX-mapdata.dMinX)*(iX/mapdata.iMapWidth);wgsCoord.dY=mapdata.dMaxY-(mapdata.dMaxY-mapdata.dMinY)*(iY/mapdata.iMapHeight);return wgsCoord;}
this.OnPick=function(pickMode,iX,iY)
{}
this.AddToTrafficList=function(strAddress,dX,dY)
{var address=new CSimpleAddress(strAddress,dX,dY);me.pRouteSearch.pSearch.SetAddress(address);me.pRouteSearch.pSearch.Go();}
this.Test=function(dZoomFactor,iBasePointX,iBasePointY)
{if(me.bPreviewIsOn)
this.pGridMain.ZoomPreview(dZoomFactor,iBasePointX,iBasePointY,0,0);}
this.DrawLine=function()
{var boxLeft=me.pGridMain.iLeft*me.GetMapGridItemWidth();var boxTop=me.pGridMain.iTop*me.GetMapGridItemHeight();var boxRight=boxLeft+me.pGridMain.iWidth*me.GetMapGridItemWidth();var boxBottom=boxTop+me.pGridMain.iHeight*me.GetMapGridItemHeight();if(me.polyline)
{me.polyline.UnDraw();me.polyline.Draw(me.graphics,me.pixeldensity,boxTop,boxLeft,boxBottom,boxRight);}}
this.CreateZoomAnim=function()
{me.animDiv=document.createElement('div');me.animDiv.style.visibility='hidden';me.animDiv.className='anim_main';me.animDiv.style.top=0;me.animDiv.style.left=0;me.divFace.appendChild(me.animDiv);var animtlDiv=document.createElement('div');animtlDiv.className='anim_tl';var animtrDiv=document.createElement('div');animtrDiv.className='anim_tr';var animblDiv=document.createElement('div');animblDiv.className='anim_bl';var animbrDiv=document.createElement('div');animbrDiv.className='anim_br';me.animDiv.appendChild(animtlDiv);me.animDiv.appendChild(animtrDiv);me.animDiv.appendChild(animblDiv);me.animDiv.appendChild(animbrDiv);}
this.ShowZoomAnimation=function(iOy,iOx,bIn)
{var border=3;if(me.animDiv!=null)
{if(!bIn)
{me.animDiv.style.height="160px";me.animDiv.style.width="160px";me.animDiv.style.top=(iOy-160/2-border)+"px";me.animDiv.style.left=(iOx-160/2-border)+"px";me.animDiv.style.visibility='visible';window.setTimeout(me.TestAnimPhasesIn,100);}
else
{me.animDiv.style.height="40px";me.animDiv.style.width="40px";me.animDiv.style.top=(iOy-40/2-border)+"px";me.animDiv.style.left=(iOx-40/2-border)+"px";me.animDiv.style.visibility='visible';window.setTimeout(me.TestAnimPhasesOut,50);}}}
this.TestAnimPhasesIn=function()
{var step=25;if(GetLayerWidth(me.animDiv)>40)
{var lw=GetLayerWidth(me.animDiv);var lh=GetLayerHeight(me.animDiv);me.animDiv.style.visibility='hidden';var iOx=GetLayerLeft(me.animDiv)+lw/2;var iOy=GetLayerTop(me.animDiv)+lh/2;me.animDiv.style.height=(lh-step)+"px";me.animDiv.style.width=(lw-step)+"px";me.animDiv.style.top=(iOy-(lh-step)/2)+"px";me.animDiv.style.left=(iOx-(lw-step)/2)+"px";me.animDiv.style.visibility='visible';window.setTimeout(me.TestAnimPhasesIn,70);}
else
{me.animDiv.style.visibility='hidden';}}
this.TestAnimPhasesOut=function()
{var step=25;if(GetLayerWidth(me.animDiv)<160)
{var lw=GetLayerWidth(me.animDiv);var lh=GetLayerHeight(me.animDiv);me.animDiv.style.visibility='hidden';var iOx=GetLayerLeft(me.animDiv)+lw/2;var iOy=GetLayerTop(me.animDiv)+lh/2;me.animDiv.style.height=(lh+step)+"px";me.animDiv.style.width=(lw+step)+"px";me.animDiv.style.top=(iOy-(lw+step)/2)+"px";me.animDiv.style.left=(iOx-(lh+step)/2)+"px";me.animDiv.style.visibility='visible';window.setTimeout(me.TestAnimPhasesOut,70);}
else
{me.animDiv.style.visibility='hidden';}}
this.bShowMeterPerPixel=false;this.CreateRatioMeter=function(bShowMeterPerPixel)
{me.bShowMeterPerPixel=bShowMeterPerPixel;me.ratiometerDiv=document.createElement('div');me.ratiometerDiv.style.visibility='visible';me.ratiometerDiv.className='ratiometer';me.divMap.appendChild(me.ratiometerDiv);setAlpha(".ratiometer");var ratiometerrightborderDiv=document.createElement('div');ratiometerrightborderDiv.className='ratiometerrightborder';me.ratiometerDiv.appendChild(ratiometerrightborderDiv);var ratiometerleftborderDiv=document.createElement('div');ratiometerleftborderDiv.className='ratiometerleftborder';me.ratiometerDiv.appendChild(ratiometerleftborderDiv);SetOpac(me.ratiometerDiv,85);NewTag("span",me.ratiometerDiv);}
this.RearrangeRatioMeter=function()
{var avgPixel=100;var minPixel=70;var iMeterPerPixel=me.GetPixelDensity();var pre_realsize=avgPixel*iMeterPerPixel;var pixelsize=avgPixel;var lg=1;while(pre_realsize>100)
{pre_realsize=pre_realsize/10;lg=lg*10;}
var realsize=0;if(pre_realsize<(10+30)/2)
realsize=10;else if(pre_realsize<(30+40)/2)
realsize=30;else if(pre_realsize<(40+50)/2)
realsize=40;else if(pre_realsize<(50+80)/2)
realsize=50;else if(pre_realsize<(80+100)/2)
realsize=80;else
realsize=100;pixelsize=realsize/pre_realsize*pixelsize;if(pixelsize<minPixel)
{pixelsize=2*pixelsize;realsize=2*realsize;}
var unit="";if(realsize*lg>=1000)
{realsize=realsize*lg/1000;unit="km";}
else
{realsize=realsize*lg;unit="m";}
if(me.ratiometerDiv)
{me.ratiometerDiv.style.width=(pixelsize)+"px";var span=me.ratiometerDiv.lastChild;while(span.firstChild)
span.removeChild(span.firstChild)
NewTextTag((realsize)+" "+unit,span);if(me.bShowMeterPerPixel)
{NewTag('br',span);NewTextTag(" ("+iMeterPerPixel+" m/px)",span);}}}
this.CreateMapCaption=function()
{var div=NewTag('div');div.className='UI_mapcaption_container';me.divMapCaption=NewTag('div',div);me.divMapCaption.className='UI_mapcaption';setAlpha(".UI_mapcaption");SetOpac(me.divMapCaption,85);AddTag(div,me.divMap,me.divFace);}
this.CreateCopyrightLabel=function()
{if(me.strCopyrightText!="")
{var div=NewTag('div');div.className='UI_copyrightcaption_container';me.divMapCopyright=NewTag('div',div);me.divMapCopyright.className='UI_copyrightcaption';setAlpha(".UI_copyrightcaption");SetOpac(me.divMapCopyright,85);AddTag(div,me.divMap,me.divFace);NewTextTag(me.strCopyrightText,me.divMapCopyright);}}
this.OnStateChanged=function(sLastRasterMapData,iPixelDeltaX,iPixelDeltaY,caption)
{if((caption==null)||(caption==undefined))
caption="";var mapdata=null;if(sLastRasterMapData)
{mapdata=new CMapData();mapdata.strCaption=sLastRasterMapData.strCaption;mapdata.iMapWidth=me.GetMapViewWidth();mapdata.iMapHeight=me.GetMapViewHeight();mapdata.dCenterX=sLastRasterMapData.dCenterX;mapdata.dCenterY=sLastRasterMapData.dCenterY;mapdata.dRadius=sLastRasterMapData.dMinRadius;mapdata.dMinX=sLastRasterMapData.dViewportLowerLeftX;mapdata.dMinY=sLastRasterMapData.dViewportLowerLeftY;mapdata.dMaxX=sLastRasterMapData.dViewportUpperRightX;mapdata.dMaxY=sLastRasterMapData.dViewportUpperRightY;mapdata.dGridMinX=sLastRasterMapData.dGridLowerLeftX;mapdata.dGridMinY=sLastRasterMapData.dGridLowerLeftY;mapdata.dGridMaxX=sLastRasterMapData.dGridUpperRightX;mapdata.dGridMaxY=sLastRasterMapData.dGridUpperRightY;mapdata.dMeterPerPixelX=mapdata.dMeterPerPixelY=me.GetPixelDensityFromLevel(sLastRasterMapData.iLevel);mapdata.iViewportOffsetX=sLastRasterMapData.iViewportOffsetX;mapdata.iViewportOffsetY=sLastRasterMapData.iViewportOffsetY;}
else
{if(me.iActiveState<0||me.arrStates.length<me.iActiveState||me.arrStates[me.iActiveState]==null)
return;mapdata=new CMapData();mapdata.strCaption=caption;mapdata.iMapWidth=me.arrStates[me.iActiveState].iMapWidth;mapdata.iMapHeight=me.arrStates[me.iActiveState].iMapHeight;mapdata.dCenterX=me.arrStates[me.iActiveState].dCenterX;mapdata.dCenterY=me.arrStates[me.iActiveState].dCenterY;mapdata.dRadius=me.arrStates[me.iActiveState].dRadius;mapdata.dMinX=me.arrStates[me.iActiveState].dMinX;mapdata.dMinY=me.arrStates[me.iActiveState].dMinY;mapdata.dMaxX=me.arrStates[me.iActiveState].dMaxX;mapdata.dMaxY=me.arrStates[me.iActiveState].dMaxY;mapdata.dGridMinX=me.arrStates[me.iActiveState].dGridMinX;mapdata.dGridMinY=me.arrStates[me.iActiveState].dGridMinY;mapdata.dGridMaxX=me.arrStates[me.iActiveState].dGridMaxX;mapdata.dGridMaxY=me.arrStates[me.iActiveState].dGridMaxY;mapdata.dMeterPerPixelX=me.arrStates[me.iActiveState].dMeterPerPixelX;mapdata.dMeterPerPixelY=me.arrStates[me.iActiveState].dMeterPerPixelY;mapdata.iViewportOffsetX=me.arrStates[me.iActiveState].iViewportOffsetX;mapdata.iViewportOffsetY=me.arrStates[me.iActiveState].iViewportOffsetY;}
if(iPixelDeltaX!=0||iPixelDeltaY!=0)
{var dOffsetX=(mapdata.dMaxX-mapdata.dMinX)*iPixelDeltaX/mapdata.iMapWidth;var dOffsetY=(mapdata.dMaxY-mapdata.dMinY)*iPixelDeltaY/mapdata.iMapHeight;mapdata.dCenterX+=dOffsetX;mapdata.dCenterY+=dOffsetY;mapdata.dMinX+=dOffsetX;mapdata.dMinY+=dOffsetY;mapdata.dMaxX+=dOffsetX;mapdata.dMaxY+=dOffsetY;mapdata.dGridMinX+=dOffsetX;mapdata.dGridMinY+=dOffsetY;mapdata.dGridMaxX+=dOffsetX;mapdata.dGridMaxY+=dOffsetY;mapdata.iViewportOffsetX=me.pGridMain.iMapViewVectorX;mapdata.iViewportOffsetY=me.pGridMain.iMapViewVectorY;}
if(!me.bSkipNextStateChange)
{me.arrStates[++me.iActiveState]=mapdata;var i;for(i=me.iActiveState+1;i<me.arrStates.length;i++)
{me.arrStates[i]=null;}}
me.bSkipNextStateChange=false;if(me.OnMapStateChanged)
{try{me.OnMapStateChanged();}
catch(exp)
{if(me.OnError)
me.OnError(exp,'CTopoliszMap.OnMapStateChanged');}}
WaCount();window.status=mapdata.dMeterPerPixelX;}
this.OnMapStateChanged=function()
{}
this.Undo=function()
{if(me.iActiveState>0)
{var mapdata=me.arrStates[--me.iActiveState];if(mapdata)
{me.bSkipNextStateChange=true;me.ZoomToRect(mapdata.dMinX,mapdata.dMinY,mapdata.dMaxX,mapdata.dMaxY);}}}
this.Redo=function()
{if(me.iActiveState<GetArrayLength(me.arrStates))
{var mapdata=me.arrStates[++me.iActiveState];if(mapdata)
{me.bSkipNextStateChange=true;me.ZoomToRect(mapdata.dMinX,mapdata.dMinY,mapdata.dMaxX,mapdata.dMaxY);}}}
this.OnOffMeasureDistance=function(sSrc)
{if(me.bDistanceMeasuring==false)
{me.bDistanceMeasuring=true;me.SetVisibilityBorders(me.pGridMain.bCanMoveX,me.pGridMain.bCanMoveY);me.pDistancePoly.Init();me.DistMeter.Init();me.pDistanceDisplay=new DistanceDisplay(me);me.DistMeter.onMove=me.pDistanceDisplay.Move;me.DistMeter.DisplayLength=me.pDistanceDisplay.DisplayLength;me.DistMeter.onClose=function(){{me.pDistanceDisplay.Close();}}
if(me.pMapPalette)
SetImage(me.pMapPalette.imgDistanceMeasure,GetAbsUrl("design/ICON_measure_off.gif"),17,17,"Distance");}
else
{if((sSrc!="button"&&sSrc!="key"))
{var x=me.iMousePosX;var y=me.iMousePosY;x-=GetLayerLeft(me.pGridMain.mainGridDiv)+me.iMapDivBorderWidth;y-=GetLayerTop(me.pGridMain.mainGridDiv)+me.iMapDivBorderWidth;me.DrawDistMeasure(x,y);}
else
{me.DistMeter.ClearRubberLine();me.DistMeter.ClearCursors();}
if(me.pDistanceDisplay)
{me.pDistanceDisplay.distTr.style.display="none";me.pDistanceDisplay.exitTr.style.display="none";}
me.bDistanceMeasuring=false;me.SetVisibilityBorders(me.pGridMain.bCanMoveX,me.pGridMain.bCanMoveY);SetOpac(me.pGridMain.mainGridDistMeasureImageDiv,99);var i;for(i=0;i<80;i++)
{window.setTimeout(me.OpacityGame,i*40);}
window.setTimeout(me.OffMeasureDistance,3500);}}
this.BlinkDistance=function()
{if(me.pGridMain.mainGridDiv.style.visibility=="visible")
{me.pGridMain.mainGridDiv.style.visibility="hidden";}
else
{me.pGridMain.mainGridDiv.style.visibility="visible";}}
this.OpacityGame=function()
{var o=GetOpac(me.pGridMain.mainGridDistMeasureImageDiv);if(Math.floor(o/2)==Math.ceil(o/2))
{o=o+10;}
else
{o=o-10;}
if(o<0)o=0;if(o>100)o=99;SetOpac(me.pGridMain.mainGridDistMeasureImageDiv,o);}
this.OffMeasureDistance=function()
{SetOpac(me.pGridMain.mainGridDistMeasureImageDiv,100);me.bDistanceMeasuring=false;me.DistMeter.Close();if(me.pMapPalette)
SetImage(me.pMapPalette.imgDistanceMeasure,GetAbsUrl("design/ICON_measure_on.gif"),17,17,"Distance");me.pDistancePoly.Init();me.pGridMain.mainGridDistMeasureImageDiv.style.visibility="hidden";me.pGridMain.SetMainGridDistMeasureImage(null);}
this.IsMiniMapVisible=function()
{return me.pConnectedMiniMap!=null&&me.bMiniMapVisible;}
this.HideMiniMap=function()
{if(me.pConnectedMiniMap!=null)
{me.pConnectedMiniMap.divMap.style.display="none";me.pConnectedMiniMap.SetVisibilityBorders(false,false);me.bMiniMapVisible=false;if(me.pConnectedMiniMap.pGridMain)
me.pConnectedMiniMap.pGridMain.RemoveZoomPreview();}
if(me.OnHideMiniMap)
{try{me.OnHideMiniMap();}
catch(exp){if(me.OnError)
me.OnError(exp,'CTopoliszMap.OnHideMiniMap');}}}
this.CreateMiniMap=function()
{var divMiniMap=NewTag("div");var strMiniMapId=me.divMap.id+"mm";AddTag(divMiniMap,me.divMap);divMiniMap.setAttribute("id",strMiniMapId);divMiniMap.className="minimap";me.pConnectedMiniMap=new CTopoliszMap(me.strSessionID,divMiniMap,false);me.pConnectedMiniMap.bDrawTMC=false;me.pConnectedMiniMap.strRole="minimap";me.pConnectedMiniMap.Init();me.pConnectedMiniMap.SetAsMiniMap(me);me.pConnectedMiniMap.pMiniMapFrame=new CMiniMapFrame(me,me.pConnectedMiniMap);}
this.ShowMiniMap=function()
{if(me.pConnectedMiniMap==null)
{me.CreateMiniMap();}
if(me.pConnectedMiniMap!=null)
{me.bMiniMapVisible=true;me.ZoomMiniMapSync(me.GetPixelDensity(),0,0,false);me.pConnectedMiniMap.divMap.style.display="";if(me.pMapPalette!=null)
SetImage(me.pMapPalette.imgMiniMap,"images/mapctrl/hideminimap_utvonalterv.png",14,14,"");if(me.OnShowMiniMap)
{try{me.OnShowMiniMap();}
catch(exp){if(me.OnError)
me.OnError(exp,'CTopoliszMap.OnShowMiniMap');}}}}
this.OnShowMiniMap=null;this.OnHideMiniMap=null;this.OnKeyDown=function(pEvent)
{if(me.bDistanceMeasuring==true)
{me.OnOffMeasureDistance("key");}}
this.OnRouteChanged=function(sAddress)
{}
this.OnNewFoundAddress=function(sAddress)
{me.pMarkers.DeleteAll();if(sAddress.strAddress=="")
sAddress.strAddress="< ??? >";var pMarker=me.AddMarker(sAddress,"searching",0,0);var label=me.CreatePinLabel(pMarker);label.DrawSign();label.Hide();}
this.OnNewPickedAddress=function(sAddress,iPickPointX,iPickPointY,strMarkerClass)
{me.pMarkers.DeleteAllWithType(strMarkerClass);var marker=me.AddMarker(sAddress,strMarkerClass,iPickPointX,iPickPointY);marker.pLabel.DrawBox();me.OnLabelSignClick(marker);}
this.PreLabelCreate=null;this.OnLabelCreate=null;this.CreatePinLabel=function(pMarker)
{var label=new PinLabel(me,pMarker);me.pLabels[me.pLabels.length]=label;pMarker.pLabel=label;return label;}
this.RemovePinLabels=function(mainType)
{var i;for(i=0;i<me.pLabels.length;i++)
{var al=me.pLabels[i];if(al!=null)
{if((al.pMarker.mainType==mainType)||(mainType==null)||(mainType==undefined))
{al.Delete();delete al;me.pLabels[i]=null;}}}}
this.RemovePinLabelsSpec=function()
{var i;for(i=0;i<me.pLabels.length;i++)
{var al=me.pLabels[i];if(al!=null)
{al.RemoveSign();al.DestroyDivLabelBox();al.pMarker.pLabel=null;delete al;me.pLabels[i]=null;}}}
this.RemovePinLabelsExclusive=function(mainType)
{var i;for(i=0;i<me.pLabels.length;i++)
{var al=me.pLabels[i];if(al!=null)
{if(al.pMarker.mainType!=mainType)
{al.Delete();delete al;me.pLabels[i]=null;}}}}
this.RemovePinLabelsExclusiveMulti=function(typelist)
{var i;for(i=0;i<me.pLabels.length;i++)
{var al=me.pLabels[i];if(al!=null)
{var j;var bNotInList=true;for(j=0;j<typelist.length;j++)
{if(typelist[j]==al.pMarker.mainType)
{bNotInList=false;break;}}
if(bNotInList)
{al.Delete();delete al;me.pLabels[i]=null;}}}}
this.OnPinLabelBoxCreated=function(pMarker)
{if(pMarker!=me.pFixedMarker)
{if(me.pFixedMarker!=null)
{if(me.pFixedMarker.pLabel!=null)
me.pFixedMarker.pLabel.RemoveBox();me.pFixedMarker=null;}}}
this.OnPinLabelBoxDestroyed=function(pMarker)
{if(me.pFixedMarker==pMarker)
me.pFixedMarker=null;}
this.OnLabelSignMouseOut=function(pMarker)
{if(pMarker!=me.pFixedMarker)
pMarker.pLabel.RemoveBox();}
this.OnLabelSignMouseOver=function(pMarker)
{if(me.pFixedMarker==null)
{me.RemovePinBoxes();if(pMarker.pLabel)
{if(pMarker.bMouseOverEnabled)
pMarker.pLabel.DrawBox();}}}
this.OnLabelSignClick=function(pMarker)
{if(me.pFixedMarker!=pMarker)
{if(me.pFixedMarker!=null)
{if(me.pFixedMarker.pLabel)
me.pFixedMarker.pLabel.RemoveBox();me.pFixedMarker=null;}
if(pMarker.GetProperty("fix_label_on_click"))
{me.pFixedMarker=pMarker;var ServerID=pMarker.GetProperty("get_wgs_from_server");if(ServerID!="???")
me.iMustVisibleMarkerSID=ServerID;}
if(pMarker.pLabel)
pMarker.pLabel.DrawBox();}}
this.VehicleTypeIsTrain=function(id)
{if(id>=13)
return true;else
return false;}
this.MarkerDataArrived=function(data,pMarker)
{if(data==null)
{alert("Nincs megállóhely adat!");return;}
var PTDataDrawer=function(div)
{var domTable=NewTag("table",div);domTable.className="ptstops";var domTableBody=NewTag("tbody",domTable);var bContainsAnyValidName=false;var bContainsAnyValidDescription=false;var bContainsAnyValidVehicleType=false;var arrTDNames=new Array();var arrTDDescriptions=new Array();var arrTDVehicleTypes=new Array();var domTableRow=NewTag("tr",domTableBody);var domTableData_Name=NewTag("th",domTableRow);arrTDNames.push(domTableData_Name);domTableData_Name.style.paddingBottom="6px";var domTableData_Description=NewTag("th",domTableRow);arrTDDescriptions.push(domTableData_Description);domTableData_Description.style.paddingBottom="6px";var domTableData_VehicleType=NewTag("th",domTableRow);arrTDVehicleTypes.push(domTableData_VehicleType);domTableData_VehicleType.style.paddingBottom="6px";var domTableData_Link=NewTag("th",domTableRow);domTableData_Link.style.paddingBottom="6px";NewTextTag(g_Babel.GetWord('capPTStop_run'),domTableData_Name);NewTextTag(g_Babel.GetWord('capPTStop_name'),domTableData_Description);NewTextTag(g_Babel.GetWord('capPTStop_type'),domTableData_VehicleType);NewTextTag("",domTableData_Link);var i=0;var bTooMany=false;for(i=0;i<data.arrRuns.length;i++)
{domTableRow=NewTag("tr",domTableBody);domTableData_Name=NewTag("td",domTableRow);arrTDNames.push(domTableData_Name);domTableData_Description=NewTag("td",domTableRow);arrTDDescriptions.push(domTableData_Description);domTableData_VehicleType=NewTag("td",domTableRow);arrTDVehicleTypes.push(domTableData_VehicleType);domTableData_Link=NewTag("td",domTableRow);var runitem=data.arrRuns[i];var bIsTrain=me.VehicleTypeIsTrain(runitem.iVehicleTypeID);if(runitem.bShowName&&!bIsTrain)
{var spanName=NewTag("span",domTableData_Name);if(runitem.strName!="")bContainsAnyValidName=true;spanName.className=runitem.strClass;NewTextTag(runitem.strName,spanName);}
if(runitem.bShowDescription)
{if(runitem.strDescription!="")bContainsAnyValidDescription=true;var divDescription=NewTag("div",domTableData_Description);divDescription.style.whiteSpace="nowrap";NewTextTag(runitem.strDescription,divDescription);}
if(bIsTrain)
{var divVehicleType=NewTag("div",domTableData_VehicleType);divVehicleType.style.whiteSpace="nowrap";NewTextTag(runitem.strVehicleType,divVehicleType);bContainsAnyValidVehicleType=true;}
if(runitem.strLink!="")
{var divLink=NewTag("div",domTableData_Link);var aLink=NewTag("a",divLink);divLink.onclick=function(pEvent){StopEventPropagation(pEvent);return false;}
aLink.setAttribute("href","javascript:void(0)");aLink.myhref=runitem.strLink;aLink.onclick=function()
{if(me.pLastMouseOverPin!=null)
{if(me.pLastMouseOverPin.pLabel!=null)
{me.pLastMouseOverPin.pLabel.RemoveBox();}}
window.open(this.myhref);}
aLink.style.whiteSpace="nowrap";NewTextTag(g_Babel.GetWord('capPTStop_schedule'),aLink);}
if(i>10)
{bTooMany=true;break;}}
if(bTooMany==true)
{var toomanyDiv=NewTag("div",div);toomanyDiv.style.paddingLeft="12px";NewTextTag("...",toomanyDiv);}
if(bContainsAnyValidName==false)
{var i=0;for(i=0;i<arrTDNames.length;i++)
{arrTDNames[i].style.display="none";}}
if(bContainsAnyValidDescription==false)
{var i=0;for(i=0;i<arrTDDescriptions.length;i++)
{arrTDDescriptions[i].style.display="none";}}
if(bContainsAnyValidVehicleType==false)
{var i=0;for(i=0;i<arrTDVehicleTypes.length;i++)
{arrTDVehicleTypes[i].style.display="none";}}
if(data.strLink!="")
{var divLocLink=NewTag("div",div);var aLocLink=NewTag("a",divLocLink);divLocLink.onclick=function(pEvent){StopEventPropagation(pEvent);return false;}
aLocLink.style.display="block";aLocLink.style.padding="12px";aLocLink.style.paddingTop="3px";aLocLink.style.color="blue";aLocLink.setAttribute("href","javascript:void(0)");aLocLink.onclick=function()
{if(me.pLastMouseOverPin!=null)
{if(me.pLastMouseOverPin.pLabel!=null)
{me.pLastMouseOverPin.pLabel.RemoveBox();}}
window.open(data.strLink);}
aLocLink.style.whiteSpace="nowrap";NewTextTag(g_Babel.GetWord('capPTStop_stationschedule'),aLocLink);}}
if((data.strName!=null)&&(data.strName!=undefined))
{var strCaption=data.strName;var pMapData=me.GetMapData();if(data.strCity!=null&&data.strCity!=""&&strCaption.indexOf(data.strCity)<0&&pMapData.strCaption.indexOf(data.strCity)<0)
{strCaption=data.strCity+" "+strCaption;}
pMarker.SetProperty("caption",strCaption);}
pMarker.DrawBoxContentData=PTDataDrawer;pMarker.bContentLoaded=true;if(pMarker.pLabel!=null)
pMarker.pLabel.DrawBox_Default();}
this.RemovePinBoxes=function(mainType)
{if(me.pMarkers!=null)
{var i;for(i=0;i<me.pMarkers.arrMarkers.length;i++)
{var m=me.pMarkers.arrMarkers[i];if(m!=null)
{if((mainType==undefined)||(mainType==null)||(mainType==m.mainType))
{var al=m.pLabel;if(al!=null)
al.RemoveBox();}}}}}
this.RemovePinBoxesExclusive=function(mainType)
{if(me.pLabels!=null)
{var i;for(i=0;i<me.pLabels.length;i++)
{var al=me.pLabels[i];if(al!=null)
{if(mainType!=al.pMarker.mainType)
al.RemoveBox();}}}}
this.RemovePinBoxesExclusiveMulti=function(typelist)
{if(me.pLabels!=null)
{var i;for(i=0;i<me.pLabels.length;i++)
{var al=me.pLabels[i];if(al!=null)
{var j;var bNotInList=true;for(j=0;j<typelist.length;j++)
{if(typelist[j]==al.pMarker.mainType)
{bNotInList=false;break;}}
if(bNotInList)
al.RemoveBox();}}}}
this.RemoveLayerPOIBoxes=function()
{if(typeof(g_TopoliszControls)!="undefined"&&g_TopoliszControls&&g_TopoliszControls.pExtraInfo&&g_TopoliszControls.pExtraInfo.pPoiBox)
g_TopoliszControls.pExtraInfo.pPoiBox.DeselectPOI();}
this.RearrangeLabels=function()
{var i;for(i=0;i<me.pLabels.length;i++)
{var al=me.pLabels[i];if(al!=null)
{al.ReArrange();}}}
this.RearrangePois=function()
{if(me.divPoiParent)
{me.divPoiParent.style.left=-me.pGridMain.GetMapViewVectorX()+"px";me.divPoiParent.style.top=-me.pGridMain.GetMapViewVectorY()+"px";}}
this.HidePois=function()
{if(me.divPoiParent)
{me.divPoiParent.style.visibility="hidden";}}
this.ShowPois=function()
{if(me.divPoiParent)
{me.divPoiParent.style.visibility="visible";}}
this.ShowPinLabels=function(mainType)
{var i;for(i=0;i<me.pLabels.length;i++)
{var al=me.pLabels[i];if(al!=null)
{if((mainType==undefined)||(mainType==null)||(mainType==al.pMarker.mainType))
{al.Show();}}}}
this.ShowPinLabelsMulti=function(typelist)
{var i;for(i=0;i<typelist.length;i++)
me.ShowPinLabels(typelist[i]);}
this.HidePinLabels=function(mainType)
{var i;for(i=0;i<me.pLabels.length;i++)
{var al=me.pLabels[i];if(al!=null)
{if((mainType==undefined)||(mainType==null)||(mainType==al.pMarker.mainType))
{al.Hide();}}}}
this.HidePinLabelsMulti=function(typelist)
{var i;for(i=0;i<typelist.length;i++)
me.HidePinLabels(typelist[i]);}
this.SetDisplayCoords=function(bEnable)
{me.bDisplayCoords=bEnable;setCookie('bDisplayCoords',me.bDisplayCoords);var arrays=new Array(me.pLabels);var iArray,iLabel;for(iArray=0;iArray<arrays.length;iArray++)
{for(iLabel=0;iLabel<arrays[iArray].length;iLabel++)
{var lab=arrays[iArray][iLabel];if(lab!=null)
{lab.pMarker.SetProperty("show_coordinates",bEnable);lab.RemoveBox();}}}}
this.PropertyChanged=function(strProperty)
{for(var i=0;i<me.arrPropertyChangedListeners.length;i++)
{var listener=me.arrPropertyChangedListeners[i];if(listener&&listener.strProperty==strProperty&&listener.funcOnChanged)
{listener.funcOnChanged();}}}
this.AddPropertyChangedListener=function(strProperty,funcOnChanged)
{me.arrPropertyChangedListeners[me.arrPropertyChangedListeners.length]=new PropertyChangedEventListener(strProperty,funcOnChanged);}
this.SetDrawTMC=function(bEnable,bSilent)
{if(bEnable!=m_bDrawTMC)
{m_bDrawTMC=bEnable;setCookie('bDrawTMC',m_bDrawTMC);me.PropertyChanged("bDrawTMC");if(!bSilent){me.DrawRoute();}}}
this.SetDrawTMCWeather=function(bEnable,bSilent)
{if(bEnable!=m_bDrawTMCWeather)
{m_bDrawTMCWeather=bEnable;setCookie('bDrawTMCWeather',m_bDrawTMCWeather);me.PropertyChanged("bDrawTMCWeather");if(!bSilent){me.DrawRoute();}}}
this.AddDrawTMCChangedListener=function(funcOnChanged)
{me.AddPropertyChangedListener("bDrawTMC",funcOnChanged);}
this.AddDrawTMCWeatherChangedListener=function(funcOnChanged)
{me.AddPropertyChangedListener("bDrawTMCWeather",funcOnChanged);}
this.IsDrawPTStopsGlobal=function()
{return m_bDrawPTStopsGlobal;}
this.IsDrawPTStopsLocal=function()
{return m_bDrawPTStopsLocal;}
this.SetDrawPTStopsGlobal=function(bEnable,bSilent)
{if(bEnable!=m_bDrawPTStopsGlobal)
{m_bDrawPTStopsGlobal=bEnable;me.PropertyChanged("bDrawPTStopsGlobal");if(!bSilent){me.DrawRoute();}}}
this.SetDrawPTStopsLocal=function(bEnable,bSilent)
{if(bEnable!=m_bDrawPTStopsLocal)
{m_bDrawPTStopsLocal=bEnable;me.PropertyChanged("bDrawPTStopsLocal");if(!bSilent){me.DrawRoute();}}}
this.AddDrawPTStopsGlobalChangedListener=function(funcOnChanged)
{me.AddPropertyChangedListener("bDrawPTStopsGlobal",funcOnChanged);}
this.AddDrawPTStopsLocalChangedListener=function(funcOnChanged)
{me.AddPropertyChangedListener("bDrawPTStopsLocal",funcOnChanged);}
this.ChangePickMode=function()
{if(me.bPickMode==true)
me.ResetPickMode();else
me.SetPickMode("internal");}
this.SetPickMode=function(strPickMode)
{me.bPickMode=true;me.strPickMode=strPickMode;me.divFace.style.cursor="crosshair";}
this.ResetPickMode=function()
{me.bPickMode=false;me.strPickMode="internal";me.divFace.style.cursor="pointer";}
this.UserPicked=function(pEvent)
{if(!me.bUserPickEnabled){return;}
var xxx=GetEventXNew(pEvent)-GetAbsLayerLeft(me.pGridMain.mainGridDiv);var yyy=GetEventYNew(pEvent)-GetAbsLayerTop(me.pGridMain.mainGridDiv);var bOnPoi=false;var obj=GetEventSourceElement(pEvent);var pPoiMouseOver=me.GetPoiNearXY(xxx,yyy);if(pPoiMouseOver!=null)
{if((obj.className=="face")||(obj.className=="poiParent"))
bOnPoi=true;}
if(bOnPoi==true)
return;if(me.strPickMode=="internal"||me.strPickMode=="labelless")
{var MapLevel=me.GetLevel();AddressLevel="9";var Params='';Params+='iAddressLevel='+AddressLevel;Params+='&iGridX='+(xxx);Params+='&iGridY='+(yyy);Params+='&iLevel='+MapLevel;Params+='&iGridUpperRow='+me.pGridMain.GetTop();Params+='&iGridLeftColumn='+me.pGridMain.GetLeft();Params+='&iGridLowerRow='+me.pGridMain.GetBottom();Params+='&iGridRightColumn='+me.pGridMain.GetRight();Params+='&bNorc=true';var clientparam=new Object();clientparam.pickpoint=new CCoordinate(xxx,yyy);clientparam.strMarkerClass=(me.strPickMode=="internal"?"pick":"picknolabel");me.NoSessionServer.CallFunction("ReverseGeoCodeAddress",Params,0,me.UserPickedCallback,clientparam);}
var strPickMode=me.strPickMode;me.ResetPickMode();if(me.OnPick)
{try{me.OnPick(strPickMode,xxx,yyy);}catch(exp){if(me.OnError)
me.OnError(exp,'CTopoliszMap.OnPick');}}}
this.UserPickedCallback=function(addressresult,clientparam)
{var address=addressresult;if(me.HandleAddress){me.HandleAddress(address);}
var pickpoint=clientparam.pickpoint;var strMarkerClass=clientparam.strMarkerClass;me.pMarkers.DeleteAllWithType("pick");if(address!=null)
{me.OnNewPickedAddress(address,pickpoint.dX,pickpoint.dY,strMarkerClass);}}
this.Pixel2AC=function(iGridX,iGridY,callbackFunction,callbackParam)
{var Params='';Params+='&iGridX='+iGridX;Params+='&iGridY='+iGridY;Params+='&iLevel='+me.GetLevel();Params+='&iGridUpperRow='+me.pGridMain.GetTop();Params+='&iGridLeftColumn='+me.pGridMain.GetLeft();Params+='&iGridLowerRow='+me.pGridMain.GetBottom();Params+='&iGridRightColumn='+me.pGridMain.GetRight();me.NoSessionServer.CallFunction("Pixel2AC",Params,0,callbackFunction,callbackParam);}
this.OnReadyStateChangeInternal=function(iState,iTag)
{var somebody=(me.pConnectedMainMap?me.pConnectedMainMap:me);somebody.OnReadyStateChange(iState,iTag);}
this.OnCommandReadyInternal=function(iCommandID)
{var somebody=(me.pConnectedMainMap?me.pConnectedMainMap:me);somebody.OnCommandReady(iCommandID);}
this.OnCommandErrorInternal=function(exp,iCommandID)
{var somebody=(me.pConnectedMainMap?me.pConnectedMainMap:me);somebody.OnCommandError(exp,iCommandID);}
this.OnReadyStateChange=function(iState)
{}
this.OnCommandReady=function(iCommandID)
{}
this.OnCommandError=function(exp)
{}
this.OnError=function(exp,strSource)
{alert(strSource+": "+exp);}
this.Redraw=function()
{if((me.bZoomingHappens==false))
{me.RedrawWithoutZooming();me.iZoomingLevelChange=0;if(me.bInitPhase==false)
me.ZoomByLevelMain(true);}}
this.RedrawWithoutZooming=function()
{me.RearrangeFaceBorder();var clipLeft=GetLayerLeft(divMap);var clipTop=GetLayerTop(divMap);var clipRight=clipLeft+GetLayerWidth(divMap);var clipBottom=clipTop+GetLayerHeight(divMap);me.iMapViewWidth=clipRight-clipLeft-me.iMapDivBorderWidth;me.iMapViewHeight=clipBottom-clipTop-me.iMapDivBorderWidth;me.divFace.style.width=Math.max(0,(GetLayerWidth(divMap)-2*me.iMapDivBorderWidth))+"px";me.divFace.style.height=Math.max(0,(GetLayerHeight(divMap)-2*me.iMapDivBorderWidth))+"px";if(me.pConnectedMiniMap)
{if(me.pConnectedMiniMap.pMiniMapFrame)
me.pConnectedMiniMap.pMiniMapFrame.ReArrange(true);}}
this.TesztResize=function(w,h)
{me.divMap.style.width=w+"px";me.divMap.style.height=h+"px";}
this.SetMapDivBorderWidth=function(iBorderWidth)
{this.iMapDivBorderWidth=iBorderWidth;}
this.SetPoiLayers=function(sPoiLayers)
{me.sPoiLayers=sPoiLayers;}
this.GetPoiLayers=function()
{return me.sPoiLayers;}
this.GetPoiNearXY=function(x,y)
{var i;var l=me.arrPoisOnGrid.length;for(i=0;i<l;i++)
{var pPoi=me.arrPoisOnGrid[i];if(pPoi!=null)
{if((Math.abs((pPoi.iX-x))<10)&&(Math.abs((pPoi.iY-y))<10))
{return pPoi;}}}
return null;}
this.SetNormalCursor=function()
{if(me.pGridMain)
{if(me.bFocused)
{if(me.m_bRubberMode==true)
{if(me.m_bZoomRectVsMoveModeInverted==false)
{me.divPoiParent.style.cursor="crosshair";me.divFace.style.cursor="crosshair";}
else
{me.divPoiParent.style.cursor="pointer";me.divFace.style.cursor="pointer";}}
else
{if(me.m_bZoomRectVsMoveModeInverted==true)
{me.divPoiParent.style.cursor="crosshair";me.divFace.style.cursor="crosshair";}
else
{me.divPoiParent.style.cursor="pointer";me.divFace.style.cursor="pointer";}}}
else
{me.divPoiParent.style.cursor="default";me.divFace.style.cursor="default";}}}
this.ShowMapCaption=function(strCaption)
{if(me.bEnableMapCaption)
{if(me.divMapCaption==null)
me.CreateMapCaption();while(me.divMapCaption.firstChild)
me.divMapCaption.removeChild(me.divMapCaption.firstChild);if(strCaption=="")
strCaption=me.strDefaultCountry;NewTextTag(strCaption,me.divMapCaption);}}
this.ShowToolTip=function(pEvent,caption)
{var left=GetEventXNew(pEvent);var top=GetEventYNew(pEvent);if(me.divToolTip)
{me.divToolTip.style.top=(top+15)+"px";me.divToolTip.style.left=(left+15)+"px";me.divToolTip.style.zIndex=1000;me.divToolTip.innerHTML=caption;me.divToolTip.style.display="";window.setTimeout(me.HideToolTip,3000);}}
this.HideToolTip=function()
{if(me.divToolTip)
me.divToolTip.style.display="none";}
this.CreateToolTip=function()
{me.divToolTip=NewTag("div");me.divToolTip.className="tooltip";me.divToolTip.style.display="none";var divUniverse=GetBlock("idUniverse");if(divUniverse)
AddTag(me.divToolTip,divUniverse);}
this.IsDrawUTV=function()
{return m_bDrawUTV;}
this.SetDrawUTV=function(bEnable,bSilent)
{if(bEnable!=m_bDrawUTV)
{m_bDrawUTV=bEnable;if(!bSilent){if(m_bDrawUTV)
{if(m_arrUTVCameras==null||m_arrUTVCameras.length<1)
{me.NoSessionServer.CallFunction("GetUTV","",0,me.SetUtvCameras);}
else
{me.ShowUtvCameras();}}
else
{me.RemovePinBoxes("utv");me.RemovePinLabels("utv");me.pMarkers.DeleteAllWithType("utv");}}
me.PropertyChanged("bDrawUTV");}}
this.AddDrawUTVChangedListener=function(funcOnChanged)
{me.AddPropertyChangedListener("bDrawUTV",funcOnChanged);}
this.SetUtvCameras=function(utvlist,pDummy,iCommandID)
{m_arrUTVCameras=utvlist;if(utvlist!=null&&utvlist.length>0)
{m_dUTVMinX=utvlist[0].x;m_dUTVMinY=utvlist[0].y;m_dUTVMaxX=utvlist[0].x;m_dUTVMaxY=utvlist[0].y;for(var i=0;i<utvlist.length;i++)
{if(m_dUTVMinX>utvlist[i].x)
m_dUTVMinX=utvlist[i].x;if(m_dUTVMinY>utvlist[i].y)
m_dUTVMinY=utvlist[i].y;if(m_dUTVMaxX<utvlist[i].x)
m_dUTVMaxX=utvlist[i].x;if(m_dUTVMaxY<utvlist[i].y)
m_dUTVMaxY=utvlist[i].y;}
me.ShowUtvCameras();}
else
{m_dUTVMinX=m_dUTVMinY=m_dUTVMaxX=m_dUTVMaxY=0;}}
this.ShowUtvCameras=function()
{if(m_arrUTVCameras==null||m_arrUTVCameras.length<1)
return;for(var i=0;i<m_arrUTVCameras.length;i++)
{var imgExt=(/MSIE (5\.5)|[6]/.test(navigator.userAgent)&&navigator.platform=="Win32")?".gif":".png";var rad=m_arrUTVCameras[i].angle*Math.PI/180;var type="utv";var dX=m_arrUTVCameras[i].x;var dY=m_arrUTVCameras[i].y;var marker=new Marker(me,type,dX,dY,null,null);marker.SetProperty("start_button",false);marker.SetProperty("through_button",false);marker.SetProperty("stop_button",false);marker.SetProperty("panorama_button",false);marker.SetProperty("close_button",false);marker.SetProperty("pinnumber",0);marker.SetProperty("handle_details",false);marker.SetProperty("pin_css_class","markerUTV");marker.SetProperty("div_label_sign_class","markerUTV");marker.SetProperty("pin_img_url","design/utv/"+m_arrUTVCameras[i].angle+imgExt);marker.SetProperty("pin_img_width",25);marker.SetProperty("pin_img_height",25);marker.SetProperty("pin_img_refx",Math.round(12-m_arrUTVCameras[i].pixelradius*Math.sin(rad)));marker.SetProperty("pin_img_refy",Math.round(12+m_arrUTVCameras[i].pixelradius*Math.cos(rad)));marker.SetProperty("delete_marker_on_label_close",false);marker.SetProperty("caption",unescape(m_arrUTVCameras[i].name));marker.SetProperty("show_coordinates",me.bDisplayCoords);marker.SetProperty("labelbox_css_classname","labelboxUTV");marker.SetProperty("LeglessLabel","true");marker.SetProperty("label_dx",0);marker.SetProperty("label_dy",+15);var SET_func_label_sign_on_click=function(i)
{var func_label_sign_on_click=function(){var utv=new CUTV(m_arrUTVCameras[i].id,m_arrUTVCameras[i].x,m_arrUTVCameras[i].y,m_arrUTVCameras[i].address,m_arrUTVCameras[i].name,m_arrUTVCameras[i].camUrl,m_arrUTVCameras[i].angle,m_arrUTVCameras[i].pixelradius);me.ShowUtvCam(utv);}
marker.SetProperty("func_label_sign_on_click",func_label_sign_on_click);}
SET_func_label_sign_on_click(i);me.pMarkers.Add(marker);}
me.DrawRoute();}
this.ShowUtvCam=function(pUTV)
{var containerDiv=GetBlock("utvCam");var dataDiv=null;var iframe=null;if(!containerDiv)
{containerDiv=NewTag("div",me.GetMapDiv());containerDiv.setAttribute("id","utvCam");containerDiv.style.position="absolute";containerDiv.style.bottom="0px";containerDiv.style.right="0px";containerDiv.style.width="160px";containerDiv.style.zIndex="100";containerDiv.style.border="1px Red";}
else
{while(containerDiv.firstChild!=containerDiv.lastChild)
containerDiv.removeChild(containerDiv.firstChild);dataDiv=containerDiv.lastChild;iframe=dataDiv.firstChild;}
var closediv=NewTag("div",containerDiv,dataDiv);closediv.className="labelclose";a=NewTag("a",closediv);a.setAttribute("href","javascript:void(0)");a.onclick=me.HideUtvCam;var img=NewTag("img",a);SetImage(img,GetAbsUrl("images/mapctrl/close.gif"),12,12,"Bezár");var caption=NewTag('div',containerDiv,dataDiv);caption.ondragstart=function(){return false;};caption.onselectstart=function(){return false;};caption.className="utvlabelcaption";caption.style.whiteSpace="normal";caption.style.paddingRight="12px";NewTextTag(unescape(pUTV.address),caption);NewTag('br',caption);var strName=unescape(pUTV.name);var iPos=strName.indexOf('(');if(iPos>0)
{NewTextTag(strName.substr(0,iPos),caption);NewTag('br',caption);NewTextTag(strName.substr(iPos),caption);}
else
NewTextTag(strName,caption);if(!iframe)
{var dataDiv=NewTag('div',containerDiv);dataDiv.style.width="160px";dataDiv.style.height="120px";dataDiv.style.textAlign="center";dataDiv.style.backgroundColor="#FFFFFF";dataDiv.style.backgroundPosition="center";dataDiv.style.backgroundRepeat="no-repeat";dataDiv.style.backgroundImage="url('"+GetAbsUrl("images/partners/utvlogo.png")+"')";iframe=NewIframe("?Command=Flash&width=160&height=120&url="+pUTV.GetSafeCamUrl(),160,120);iframe.style.margin="0px";AddTag(iframe,dataDiv);}
else
{containerDiv.style.display="";iframe.src="?Command=Flash&width=160&height=120&url="+pUTV.GetSafeCamUrl();}}
this.HideUtvCam=function()
{var containerDiv=GetBlock("utvCam");if(containerDiv)
{containerDiv.style.display="none";var iframe=containerDiv.lastChild.firstChild;iframe.src="";}}
this.IsDrawDailyNews=function()
{return me.m_bDrawDailyNews;}
this.SetDrawDailyNews=function(bEnable,bSilent)
{if(bEnable!=me.m_bDrawDailyNews)
{me.m_bDrawDailyNews=bEnable;if(!bSilent){if(me.m_bDrawDailyNews)
{me.NoSessionServer.CallFunction("GetNapiHirek","categories=1",0,me.DrawDailyNews);}
else
{me.RemovePinBoxes("dailynews");me.RemovePinLabels("dailynews");me.pMarkers.DeleteAllWithType("dailynews");}}
me.PropertyChanged("bDrawDailyNews");}}
this.AddDrawDailyNewsChangedListener=function(funcOnChanged)
{me.AddPropertyChangedListener("bDrawDailyNews",funcOnChanged);}
this.DrawDailyNews=function(dailynewslist,pDummy,iCommandID)
{var length=dailynewslist.length;var i=0;for(i=0;i<length;i++)
{var type="dailynews";var dX=dailynewslist[i].eovx;var dY=dailynewslist[i].eovy;var marker=new Marker(me,type,dX,dY,null,null);marker.SetProperty("start_button",false);marker.SetProperty("through_button",false);marker.SetProperty("stop_button",false);marker.SetProperty("panorama_button",false);marker.SetProperty("pinnumber",0);marker.SetProperty("handle_details",true);marker.SetProperty("pin_css_class","markerDailyNews");marker.SetProperty("div_label_sign_class","markerDailyNews");marker.SetProperty("pin_img_url","http://utvonal.bkv.hu/napihir/public.ashx?appID=NapiHirek&Command=GetImage&id="+dailynewslist[i].signid);marker.SetProperty("pin_img_width",38);marker.SetProperty("pin_img_height",38);marker.SetProperty("pin_img_refx",20);marker.SetProperty("pin_img_refy",20);marker.SetProperty("label_dx",0);marker.SetProperty("label_dy",-9);marker.SetProperty("delete_marker_on_label_close",false);marker.SetProperty("caption",unescape(dailynewslist[i].shortdescription));marker.SetProperty("show_coordinates",me.bDisplayCoords);var divDetails=NewTag("div");NewTextTag(unescape(dailynewslist[i].longdescription),divDetails);marker.SetProperty("details_to_show",divDetails);marker.SetProperty("fix_label_on_click",true);me.pMarkers.Add(marker);}
me.ZoomToPoint(19.1,47.48,10000);}
this.IsDrawPOIBanner=function()
{return me.bDisplayPOIBanner;}
this.SetDrawPOIBanner=function(bEnable,bSilent)
{if(bEnable!=me.bDisplayPOIBanner)
{me.bDisplayPOIBanner=bEnable;me.PropertyChanged("bDisplayPOIBanner");if(!bSilent){me.DrawRoute();}}}
this.IsDrawCoordsLabel=function()
{return me.bDisplayCoords;}
this.SetDrawCoordsLabel=function(bEnable)
{if(bEnable!=me.bDisplayCoords)
{me.SetDisplayCoords(bEnable);me.PropertyChanged("bDisplayCoords");}}
this.AddDrawCoordsLabelChangedListener=function(funcOnChanged)
{me.AddPropertyChangedListener("bDisplayCoords",funcOnChanged);}
this.IsDrawNORC=function()
{return me.m_bDrawNORC;}
this.SetDrawNORC=function(bEnable)
{if(bEnable!=me.m_bDrawNORC)
{me.m_bDrawNORC=bEnable;me.PropertyChanged("bDrawNORC");}}
this.AddDrawNORCChangedListener=function(funcOnChanged)
{me.AddPropertyChangedListener("bDrawNORC",funcOnChanged);}
this.IsDrawPOI=function(sernum)
{var i=0;for(i=0;i<me.m_arrDrawnPois.length;i++)
{if(me.m_arrDrawnPois[i]==sernum)
return true;}
return false;}
this.GetPipeSepPoiIDs=function()
{var ret="";var i=0;for(i=0;i<me.m_arrDrawnPois.length;i++)
{if(me.m_arrDrawnPois[i]!=null)
{switch(me.m_arrDrawnPois[i])
{case"1":ret+="504|500|";break;case"2":ret+="501|506|511|512|";break;case"3":ret+="502|508|";break;case"4":ret+="503|";break;case"5":ret+="505|509|510|";break;case"6":ret+="507|";break;default:break;}}}
if(ret.length>0)
{ret=ret.substr(0,ret.length-1);}
return ret;}
this.SetDrawPOI=function(sernum,bEnable,bSilent)
{if(bEnable)
{var i=0;for(i=0;i<me.m_arrDrawnPois.length;i++)
{if(me.m_arrDrawnPois[i]==null)
{me.m_arrDrawnPois[i]=sernum;break;}}
if(i==me.m_arrDrawnPois.length)
me.m_arrDrawnPois.push(sernum);}
else
{var i=0;for(i=0;i<me.m_arrDrawnPois.length;i++)
{if(me.m_arrDrawnPois[i]==sernum)
{delete me.m_arrDrawnPois[i];me.m_arrDrawnPois[i]=null;}}}
var strPipeSepPoiIDList=me.GetPipeSepPoiIDs();me.SetPoiLayers(strPipeSepPoiIDList);if(me.bLayerPoiRedrawNeeded==false)
{if(!bSilent){me.bLayerPoiRedrawNeeded=true;setTimeout(me.LayerPoiRedraw,700);}}}
this.LayerPoiRedraw=function()
{me.DrawRoute();me.bLayerPoiRedrawNeeded=false;}
this.AddDrawPOIChangedListener=function(funcOnChanged)
{me.AddPropertyChangedListener("bDrawPOI",funcOnChanged);}}
CTopoliszMap.RedrawAll=function()
{var arrInstances=CTopoliszMap.prototype.arrInstances;for(var i=0;i<arrInstances.length;i++)
{if(arrInstances[i])
arrInstances[i].Redraw();}}

function CTopoliszControls(pTopoliszMap,bCarOnly,bThereCanBeOnlyTwo)
{this.pTopoliszMap=pTopoliszMap;this.bFullScreen=false;this.divContent=null;this.trTitle=null;this.divRouteResult=null;this.pRouteSearch=null;this.pRouteResult=null;this.pExtraInfo=null;this.pPoiSearch=null;this.divUserData=null;this.pLogin=null;this.pRegistration=null;this.mainMenu=null;this.aBabelTraffic=null;this.aBabelActual=null;this.aBabelSearch=null;this.aBabelLogin=null;this.pLayerPoiTreeMemo=null;this.pLanguageSupporter=new LanguageSupporter();this.bCarOnly=bCarOnly;this.bThereCanBeOnlyTwo=bThereCanBeOnlyTwo;var me=this;this.CreateMainMenu=function(div)
{me.MainMenu=new Menu(GetBlock('idMainMenu'));if(g_InitSettings.bShowMenuTraffic)
me.aBabelTraffic=me.MainMenu.AddMenuItemLeft(g_Babel.GetWord('mmTraffic2'),me.ShowRouteSearch);if(g_InitSettings.bShowMenuExtraInfo)
me.aBabelActual=me.MainMenu.AddMenuItemLeft(g_Babel.GetWord('mmActual'),me.ShowActualSettingsBlock);if(g_InitSettings.bShowMenuSearch)
me.aBabelSearch=me.MainMenu.AddMenuItemLeft(g_Babel.GetWord('mmSearch'),me.ShowSearchBlock);me.aBabelLogin=me.MainMenu.AddMenuItemLeft(g_Babel.GetWord("capLogin"),me.ShowLogin);me.aBabelGyik=me.MainMenu.AddMenuItemLeft(g_Babel.GetWord("capGYIK"),null,"http://www.utvonalterv.hu/utvonaltervgyik.html");me.MainMenu.AddMenuItemLeft("Link",null,"link.html");me.pLanguageSupporter.Add(me.aBabelLogin,"innerHTML","capLogin","","");me.pLanguageSupporter.Add(me.aBabelGyik,"innerHTML","capGYIK","","");var td=me.MainMenu.CreateTdRight();td.style.textAlign="right";td.style.width="160px";var img=NewTag('img',td);SetImage(img,"images/hun.gif",31,20,"magyar");img.style.paddingLeft="5px";img.style.paddingRight="5px";img.onmouseover=function(){Tip("magyar");};img.onmouseout=function(){UnTip();};img.onclick=function(){me.SetLang('hu');};img=NewTag('img',td);SetImage(img,"images/gbr.gif",31,20,"english");img.style.paddingLeft="5px";img.style.paddingRight="5px";img.onmouseover=function(){Tip("english");};img.onmouseout=function(){UnTip();};img.onclick=function(){me.SetLang('en');};img=NewTag('img',td);SetImage(img,"images/sk.gif",31,20,"slovenské");img.style.paddingLeft="5px";img.style.paddingRight="5px";img.onmouseover=function(){Tip("slovenské");};img.onmouseout=function(){UnTip();};img.onclick=function(){me.SetLang('sk');};img=NewTag('img',td);SetImage(img,"images/ro.gif",31,20,"român");img.style.paddingLeft="5px";img.style.paddingRight="5px";img.onmouseover=function(){Tip("român");};img.onmouseout=function(){UnTip();};img.onclick=function(){me.SetLang('ro');};}
this.SetLang=function(strLang)
{if(document.location.search==null||document.location.search=="")
document.location=document.location.pathname+"?lang="+strLang;else
{var arrParams=location.search.substr(1).split("&");var bFound=false;for(var i=0;i<arrParams.length;i++)
{var iPos=arrParams[i].indexOf("=");if(iPos>=0)
strKey=arrParams[i].substr(0,iPos);else
strKey=arrParams[i];strKey=strKey.toLowerCase();if(strKey=="lang")
{bFound=true;arrParams[i]="lang="+strLang;}}
if(!bFound)
arrParams[arrParams.length]="lang="+strLang;var aj=arrParams.join('&');location.href=location.pathname+"?"+aj;}}
this.SetContent=function(divContent,trTitle)
{me.divContent=divContent;me.trTitle=trTitle;}
this.SetRouteResult=function(divRouteResult)
{me.divRouteResult=divRouteResult;}
this.HideLeft=function()
{var div=me.divContent.firstChild;while(div)
{if(div.nodeName!="#text")
{div.style.display="none";}
div=div.nextSibling;}}
this.SetTitle=function(strTitle)
{if(me.trTitle)
{if(g_InitSettings.bShowMenuSearch)
{for(var td=me.trTitle.firstChild;td!=null;td=td.nextSibling)
{if(td.nodeName.toLowerCase()!="td")
continue;RemoveCssClassPostfix(td,"_on");var strTextContent="";var a=td.getElementsByTagName("a");if(a!=null&&a.length>0)
{strTextContent=a[0].innerHTML;}
if(strTextContent==strTitle)
{td.className+="_on";}}}
else
{for(var td=me.trTitle.firstChild;td!=null;)
{if(td.nodeName.toLowerCase()!="td")
{td=td.nextSibling;continue;}
RemoveCssClassPostfix(td,"_on");var strTextContent="";var a=td.getElementsByTagName("a");if(a!=null&&a.length>0)
{strTextContent=a[0].innerHTML;}
if(strTextContent==strTitle)
{td.className="UI_panel_header";}
else
{var tdDel=td;td=td.nextSibling;me.trTitle.removeChild(tdDel);continue;}
td=td.nextSibling;}
var trCsik=me.trTitle.nextSibling;$(document).ready(function()
{$("table.UI_panel").find("tr:first").each(function(iIndex,tr)
{if(!$(tr).find("td.UI_panel_top_left").size()||!$(tr).find("td.UI_panel_top").size()||!$(tr).find("td.UI_panel_top_right").size())
{$(tr).before("<tr><td class='UI_panel_top_left'></td><td class='UI_panel_top'></td><td class='UI_panel_top_right'></td></tr>");}})});}}}
this.EnablePrinting=function(bEnable)
{var div=GetBlock("tdLeftPart");div.className=(bEnable?"":"noprint");}
this.ShowLastControl=function()
{var strLastPage=getCookie("page");if(strLastPage!=null)
{strLastPage.toLowerCase();if(strLastPage=="poi"&&g_InitSettings.bShowMenuSearch)
me.ShowSearchBlock();else if(strLastPage=="extra"&&g_InitSettings.bShowMenuExtraInfo)
me.ShowActualSettingsBlock();else
me.ShowRouteSearch();}
else
me.ShowRouteSearch();}
this.SetLastControl=function(strLastPage)
{if(g_InitSettings.strCountryName=="Magyarország")
setCookie("page",strLastPage);}
this.ShowLogin=function()
{me.RestoreLeftControl();me.EnablePrinting(true);me.HideLeft();if(me.pLogin==null)
{var div=NewTag('div',me.divContent);me.pLogin=new LoginBox(div,me);}
me.pLogin.Show();}
this.ShowRegistration=function()
{var iframe=NewIframe("Register.aspx?langid="+g_Babel.GetLang(),260,340);g_PopUpHandler.SetContent(g_Babel.GetWord('mmRegistration'),iframe);g_PopUpHandler.SetSize(270,400);g_PopUpHandler.CenterPopup();g_PopUpHandler.ShowPopup();}
this.ShowForgottenPassword=function()
{var iframe=NewIframe("sendpasswd.aspx?langid="+g_Babel.GetLang(),310,100);g_PopUpHandler.SetContent(g_Babel.GetWord('sendingForgottenPassword'),iframe);g_PopUpHandler.SetSize(320,150);g_PopUpHandler.CenterPopup();g_PopUpHandler.ShowPopup();}
this.ShowRouteSearch=function()
{me.SetLastControl("traffic");me.RestoreLeftControl();me.EnablePrinting(false);me.SetTitle(g_Babel.GetWord('mmTraffic2'));me.HideLeft();if(me.pRouteSearch==null)
{var div=NewTag('div',me.divContent);me.pRouteSearch=new CUtvonaltervRouteSearch(div,me.pTopoliszMap,me.bCarOnly,me.bThereCanBeOnlyTwo);me.pRouteResult=new CUtvonaltervRouteResult(me.divRouteResult,me.pTopoliszMap);me.pRouteSearch.SetResultHandler(me.pRouteResult);me.pRouteSearch.Show();}
else
me.pRouteSearch.Unhide();}
this.ShowActualSettingsBlock=function()
{me.SetLastControl("extra");me.RestoreLeftControl();me.EnablePrinting(true);me.SetTitle(g_Babel.GetWord('mmActual'));if(me.pPOIBOX)
me.pPOIBOX.ResetFindPoi();if(me.pRouteSearch)
{}
else
{me.pTopoliszMap.DrawRoute();}
me.HideLeft();if(me.pExtraInfo==null)
{var div=NewTag('div',me.divContent);me.pExtraInfo=new ExtraInfo(div,me.pTopoliszMap);me.pExtraInfo.Show();}
else
{me.pExtraInfo.Unhide();}}
this.ShowSearchBlock=function()
{me.SetLastControl("poi");me.RestoreLeftControl();me.EnablePrinting(true);me.SetTitle(g_Babel.GetWord('mmSearch'));if(me.pExtraInfo)
me.pExtraInfo.ResetPoiLayers();me.HideLeft();if(me.pPoiSearch==null)
{var div=NewTag('div',me.divContent);me.pPoiSearch=new PoiSearch(div,me.pTopoliszMap);me.pPoiSearch.Show();}
else
{me.pPoiSearch.Unhide();}}
this.RestoreLeftControl=function()
{var div=GetBlock('tdLeftPart');if(GetStyle(div,'display')=='none')
{div.style.display='';Resizer.OnResize();me.pTopoliszMap.RedrawWithoutZooming();}}
this.SwitchFavouritePlace=function(bChecked)
{if(bChecked==true)
{me.pTopoliszMap.NoSessionServer.CallFunction("GetFavouritePlace","",0,me.DrawFavouritePlace);}
else
{me.pTopoliszMap.RemovePinBoxes("FavouritePlace");me.pTopoliszMap.RemovePinLabels("FavouritePlace");me.pTopoliszMap.pMarkers.DeleteAllWithType("FavouritePlace");}}
this.DrawFavouritePlace=function(FavouritePlacelist,pDummy,iCommandID)
{if(FavouritePlacelist){var length=FavouritePlacelist.length;var i=0;for(i=0;i<length;i++)
{var dX=FavouritePlacelist[i].x;var dY=FavouritePlacelist[i].y;var type="favplace";var marker=new Marker(me.pTopoliszMap,type,dX,dY,null,null);marker.SetProperty("caption",FavouritePlacelist[i].name);marker.SetProperty("pin_img_refx",5);marker.SetProperty("pin_img_refy",5);marker.SetProperty("pin_img_url",GetAbsUrl("design/ICON_favourites_on.gif"));marker.SetProperty("pin_img_width",12);marker.SetProperty("pin_img_height",12);marker.SetProperty("pin_css_class","markerFavouritePlace");marker.SetProperty("div_label_sign_class","markerFavouritePlace");marker.SetProperty("start_button",me.pTopoliszMap.bLabelHasStartButton);marker.SetProperty("through_button",me.pTopoliszMap.bLabelHasThroughButton);marker.SetProperty("stop_button",me.pTopoliszMap.bLabelHasStopButton);marker.SetProperty("panorama_button",me.pTopoliszMap.bLabelHasPanoramaButton);marker.SetProperty("pinnumber",0);marker.SetProperty("handle_details",false);marker.SetProperty("delete_marker_on_label_close",false);marker.SetProperty("show_coordinates",me.pTopoliszMap.bDisplayCoords);me.pTopoliszMap.pMarkers.Add(marker);}
me.pTopoliszMap.DrawRoute();}}
this.OnChangeLang=function()
{if(me.aBabelTraffic!=null)me.aBabelTraffic.innerHTML=g_Babel.GetWord('mmTraffic2');if(me.aBabelActual!=null)me.aBabelActual.innerHTML=g_Babel.GetWord('mmActual');if(me.aBabelSearch!=null)me.aBabelSearch.innerHTML=g_Babel.GetWord('mmSearch');me.pLanguageSupporter.Apply();}
this.Register=function()
{cancelRegistration=function(){GetBlock("idModalDialogHolder").style.display="none";}
GetBlock("idDialogFrame").src="Register.aspx?langid="+g_Babel.GetLang();GetBlock("idDialogFrame").style.width="500px";GetBlock("idDialogFrame").style.height="380px";GetBlock("idDialogFrame").style.padding="0px";GetBlock("idDialogFrame").style.margin="0px";GetBlock("idModalDialogHolder").style.display="block";}
this.ShowUserData=function()
{var iframe=NewIframe("Adatlap.aspx?langid="+g_Babel.GetLang(),260,350);g_PopUpHandler.SetContent(g_Babel.GetWord('capPersonalForm'),iframe);g_PopUpHandler.SetSize(270,400);g_PopUpHandler.CenterPopup();g_PopUpHandler.ShowPopup();}
this.ShowLoginError=function()
{var div=NewTag("div");var p=NewTag("p",div);NewTextTag(g_Babel.GetWord("msgLoginFailed"),p);var p=NewTag("p",div);p.style.textAlign="right";var a=NewTag("a",p);a.href="javascript:void(0)";a.className="UI_button_OK";var img=NewTag("img",a);SetImage(img,"design/BUTTON_ok.gif");AddEvent(a,"click",g_PopUpHandler.HidePopup);g_PopUpHandler.SetContent("Utvonalterv.hu",div);g_PopUpHandler.SetSize(270,120);g_PopUpHandler.CenterPopup();g_PopUpHandler.ShowPopup();}
this.Logout=function()
{var input=GetBlock("idLoginCommand");if(input)
input.value="Logout";var form=GetBlock("idLoginForm");if(form)
form.submit();}
this.AddToFavourites=function()
{AddBookmark("http://www.utvonalterv.hu","Útvonalterv.hu");}
this.HideUsefulDivOnMouseMove=function(pEvent)
{var usefulbox=$("#usefulbox").get(0);if(usefulbox&&usefulbox.style.display!="none")
{var iMouseX=GetEventXNew(pEvent);var iMouseY=GetEventYNew(pEvent);var iDelta=10;var iMinX=GetAbsLayerLeft(usefulbox);var iMinY=GetAbsLayerTop(usefulbox);var iMaxX=GetAbsLayerRight($("#idUsefulLinkImg").get(0));var iMaxY=GetAbsLayerBottom(usefulbox);if(iMouseX<iMinX-iDelta||iMouseX>iMaxX+iDelta||iMouseY<iMinY-iDelta||iMouseY>iMaxY+iDelta)
{$(usefulbox).slideUp("fast");}}}
this.Print=function()
{var form=$("<form method='post' action='Print.ashx?SessionID="+g_strSessionID+"' target='_blank'>"
+"<input type='hidden' name='Command' value='print'/>"
+"</form>");var addParam=function(name,value)
{form.append("<input type='hidden' name='"+name+"' value='"+value+"'/>");}
var mapdata=me.pTopoliszMap.GetMapData();var arrMinXs=mapdata.dMinX;var arrMinYs=mapdata.dMinY;var arrMaxXs=mapdata.dMaxX;var arrMaxYs=mapdata.dMaxY;if(me.pRouteResult)
{var maps=me.pRouteResult.GetSubMaps();for(var i=0;i<maps.length;i++)
{arrMinXs+="|";arrMinYs+="|";arrMaxXs+="|";arrMaxYs+="|";mapdata=maps[i].GetMapData();arrMinXs+=mapdata.dMinX;arrMinYs+=mapdata.dMinY;arrMaxXs+=mapdata.dMaxX;arrMaxYs+=mapdata.dMaxY;}}
addParam("arrMinXs",arrMinXs);addParam("arrMinYs",arrMinYs);addParam("arrMaxXs",arrMaxXs);addParam("arrMaxYs",arrMaxYs);var obj=me.pTopoliszMap.pMarkers.GetUrlParams(function(pMarker){if(pMarker.mainType=="routeptstop")return false;return true;});addParam("arrMarkerIDs",obj.arrMarkerIDs);addParam("arrMarkerX",obj.arrMarkerX);addParam("arrMarkerY",obj.arrMarkerY);var strItiner="";var domItiner=$("#idRouteResult div.itiner").get(0);if(domItiner!=null)
{var jqItiner=$(domItiner.innerHTML);var arrCssItemsToRemove=["div.ROUTE_map",".RouteMapLink",".RouteMapLinkCity",".RouteMapLinkRoad",".RouteMapLinkItem",".RouteMapLinkCityItem",".RouteMapLinkRoadItem",".RouteMapLinkPT",".ROUTE_maplink",".ROUTE_infolink"];jqItiner.find("div.noprint").remove();jqItiner.find("tr.noprint").remove();jqItiner.find("a.noprint").remove();jqItiner.find("td.noprint").children().remove();for(var i=0;i<arrCssItemsToRemove.length;i++)
{var jqMap=jqItiner.find(arrCssItemsToRemove[i]);jqMap.children().remove();jqMap.removeAttr("style");}
jqItiner.find("tr.ROUTE_address td").removeAttr("style");jqItiner.find("tr.ROUTE_addressflag td").removeAttr("style");jqItiner.find("span.routeItem").css("color","black");strItiner=escape(jqItiner.wrap("<div>").get(0).innerHTML);}
addParam("itiner",strItiner);form.appendTo("body");form.submit();}
this.Init=function()
{g_Babel.AddListener(me.OnChangeLang);}
me.Init();}

function CMapGrid(iTop,iLeft,iBottom,iRight,tmTopoliszMap,iMapViewVectorY,iMapViewVectorX)
{this.iTop=iTop;this.iLeft=iLeft;this.iWidth=iRight-iLeft+1;this.iHeight=iBottom-iTop+1;this.iMapViewVectorX=iMapViewVectorX;this.iMapViewVectorY=iMapViewVectorY;this.tmTopoliszMap=tmTopoliszMap;this.arrGridItems=new Array();this.iLevel=0;this.i_gHbase=1;this.i_gWbase=1;this.FileNames=null;this.ArgLoad_DiffTop=0;this.ArgLoad_DiffLeft=0;this.LoadedImagesTop=0;this.LoadedImagesLeft=0;this.AllowMove=true;this.MemoMoveX=0;this.MemoMoveY=0;this.bCanMoveX=true;this.bCanMoveY=true;this.sMoveCallbackOn="true";this.mainGridDiv=null;this.mainGridImageDiv=null;this.mainGridImageDivSec=null;this.mainGridImage=null;this.mainGridImageSec=null;this.mainGridPrintImage=null;this.mainGridDistMeasureImageDiv=null;this.dWgsLowerLeftX=0.0;this.dWgsLowerLeftY=0.0;this.dWgsUpperRightX=0.0;this.dWgsUpperRightY=0.0;this.iAccMoveMapVectorY=0;this.iAccMoveMapVectorX=0;this.zoomPreviewAnim_Images=null;this.zoomPreviewAnim_Images_Width=null;this.zoomPreviewAnim_Images_Height=null;this.zoomPreviewAnim_Tops=new Array();this.zoomPreviewAnim_Lefts=new Array();this.zoomPreviewAnim_ImageHeight=null;this.zoomPreviewAnim_ImageWidth=null;this.zoomPreviewAnim_ZoomFactor=0;this.zoomPreviewAnim_BasePointX=0;this.zoomPreviewAnim_BasePointY=0;this.zoomPreviewAnim_PhasesLeft=10;this.zoomPreviewAnim_PhasesNum=10;var me=this;this.GetTop=function()
{return me.iTop;}
this.GetLeft=function()
{return me.iLeft;}
this.GetBottom=function()
{return me.iTop+me.iHeight-1;}
this.GetRight=function()
{return me.iLeft+me.iWidth-1;}
this.SetWgs=function(dLowerLeftX,dLowerLeftY,dUpperRightX,dUpperRightY)
{me.dWgsLowerLeftX=dLowerLeftX;me.dWgsLowerLeftY=dLowerLeftY;me.dWgsUpperRightX=dUpperRightX;me.dWgsUpperRightY=dUpperRightY;}
this.SetImageFileNames=function(FileNames)
{me.FileNames=FileNames;}
this.GetImageFileName=function(iRow,iCol)
{var ArrayCoord=me.GetArrayAbsCoordinate(iRow-me.LoadedImagesTop,iCol-me.LoadedImagesLeft);return me.FileNames[ArrayCoord];}
this.GetArrayCoordinate=function(iY,iX)
{return(me.iWidth)*(iY-me.iTop)+iX-me.iLeft;}
this.GetArrayAbsCoordinate=function(iY,iX)
{return(me.iWidth)*(iY)+iX;}
this.GetWidth=function()
{return me.iWidth;}
this.GetHeight=function()
{return me.iHeight;}
this.GetMapViewVectorX=function()
{return me.iMapViewVectorX;}
this.GetMapViewVectorY=function()
{return me.iMapViewVectorY;}
this.GetTopFromAbsCoordY=function(PosY)
{var DivY=PosY/me.tmTopoliszMap.GetMapGridItemHeight();var res=Math.floor(DivY);return res;}
this.GetLeftFromAbsCoordX=function(PosX)
{var DivX=PosX/me.tmTopoliszMap.GetMapGridItemWidth();var res=Math.floor(DivX);return res;}
this.GetMapViewVectorYFromAbsCoordY=function(PosY)
{var DivY=PosY/me.tmTopoliszMap.GetMapGridItemHeight();return Math.floor((DivY-Math.floor(DivY))*me.tmTopoliszMap.GetMapGridItemHeight());}
this.GetMapViewVectorXFromAbsCoordX=function(PosX)
{var DivX=PosX/me.tmTopoliszMap.GetMapGridItemWidth();return Math.floor((DivX-Math.floor(DivX))*me.tmTopoliszMap.GetMapGridItemWidth());}
this.LoadLevel2=function(serverResponse)
{me.SetImageFileNames(serverResponse.arrUrls);me.iLevel=serverResponse.iLevel;me.SetWgs(serverResponse.dGridLowerLeftX,serverResponse.dGridLowerLeftY,serverResponse.dGridUpperRightX,serverResponse.dGridUpperRightY);me.LoadedImagesTop=serverResponse.iGridUpperRow;me.LoadedImagesLeft=serverResponse.iGridLeftColumn;me.iTop=serverResponse.iGridUpperRow;me.iMapViewVectorY=serverResponse.iViewportOffsetY;me.iLeft=serverResponse.iGridLeftColumn;me.iMapViewVectorX=serverResponse.iViewportOffsetX;for(var iYIter=me.iTop;iYIter<=serverResponse.iGridLowerRow;iYIter++)
{for(var iXIter=me.iLeft;iXIter<=serverResponse.iGridRightColumn;iXIter++)
{var GridItem=me.arrGridItems[me.GetArrayCoordinate(iYIter,iXIter)];GridItem.RemoveImg();}}
for(var iYIter=me.iTop;iYIter<=serverResponse.iGridLowerRow;iYIter++)
{for(var iXIter=me.iLeft;iXIter<=serverResponse.iGridRightColumn;iXIter++)
{var iPosY=me.tmTopoliszMap.GetMapGridItemHeight()*(iYIter-me.iTop)-me.iMapViewVectorY;var iPosX=me.tmTopoliszMap.GetMapGridItemWidth()*(iXIter-me.iLeft)-me.iMapViewVectorX;var GridItem=me.arrGridItems[me.GetArrayCoordinate(iYIter,iXIter)];GridItem.Load(me.iLevel,iYIter,iXIter);GridItem.SetPos(iPosY,iPosX);}}
me.SetMainGridDiv();}
this.CreateGrid=function()
{var mgd=me.mainGridDiv=NewTag('div');me.mainGridDiv.className="grid";me.mainGridDiv.id=me.tmTopoliszMap.divMap.id+"grid";me.mainGridImageDiv=NewTag('div');me.mainGridImageDiv.id=me.tmTopoliszMap.divMap.id+"imggrid";me.mainGridImageDiv.style.position="absolute";me.mainGridImageDiv.className="noprint";me.mainGridImageDiv.style.top="0px";me.mainGridImageDiv.style.left="0px";me.mainGridImageDiv.style.zIndex="6";me.mainGridImageDiv.style.backgroundColor="transparent";AddTag(me.mainGridImageDiv,me.mainGridDiv);me.mainGridImage=NewTag('img');me.mainGridImage.style.position="absolute";me.mainGridImage.style.top="0px";me.mainGridImage.style.left="0px";me.mainGridImage.style.backgroundColor="transparent";AddTag(me.mainGridImage,me.mainGridImageDiv);me.mainGridImageDivSec=NewTag('div');me.mainGridImageDivSec.id=me.tmTopoliszMap.divMap.id+"imggridsec";me.mainGridImageDivSec.style.position="absolute";me.mainGridImageDivSec.className="noprint";me.mainGridImageDivSec.style.top="0px";me.mainGridImageDivSec.style.left="0px";me.mainGridImageDivSec.style.zIndex="5";me.mainGridImageDivSec.style.backgroundColor="transparent";AddTag(me.mainGridImageDivSec,me.mainGridDiv);me.mainGridImageSec=NewTag('img');me.mainGridImageSec.style.position="absolute";me.mainGridImageSec.style.top="0px";me.mainGridImageSec.style.left="0px";me.mainGridImageSec.style.backgroundColor="transparent";AddTag(me.mainGridImageSec,me.mainGridImageDivSec);me.mainGridPrintImage=NewTag('img');me.mainGridPrintImage.className="imggridprint";me.mainGridPrintImage.style.position="absolute";me.mainGridPrintImage.style.top="0px";me.mainGridPrintImage.style.left="0px";me.mainGridPrintImage.style.backgroundColor="transparent";AddTag(me.mainGridPrintImage,me.mainGridDiv);me.mainGridDistMeasureImageDiv=NewTag('div');me.mainGridDistMeasureImageDiv.id=me.tmTopoliszMap.divMap.id+"distmeasureimggrid";me.mainGridDistMeasureImageDiv.style.position="absolute";me.mainGridDistMeasureImageDiv.style.top="0px";me.mainGridDistMeasureImageDiv.style.left="0px";me.mainGridDistMeasureImageDiv.style.zIndex="1";AddTag(me.mainGridDistMeasureImageDiv,me.mainGridDiv);AddTag(me.mainGridDiv,me.tmTopoliszMap.divMap);for(var iYIter=me.iTop;iYIter<me.iTop+me.iHeight;iYIter++)
{for(var iXIter=me.iLeft;iXIter<me.iLeft+me.iWidth;iXIter++)
{var NewGridItem=me.tmTopoliszMap.GetMapGridItem();me.arrGridItems[me.GetArrayCoordinate(iYIter,iXIter)]=NewGridItem;}}
return mgd;}
this.SetMainGridDiv=function()
{me.mainGridDiv.style.left=-me.iMapViewVectorX+"px";me.mainGridDiv.style.top=-me.iMapViewVectorY+"px";me.mainGridDiv.style.width=me.iWidth*me.tmTopoliszMap.GetMapGridItemWidth()+"px";me.mainGridDiv.style.height=me.iHeight*me.tmTopoliszMap.GetMapGridItemHeight()+"px";me.mainGridImageDiv.style.width=me.iWidth*me.tmTopoliszMap.GetMapGridItemWidth()+"px";me.mainGridImageDiv.style.height=me.iHeight*me.tmTopoliszMap.GetMapGridItemHeight()+"px";me.mainGridImageDivSec.style.width=me.iWidth*me.tmTopoliszMap.GetMapGridItemWidth()+"px";me.mainGridImageDivSec.style.height=me.iHeight*me.tmTopoliszMap.GetMapGridItemHeight()+"px";me.mainGridPrintImage.style.width=me.iWidth*me.tmTopoliszMap.GetMapGridItemWidth()+"px";me.mainGridPrintImage.style.height=me.iHeight*me.tmTopoliszMap.GetMapGridItemHeight()+"px";me.mainGridImage.style.width=me.iWidth*me.tmTopoliszMap.GetMapGridItemWidth()+"px";me.mainGridImage.style.height=me.iHeight*me.tmTopoliszMap.GetMapGridItemHeight()+"px";me.mainGridImageSec.style.width=me.iWidth*me.tmTopoliszMap.GetMapGridItemWidth()+"px";me.mainGridImageSec.style.height=me.iHeight*me.tmTopoliszMap.GetMapGridItemHeight()+"px";me.mainGridDistMeasureImageDiv.style.width=me.iWidth*me.tmTopoliszMap.GetMapGridItemWidth()+"px";me.mainGridDistMeasureImageDiv.style.height=me.iHeight*me.tmTopoliszMap.GetMapGridItemHeight()+"px";me.tmTopoliszMap.DrawLine();}
this.SetMainGridImage=function(urlImage,iOpacity)
{if((urlImage!="")&&(urlImage!=null))
{me.mainGridImage.src=urlImage;me.mainGridPrintImage.src=urlImage;SetOpac(me.mainGridImageDiv,iOpacity);me.mainGridImageDiv.style.visibility="visible";me.mainGridDiv.style.visibility="visible";}
else
{me.mainGridImage.src=GetAbsUrl("images/transparent.gif");me.mainGridPrintImage.src=GetAbsUrl("images/transparent.gif");}}
this.SetMainGridImageSec=function(urlImage,iOpacity)
{if((urlImage!="")&&(urlImage!=null))
{me.mainGridImageSec.src=urlImage;SetOpac(me.mainGridImageDivSec,iOpacity);me.mainGridImageDivSec.style.visibility="visible";me.mainGridDiv.style.visibility="visible";}
else
{me.mainGridImageSec.src=GetAbsUrl("images/transparent.gif");me.mainGridImageDivSec.style.visibility="hidden";}}
this.SetMainGridDistMeasureImage=function(urlImage)
{if((urlImage!="")&&(urlImage!=null))
{me.mainGridDistMeasureImageDiv.style.backgroundImage="url('"+urlImage+"')";me.mainGridDistMeasureImageDiv.style.visibility="visible";}
else
{me.mainGridDistMeasureImageDiv.style.backgroundImage="url('"+GetAbsUrl("images/transparent.gif")+"')";me.mainGridDistMeasureImageDiv.style.visibility="hidden";}}
this.HideMainGridImage=function()
{me.mainGridDiv.style.visibility="hidden";me.mainGridImageDiv.style.visibility="hidden";me.mainGridImageDivSec.style.visibility="hidden";}
this.ShowMainGridImage=function()
{me.mainGridDiv.style.visibility="visible";me.mainGridImageDiv.style.visibility="visible";me.mainGridImageDivSec.style.visibility="visible";}
this.HideDistMeasure=function()
{me.mainGridDistMeasureImageDiv.style.visibility="hidden";}
this.ShowDistMeasure=function()
{me.mainGridDistMeasureImageDiv.style.visibility="visible";}
this.StartLoad=function(iDiffTop,iDiffLeft,iNewViewOffsetY,iNewViewOffsetX)
{me.ArgLoad_DiffTop=iDiffTop;me.ArgLoad_DiffLeft=iDiffLeft;var iNewLeft=me.iLeft+iDiffLeft;var iNewTop=me.iTop+iDiffTop;if((iDiffTop!=0)||(iDiffLeft!=0))
{var iViewDeltaX=me.tmTopoliszMap.GetMapViewWidth();var iViewDeltaY=me.tmTopoliszMap.GetMapViewHeight();var iGridDeltaX=me.tmTopoliszMap.GetMapGridItemWidth()*me.GetWidth();var iGridDeltaY=me.tmTopoliszMap.GetMapGridItemHeight()*me.GetHeight();var Params="";Params+='iLevel='+me.iLevel;Params+='&iMinRow='+iNewTop;Params+='&iMinCol='+iNewLeft;Params+='&iMaxRow='+(iNewTop+me.iHeight-1);Params+='&iMaxCol='+(iNewLeft+me.iWidth-1);Params+='&iViewDeltaX='+iViewDeltaX;Params+='&iViewDeltaY='+iViewDeltaY;Params+='&iViewOffsetX='+me.iMapViewVectorX;Params+='&iViewOffsetY='+me.iMapViewVectorY;Params+='&iGridDeltaX='+iGridDeltaX;Params+='&iGridDeltaY='+iGridDeltaY;me.tmTopoliszMap.HideRoute();me.SetMainGridImage("",100);me.SetMainGridImageSec("",100);me.tmTopoliszMap.HidePois();me.tmTopoliszMap.HideDistMeasure();me.tmTopoliszMap.NoSessionServer.CallFunction("DrawRasterMap",Params,0,me.EndLoad);}
else
me.EndLoad(null);}
this.EndLoad=function(result,clientParam,iCommandID)
{if(result!=null)
{me.tmTopoliszMap.pLastStateFromServer=result;me.tmTopoliszMap.iMovingSinceLastServerStateX=0;me.tmTopoliszMap.iMovingSinceLastServerStateY=0;}
var iDiffLeft=me.ArgLoad_DiffLeft;var iDiffTop=me.ArgLoad_DiffTop;var iNewLeft=me.iLeft+iDiffLeft;var iNewTop=me.iTop+iDiffTop;if(result!=null)
{me.LoadedImagesTop=iNewTop;me.LoadedImagesLeft=iNewLeft;me.SetImageFileNames(result.arrUrls);me.SetWgs(result.dGridLowerLeftX,result.dGridLowerLeftY,result.dGridUpperRightX,result.dGridUpperRightY);}
var StartY=0;var AfterEndY=me.iHeight;var StartX=0;var AfterEndX=me.iWidth;var iYIter=StartY;var iXIter=StartX;var YDir="pos";var XDir="pos";if(iDiffTop<0)
{var iYIter=me.iHeight-1;var YDir="neg";var AfterEndY=-1;}
if((iDiffLeft<0)&&(iDiffTop>=0))
{var iXIter=me.iWidth-1;var XDir="neg";var AfterEndX=-1;}
if((iDiffLeft>=0)||(iDiffTop<0))
{while(iYIter!=AfterEndY)
{while(iXIter!=AfterEndX)
{me.LoadCycleCore(iYIter,iXIter,iNewTop,iNewLeft);if(XDir=="pos")
iXIter++;else
iXIter--;}
iXIter=StartX;if(YDir=="pos")
iYIter++;else
iYIter--;}}
else
{while(iXIter!=AfterEndX)
{while(iYIter!=AfterEndY)
{me.LoadCycleCore(iYIter,iXIter,iNewTop,iNewLeft);if(YDir=="pos")
iYIter++;else
iYIter--;}
iYIter=StartY;if(XDir=="pos")
iXIter++;else
iXIter--;}}
me.iLeft=iNewLeft;me.iTop=iNewTop;me.MemoMoveX=0;me.MemoMoveX=0;me.SetMainGridDiv();me.AllowMove=true;if(result!=null)
{me.tmTopoliszMap.DrawRoute();me.tmTopoliszMap.DrawDistMeasure();}
else
{me.tmTopoliszMap.RearrangePois();}
if(me.sMoveCallbackOn=="true")
me.tmTopoliszMap.MovedCallback();else if(me.sMoveCallbackOn=="rearrangeframe")
{me.tmTopoliszMap.pMiniMapFrame.ReArrange();}}
this.Load=function(iDiffTop,iDiffLeft)
{me.StartLoad(iDiffTop,iDiffLeft);}
this.LoadCycleCore=function(iYIter,iXIter,iNewTop,iNewLeft)
{var NewIdxX=iNewLeft+iXIter;var NewIdxY=iNewTop+iYIter;var OldIdxX=me.iLeft+iXIter;var OldIdxY=me.iTop+iYIter;if((NewIdxX>=me.iLeft)&&(NewIdxX<me.iLeft+me.iWidth)&&(NewIdxY>=me.iTop)&&(NewIdxY<me.iTop+me.iHeight))
{var iPosY=me.tmTopoliszMap.GetMapGridItemHeight()*iYIter-me.iMapViewVectorY;var iPosX=me.tmTopoliszMap.GetMapGridItemWidth()*iXIter-me.iMapViewVectorX;gridItemTmp=me.arrGridItems[me.GetArrayAbsCoordinate(iYIter,iXIter)];me.arrGridItems[me.GetArrayAbsCoordinate(iYIter,iXIter)]=me.arrGridItems[me.GetArrayCoordinate(NewIdxY,NewIdxX)];me.arrGridItems[me.GetArrayCoordinate(NewIdxY,NewIdxX)]=gridItemTmp;me.arrGridItems[me.GetArrayAbsCoordinate(iYIter,iXIter)].SetPos(iPosY,iPosX);}
else
{var iPosY=me.tmTopoliszMap.GetMapGridItemHeight()*iYIter-me.iMapViewVectorY;var iPosX=me.tmTopoliszMap.GetMapGridItemWidth()*iXIter-me.iMapViewVectorX;me.arrGridItems[me.GetArrayAbsCoordinate(iYIter,iXIter)].SetPos(iPosY,iPosX);me.arrGridItems[me.GetArrayAbsCoordinate(iYIter,iXIter)].Set(me.iLevel,NewIdxY,NewIdxX);}}
this.MoveTo=function(iRow,iCol)
{var iNowAbsX=me.GetViewAbsoluteLeft();var iNowAbsY=me.GetViewAbsoluteTop();var iDX=iCol-iNowAbsX;var iDY=iRow-iNowAbsY;me.Move(iDY,iDX);}
this.MoveToCenter=function()
{var MVW=me.tmTopoliszMap.GetMapViewWidth();var MVH=me.tmTopoliszMap.GetMapViewHeight();var MH=me.tmTopoliszMap.GetMapHeight();var MW=me.tmTopoliszMap.GetMapWidth();me.MoveTo(Math.floor(MH/2-MVH/2),Math.floor(MW/2-MVW/2));}
this.MoveNew=function(iMoveMapVectorY,iMoveMapVectorX)
{var bMainMapAllowMove=true;if(me.tmTopoliszMap.pConnectedMainMap)
bMainMapAllowMove=me.tmTopoliszMap.pConnectedMainMap.pGridMain.AllowMove;var bMiniMapAllowMove=true;if(me.tmTopoliszMap.pConnectedMiniMap)
bMiniMapAllowMove=me.tmTopoliszMap.pConnectedMiniMap.pGridMain.AllowMove;if(me.AllowMove&&bMainMapAllowMove&&bMiniMapAllowMove)
{me.RemoveZoomPreview();me.AllowMove=false;var GIWpix=me.tmTopoliszMap.GetMapGridItemWidth();var GIHpix=me.tmTopoliszMap.GetMapGridItemHeight();var GWpix=GIWpix*me.GetWidth();var GHpix=GIHpix*me.GetHeight();var MVWpix=me.tmTopoliszMap.GetMapViewWidth();var MVHpix=me.tmTopoliszMap.GetMapViewHeight();var MHpix=me.tmTopoliszMap.GetMapHeight();var MWpix=me.tmTopoliszMap.GetMapWidth();var MAHpix=me.tmTopoliszMap.GetActiveHeight();var MAWpix=me.tmTopoliszMap.GetActiveWidth();var AVVOXpix=me.iMapViewVectorX+me.iLeft*GIWpix;var AVVOYpix=me.iMapViewVectorY+me.iTop*GIHpix;var GALpix=me.iLeft*GIWpix;var GATpix=me.iTop*GIHpix;var GARpix=GALpix+GWpix;var GABpix=GATpix+GHpix;var AVVNXpix=0;var AVVNYpix=0;var MLpix=0;var MRpix=0;var MTpix=0;var MBpix=0;var iNewTop=me.iTop;var iNewLeft=me.iLeft;var iNewMapViewVectorY=me.iMapViewVectorY;var iNewMapViewVectorX=me.iMapViewVectorX;var _AVVNXpix,_AVVNYpix;_AVVNXpix=AVVOXpix+iMoveMapVectorX;if(MVWpix<MAWpix)
{if(_AVVNXpix<-MLpix)_AVVNXpix=-MLpix;if(_AVVNXpix>MAWpix+MRpix-MVWpix)_AVVNXpix=MAWpix+MRpix-MVWpix;}
else
{if(_AVVNXpix>MLpix)_AVVNXpix=MLpix;if(_AVVNXpix<MAWpix-MRpix-MVWpix)_AVVNXpix=MAWpix-MRpix-MVWpix;}
AVVNXpix=_AVVNXpix;_AVVNYpix=AVVOYpix+iMoveMapVectorY;if(MVHpix<MAHpix)
{if(_AVVNYpix<-MTpix)_AVVNYpix=-MTpix;if(_AVVNYpix>MAHpix+MBpix-MVHpix)_AVVNYpix=MAHpix+MBpix-MVHpix;}
else
{if(_AVVNYpix>MTpix)_AVVNYpix=MTpix;if(_AVVNYpix<MAHpix-MBpix-MVHpix)_AVVNYpix=MAHpix-MBpix-MVHpix;}
AVVNYpix=_AVVNYpix;if((GALpix<AVVNXpix)&&(GARpix>AVVNXpix)&&(GATpix<AVVNYpix)&&(GABpix>AVVNYpix)&&(GALpix<AVVNXpix+MVWpix)&&(GARpix>AVVNXpix+MVWpix)&&(GATpix<AVVNYpix+MVHpix)&&(GABpix>AVVNYpix+MVHpix))
{iNewMapViewVectorX=AVVNXpix-GALpix;iNewMapViewVectorY=AVVNYpix-GATpix;}
else
{var ax=Math.floor(AVVNXpix/GIWpix);var bx=Math.floor((GWpix-MVWpix)/(GIWpix*2));iNewLeft=ax-bx;iNewMapViewVectorX=AVVNXpix-(iNewLeft*GIWpix);var cx=Math.floor(AVVNYpix/GIHpix);var dx=Math.floor((GHpix-MVHpix)/(GIHpix*2));iNewTop=cx-dx;iNewMapViewVectorY=AVVNYpix-(iNewTop*GIHpix);}
me.tmTopoliszMap.iMovingSinceLastServerStateX+=(iNewMapViewVectorX-me.iMapViewVectorX);me.tmTopoliszMap.iMovingSinceLastServerStateY-=(iNewMapViewVectorY-me.iMapViewVectorY);if(me.bCanMoveX&&me.bCanMoveY)
{me.iMapViewVectorY=iNewMapViewVectorY;me.iMapViewVectorX=iNewMapViewVectorX;me.Load(iNewTop-me.iTop,iNewLeft-me.iLeft);}
else if(me.bCanMoveX)
{me.iMapViewVectorX=iNewMapViewVectorX;me.Load(0,iNewLeft-me.iLeft);}
else if(me.bCanMoveY)
{me.iMapViewVectorY=iNewMapViewVectorY;me.Load(iNewTop-me.iTop,0);}
else
{if(me.tmTopoliszMap.pMiniMapFrame)
me.tmTopoliszMap.pMiniMapFrame.ReArrange();me.AllowMove=true;}}}
this.Move=function(iMoveMapVectorY,iMoveMapVectorX)
{var bRealMoveHappened=false;var bMainMapAllowMove=true;if(me.tmTopoliszMap.pConnectedMainMap)
bMainMapAllowMove=me.tmTopoliszMap.pConnectedMainMap.pGridMain.AllowMove;var bMiniMapAllowMove=true;if(me.tmTopoliszMap.pConnectedMiniMap)
bMiniMapAllowMove=me.tmTopoliszMap.pConnectedMiniMap.pGridMain.AllowMove;if(me.AllowMove&&bMainMapAllowMove&&bMiniMapAllowMove)
{me.RemoveZoomPreview();me.AllowMove=false;var iNewMapViewVectorY=me.iMapViewVectorY;var iNewMapViewVectorX=me.iMapViewVectorX;var GIW=me.tmTopoliszMap.GetMapGridItemWidth();var GIH=me.tmTopoliszMap.GetMapGridItemHeight();var GW=GIW*me.GetWidth();var GH=GIH*me.GetHeight();var MVW=me.tmTopoliszMap.GetMapViewWidth();var MVH=me.tmTopoliszMap.GetMapViewHeight();var MH=me.tmTopoliszMap.GetMapHeight();var MW=me.tmTopoliszMap.GetMapWidth();var MAH=me.tmTopoliszMap.GetActiveHeight();var MAW=me.tmTopoliszMap.GetActiveWidth();var iFullVectorX=me.iMapViewVectorX+iMoveMapVectorX;var iFullVectorY=me.iMapViewVectorY+iMoveMapVectorY;var iMinCoordX=0;var iMinCoordY=0;var iMaxCoordX=GIW*me.GetWidth()-MVW;if(iMaxCoordX<0)iMaxCoordX=0;var iMaxCoordY=GIH*me.GetHeight()-MVH;if(iMaxCoordY<0)iMaxCoordY=0;var iNewTop=me.iTop;var iNewLeft=me.iLeft;var bHangOut=false;if((iFullVectorX<iMinCoordX)||(iFullVectorX>iMaxCoordX)||(iFullVectorY<iMinCoordY)||(iFullVectorY>iMaxCoordY))
{bHangOut=true;}
if(!bHangOut)
{var iMaxMapViewVectorY=Math.min(GH+me.iTop*GIH,MH)-MVH-GIH*me.iTop;iNewMapViewVectorY=Math.min(iMaxMapViewVectorY,iFullVectorY);var iMaxMapViewVectorX=Math.min(GW+me.iLeft*GIW,MW)-MVW-GIW*me.iLeft;iNewMapViewVectorX=Math.min(iMaxMapViewVectorX,iFullVectorX);}
else
{var cx=iFullVectorX+GIW*me.iLeft;var maxcx=MW-MVW;if(cx>maxcx)cx=maxcx;if(cx<0)
{iNewLeft=0;iNewMapViewVectorX=0;}
else
{var ax=Math.floor(cx/GIW);var bx=Math.floor((GW-MVW)/(GIW*2));iNewLeft=ax-bx;iNewMapViewVectorX=cx-((ax-bx)*GIW);if(iNewLeft<0)
{iNewMapViewVectorX+=iNewLeft*GIW;iNewLeft=0;}}
var cy=iFullVectorY+GIH*me.iTop;var maxcy=MH-MVH;if(cy>maxcy)cy=maxcy;if(cy<0)
{iNewTop=0;iNewMapViewVectorY=0;}
else
{var ay=Math.floor(cy/GIH);var by=Math.floor((GH-MVH)/(GIH*2));iNewTop=ay-by;iNewMapViewVectorY=cy-((ay-by)*GIH);if(iNewTop<0)
{iNewMapViewVectorY+=iNewTop*GIH;iNewTop=0;}}}
if(me.bCanMoveX||me.bCanMoveY)
{me.tmTopoliszMap.iMovingSinceLastServerStateX+=(iNewMapViewVectorX-me.iMapViewVectorX);me.tmTopoliszMap.iMovingSinceLastServerStateY-=(iNewMapViewVectorY-me.iMapViewVectorY);}
if(me.bCanMoveX&&me.bCanMoveY)
{if((me.iMapViewVectorY!=iNewMapViewVectorY)||(me.iMapViewVectorX!=iNewMapViewVectorX)||(iNewTop!=me.iTop)||(iNewLeft!=me.iLeft))
{bRealMoveHappened=true;}
me.iMapViewVectorY=iNewMapViewVectorY;me.iMapViewVectorX=iNewMapViewVectorX;me.Load(iNewTop-me.iTop,iNewLeft-me.iLeft);}
else if(me.bCanMoveX)
{if((me.iMapViewVectorX!=iNewMapViewVectorX)||(iNewLeft!=me.iLeft))
{bRealMoveHappened=true;}
me.iMapViewVectorX=iNewMapViewVectorX;me.Load(0,iNewLeft-me.iLeft);}
else if(me.bCanMoveY)
{if((me.iMapViewVectorY!=iNewMapViewVectorY)||(iNewTop!=me.iTop))
{bRealMoveHappened=true;}
me.iMapViewVectorY=iNewMapViewVectorY;me.Load(iNewTop-me.iTop,0);}
else
{if(me.tmTopoliszMap.pMiniMapFrame)
me.tmTopoliszMap.pMiniMapFrame.ReArrange();me.AllowMove=true;}}
return bRealMoveHappened;}
this.GetLastTileIndexX=function()
{return Math.ceil(me.tmTopoliszMap.GetMapWidth()/me.tmTopoliszMap.GetMapGridItemWidth())-1;}
this.GetLastTileIndexY=function()
{return Math.ceil(me.tmTopoliszMap.GetMapHeight()/me.tmTopoliszMap.GetMapGridItemHeight())-1;}
this.GetMaxGridItemIndexX=function()
{var LastTileIdxX=me.GetLastTileIndexX();var ViewWidthInGrid=me.tmTopoliszMap.GetMapViewWidth()/me.tmTopoliszMap.GetMapGridItemWidth();var MaxGridItemIdxX=LastTileIdxX-Math.ceil(ViewWidthInGrid)-me.i_gWbase+1;return MaxGridItemIdxX;}
this.GetMaxMapViewVectorX=function()
{var i_pGridW=me.tmTopoliszMap.GetMapGridItemWidth();var i_pWbase=me.i_gWbase*i_pGridW;var ViewWidthInGrid=me.tmTopoliszMap.GetMapViewWidth()/me.tmTopoliszMap.GetMapGridItemWidth();var ExtX=(1+Math.floor(ViewWidthInGrid)-ViewWidthInGrid)*me.tmTopoliszMap.GetMapGridItemWidth();var MaxMapViewVectorX=i_pWbase+ExtX;return MaxMapViewVectorX;}
this.GetMaxGridItemIndexY=function()
{var LastTileIdxY=me.GetLastTileIndexY();var ViewHeightInGrid=me.tmTopoliszMap.GetMapViewHeight()/me.tmTopoliszMap.GetMapGridItemHeight();var MaxGridItemIdxY=LastTileIdxY-Math.ceil(ViewHeightInGrid)-me.i_gHbase+1;return MaxGridItemIdxY;}
this.GetMaxMapViewVectorY=function()
{var i_pGridH=me.tmTopoliszMap.GetMapGridItemHeight();var i_pHbase=me.i_gHbase*i_pGridH;var ViewHeightInGrid=me.tmTopoliszMap.GetMapViewHeight()/me.tmTopoliszMap.GetMapGridItemHeight();var ExtY=(1+Math.floor(ViewHeightInGrid)-ViewHeightInGrid)*me.tmTopoliszMap.GetMapGridItemHeight();var MaxMapViewVectorY=i_pHbase+ExtY;return MaxMapViewVectorY;}
this.GetViewAbsoluteTop=function()
{return me.tmTopoliszMap.GetMapGridItemHeight()*me.iTop+me.iMapViewVectorY;}
this.GetViewAbsoluteLeft=function()
{return me.tmTopoliszMap.GetMapGridItemWidth()*me.iLeft+me.iMapViewVectorX;}
this.MoveToAbsolutePos=function(iPosY,iPosX)
{var DY=me.GetViewAbsoluteTop();var DX=me.GetViewAbsoluteLeft();me.Move(iPosY-DY,iPosX-DX);}
this.ZoomPreviewOld=function(dZoomFactor,iBasePointX,iBasePointY)
{me.RemoveZoomPreview();var Idx=1;for(var iYIter=me.iTop;iYIter<me.iTop+me.iHeight;iYIter++)
{for(var iXIter=me.iLeft;iXIter<me.iLeft+me.iWidth;iXIter++)
{var image=me.arrGridItems[me.GetArrayCoordinate(iYIter,iXIter)].img;if(image!=null)
{{var oldLeft=GetLayerLeft(image.parentNode);var oldTop=GetLayerTop(image.parentNode);var oldHeight=GetLayerHeight(image);var oldWidth=GetLayerWidth(image);var iVertVector=4;var iHorizVector=4;image.className="mapPreview";image.id=Idx;Idx++;image.style.visibility="hidden";image.style.position="absolute";image.style.top=Math.floor(((oldTop-iBasePointY)*dZoomFactor+iBasePointY+iVertVector))+"px";image.style.left=Math.floor(((oldLeft-iBasePointX)*dZoomFactor+iBasePointX+iHorizVector))+"px";image.style.width=Math.floor((oldWidth*dZoomFactor))+"px";image.style.height=Math.floor((oldHeight*dZoomFactor))+"px";image.parentNode.removeChild(image);me.tmTopoliszMap.divMap.appendChild(image);me.arrGridItems[me.GetArrayCoordinate(iYIter,iXIter)].img=null;image.style.visibility="visible";StopAnyEvent(image);}}}}
me.MoveBackZoomPreview();}
this.ZoomPreview=function(dZoomFactor,iBasePointX,iBasePointY,iPreviewMoveX,iPreviewMoveY)
{me.ZoomPreview2(dZoomFactor,iBasePointX,iBasePointY,iPreviewMoveX,iPreviewMoveY);}
this.RemoveZoomPreview=function()
{var Idx=1;var fc=me.tmTopoliszMap.divMap.firstChild;var s=fc;while(s)
{var ns=s.nextSibling;if(s.className=="mapPreview")
{s.style.visibility="hidden";me.tmTopoliszMap.divMap.removeChild(s);}
s=ns;}}
this.ZoomPreviewPhase=function()
{var i;for(i=0;i<me.zoomPreviewAnim_Images.length;i++)
{var oldTop=me.zoomPreviewAnim_Tops[i];var oldLeft=me.zoomPreviewAnim_Lefts[i];var oldWidth=me.zoomPreviewAnim_ImageWidth;var oldHeight=me.zoomPreviewAnim_ImageHeight;var iBasePointX=me.zoomPreviewAnim_BasePointX;var iBasePointY=me.zoomPreviewAnim_BasePointY;var iPreviewEMoveX=me.zoomPreviewAnim_MoveX;var iPreviewEMoveY=me.zoomPreviewAnim_MoveY;var DZF=me.zoomPreviewAnim_ZoomFactor;var PN=me.zoomPreviewAnim_PhasesNum;var PL=me.zoomPreviewAnim_PhasesLeft;var PAN=PN-PL;var dZoomFactor=1+((DZF-1)/PN)*PAN;var iStartOpac=100;var iEndOpac=100;var iActOpac;iActOpac=((iEndOpac-iStartOpac)/PN)*PAN+iStartOpac;var image=me.zoomPreviewAnim_Images[i];image.style.visibility="hidden";image.style.top=Math.round(((oldTop-iBasePointY)*dZoomFactor+iBasePointY))+(iPreviewEMoveY*PAN)+"px";image.style.left=Math.round(((oldLeft-iBasePointX)*dZoomFactor+iBasePointX))+(iPreviewEMoveX*PAN)+"px";var iw=Math.round((oldWidth*dZoomFactor));var ih=Math.round((oldHeight*dZoomFactor));image.style.width=iw+"px";image.style.height=ih+"px";me.zoomPreviewAnim_Images_Width[i]=iw;me.zoomPreviewAnim_Images_Height[i]=ih;image.style.visibility="visible";}
me.zoomPreviewAnim_PhasesLeft--;if(me.zoomPreviewAnim_PhasesLeft>0)
window.setTimeout(me.ZoomPreviewPhase,5);else
{me.MoveBackZoomPreview();me.RemoveZoomPreview();}}
this.MoveBackZoomPreview=function()
{if(me.zoomPreviewAnim_Images!=null)
{var i;for(i=0;i<me.zoomPreviewAnim_Images.length;i++)
{var image=me.zoomPreviewAnim_Images[i];image.style.zIndex=3;}}}
this.ZoomPreview2=function(dZoomFactor,iBasePointX,iBasePointY,iPreviewMoveX,iPreviewMoveY)
{if(me.arrGridItems[0].img==null)
return;me.RemoveZoomPreview();if(me.zoomPreviewAnim_Images!=null)
{var i;for(i=0;i<me.zoomPreviewAnim_Images.length;i++)
{delete me.zoomPreviewAnim_Images[i];me.zoomPreviewAnim_Images[i]=null;me.zoomPreviewAnim_Images_Width[i]=null;me.zoomPreviewAnim_Images_Height[i]=null;}
delete me.zoomPreviewAnim_Images;delete me.zoomPreviewAnim_Images_Width;delete me.zoomPreviewAnim_Images_Height;me.zoomPreviewAnim_Images=null;me.zoomPreviewAnim_Images_Width=null;me.zoomPreviewAnim_Images_Height=null;}
if(me.zoomPreviewAnim_Tops!=null)
{delete me.zoomPreviewAnim_Tops;me.zoomPreviewAnim_Tops=null;}
if(me.zoomPreviewAnim_Lefts!=null)
{delete me.zoomPreviewAnim_Lefts;me.zoomPreviewAnim_Lefts=null;}
me.zoomPreviewAnim_Images=new Array();me.zoomPreviewAnim_Images_Width=new Array();me.zoomPreviewAnim_Images_Height=new Array();me.zoomPreviewAnim_Tops=new Array();me.zoomPreviewAnim_Lefts=new Array();me.zoomPreviewAnim_ImageHeight=null;me.zoomPreviewAnim_ImageWidth=null;me.zoomPreviewAnim_ZoomFactor=dZoomFactor;me.zoomPreviewAnim_BasePointX=iBasePointX;me.zoomPreviewAnim_BasePointY=iBasePointY;me.zoomPreviewAnim_PhasesLeft=10;me.zoomPreviewAnim_PhasesNum=10;me.zoomPreviewAnim_MoveX=iPreviewMoveX/me.zoomPreviewAnim_PhasesNum*me.zoomPreviewAnim_ZoomFactor;me.zoomPreviewAnim_MoveY=iPreviewMoveY/me.zoomPreviewAnim_PhasesNum*me.zoomPreviewAnim_ZoomFactor;var imwidth=GetLayerWidth(me.arrGridItems[0].img);var imheight=GetLayerHeight(me.arrGridItems[0].img);var Idx=1;for(var iYIter=me.iTop;iYIter<me.iTop+me.iHeight;iYIter++)
{for(var iXIter=me.iLeft;iXIter<me.iLeft+me.iWidth;iXIter++)
{var arrc=me.GetArrayCoordinate(iYIter,iXIter);var image=me.arrGridItems[arrc].img;if(image!=null)
{me.zoomPreviewAnim_Images[me.zoomPreviewAnim_Images.length]=image;me.zoomPreviewAnim_Tops[me.zoomPreviewAnim_Tops.length]=GetLayerTop(image.parentNode);me.zoomPreviewAnim_Lefts[me.zoomPreviewAnim_Lefts.length]=GetLayerLeft(image.parentNode);me.zoomPreviewAnim_Images_Width[arrc]=imwidth;me.zoomPreviewAnim_Images_Height[arrc]=imheight;me.zoomPreviewAnim_ImageWidth=imwidth;me.zoomPreviewAnim_ImageHeight=imheight;image.className="mapPreview";image.id=Idx;Idx++;image.style.visibility="hidden";image.style.position="absolute";image.parentNode.removeChild(image);me.tmTopoliszMap.divMap.appendChild(image);me.arrGridItems[me.GetArrayCoordinate(iYIter,iXIter)].img=null;image.style.visibility="visible";StopAnyEvent(image);}}}
me.ZoomPreviewPhase();}
this.Hide=function()
{for(var iYIter=me.iTop;iYIter<me.iTop+me.iHeight;iYIter++)
{for(var iXIter=me.iLeft;iXIter<me.iLeft+me.iWidth;iXIter++)
{var image=me.arrGridItems[me.GetArrayCoordinate(iYIter,iXIter)].img;image.style.visibility="hidden";}}}}

function CMapGridItem(tmTopoliszMap)
{this.iLeft=0;this.iTop=0;this.pMap=tmTopoliszMap;this.iWidth=this.pMap.GetMapGridItemWidth();this.iHeight=this.pMap.GetMapGridItemHeight();this.iIdxX=0;this.iIdxY=0;this.iLevel=0;this.strUrl="";this.div=null;this.img=null;this.div=NewTag('div');this.div.className="gridItem";this.div.style.left=this.iLeft+"px";this.div.style.top=this.iTop+"px";this.div.style.width=this.iWidth+"px";this.div.style.height=this.iHeight+"px";this.div.style.position="absolute";this.visible=true;var me=this;this.SetPos=function(iPosY,iPosX)
{me.div.style.left=(Math.floor(iPosX))+"px";me.div.style.top=(Math.floor(iPosY))+"px";}
this.GetImgId=function()
{return me.pMap.divMap.id+"img"+me.iLevel+";"+me.iIdxY+";"+me.iIdxX;}
this.Load=function(iLevel,iIdxY,iIdxX)
{var bNoImg=(me.img==null)?true:false;me.iIdxX=iIdxX;me.iIdxY=iIdxY;me.iLevel=iLevel;if(bNoImg)
{me.img=document.createElement('img');me.img.className="gridItem";me.img.style.position="absolute";}
me.div.style.display="none";me.img.style.display="none";me.img.onload=function()
{if(!me.visible)
{if(me.div)
me.div.style.display="none";if(me.img)
me.img.style.display="none";}
else
{if(me.div)
me.div.style.display="";if(me.img)
me.img.style.display="";}}
me.img.setAttribute("id",me.GetImgId());if(bNoImg)
{me.div.appendChild(me.img);}
var FileName=me.pMap.pGridMain.GetImageFileName(iIdxY,iIdxX);SetImage(me.img,FileName,me.iWidth,me.iHeight,me.iDummy);}
this.Show=function()
{me.visible=true;if(me.div)
me.div.style.display="";if(me.img)
me.img.style.display="";}
this.Hide=function()
{me.visible=false;if(me.div)
me.div.style.display="none";if(me.img)
me.img.style.display="none";}
this.Set=function(iLevel,iIdxY,iIdxX)
{me.Load(iLevel,iIdxY,iIdxX);}
this.RemoveImg=function()
{}}

function CAddressSearchUserState(strInputText,address,arrAddressList)
{this.strInputText=strInputText;this.address=address;this.arrAddressList=arrAddressList;}
function CAddressSearch(pTopoliszMap)
{this.bAutoSearch=true;this.bAutoHideResultList=true;this.bAutoComplete=true;this.bUseComplexAddress=false;this.bOKPressed=false;this.strEventSource=null;this.strInputText="";this.address=null;this.arrAddressList=null;this.strLastSearchString="";this.iActive=0;this.strDefaultText="";this.iListOffsetX=5;this.iListOffsetY=20;this.iCommandID=null;this.bSearchNeeded=false;this.pTopoliszMap=pTopoliszMap;this.input=null;this.divResult=null;this.divHint=null;this.killTimer=null;this.bSkipNextBlur=false;this.bListHidden=false;this.bDisplayPostcode=false;this.iStamp=0;this.bStrongSearch=false;this.bIsBusy=false;this.timerSearch=null;this.OnOK=function(strEventSource)
{}
this.OnAddressFound=function(address)
{}
this.OnSearchEnded=function(bFound)
{}
var me=this;this.SetServer=function(pTopoliszMap)
{me.pTopoliszMap=pTopoliszMap;}
this.SetAddress=function(pAddress)
{me.iStamp++;me.bIsBusy=false;me.bStrongSearch=false;delete me.arrAddressList;me.arrAddressList=new Array();me.address=null;me.strLastSearchString="";me.strInputText="";me.iActive=0;me.bWasDeleteBack=false;if(pAddress!=null)
{if(pAddress.strName!=null&&pAddress.strName.length>0)
me.strInputText=pAddress.strName;else
me.strInputText=pAddress.strAddress;if(pAddress.dX>0&&pAddress.dY>0)
{me.address=pAddress;me.strLastSearchString=pAddress.strAddress;}
else
{me.Show();me.FindAddress();return;}}
else
{me.strInputText=="";}
me.ClearHint();if(me.input)
me.Show();me.OnSearchEndedInternal(me.address?true:false);if(me.address!=null)
{if(me.OnAddressFound)
{try{me.OnAddressFound(pAddress);}
catch(exp){if(me.pTopoliszMap.OnError)
me.pTopoliszMap.OnError(exp,'AddressSearch.OnAddressFound');}}}
if(me.bOKPressed)
me.Go();}
this.ValidateAddress=function()
{if(me.strInputText!=me.GetInputValue())
me.address=null;}
this.GetAddress=function()
{me.ValidateAddress();return me.address;}
this.IsDisplayPostcode=function()
{return me.bDisplayPostcode;}
this.SetDisplayPostcode=function(bDisplay)
{me.bDisplayPostcode=bDisplay;}
this.IsUnique=function()
{return(me.address!=null);}
this.HasList=function()
{return GetArrayLength(me.arrAddressList)>0;}
this.SetInput=function(input)
{me.input=input;if(me.input)
{AddEvent(me.input,'focus',me.OnFocus);AddEvent(me.input,'blur',me.OnBlur);AddEvent(me.input,'change',me.OnChange);AddEvent(me.input,'keyup',me.OnKeyUp);AddEvent(me.input,'keypress',me.OnKeyPress);AddEvent(me.input,'click',me.OnClick);}}
this.GetInput=function()
{return me.input;}
this.SetHintDiv=function(div)
{me.divHint=div;if(me.divHint)
{me.divHint.className="AddressHint"}}
this.ClearHint=function()
{if(me.divHint)
{while(me.divHint.firstChild)
me.divHint.removeChild(me.divHint.firstChild)}}
this.HintExample=function()
{if(me.divHint)
{me.ClearHint();me.divHint.className="AddressHint"
if((typeof(g_InitSettings)!='undefined')&&g_InitSettings.strCountryName=="Románia")
NewTextTag(g_Babel.GetWord('ExampleAddressRo',""),me.divHint);else
NewTextTag(g_Babel.GetWord('ExampleAddress',"pl. Budapest V. Vigadó tér 2  vagy  N47.3 E19.3"),me.divHint);}}
this.HintError=function()
{if(me.divHint)
{me.ClearHint();me.divHint.className="AddressHintError"
NewTextTag(g_Babel.GetWord('AddressError',"Hibás cím!"),me.divHint);}}
this.HintList=function()
{if(me.divHint)
{me.ClearHint();me.divHint.className="AddressHintError"
NewTextTag(g_Babel.GetWord('SelectAddressFromList',"Nem egyértelmű cím!"),me.divHint);}}
this.GetUserState=function()
{return new CAddressSearchUserState(me.strInputText,me.address,me.arrAddressList);}
this.SetUserState=function(state)
{me.strInputText=state.strInputText;me.SetInputValue(me.strInputText);me.address=state.address;me.arrAddressList=state.arrAddressList;}
this.IsAutoSearch=function()
{return me.bAutoSearch;}
this.SetAutoSearch=function(bValue)
{me.bAutoSearch=bValue;}
this.SetDefaultText=function(strDefaultText)
{var strInputValue=me.GetInputValue();me.strDefaultText=strDefaultText;me.SetInputValue(strInputValue);}
this.GetDefaultText=function()
{return me.strDefaultText;}
this.SetListOffset=function(iListOffsetX,iListOffsetY)
{me.iListOffsetX=iListOffsetX;me.iListOffsetY=iListOffsetY;}
this.GetListOffsetX=function()
{return me.iListOffsetX;}
this.GetListOffsetY=function()
{return me.iListOffsetY;}
this.SetInputValue=function(strInputValue)
{if(me.input)
{if(strInputValue!="")
me.input.value=strInputValue;else
me.input.value=me.strDefaultText;}
else
{me.strInputText=strInputValue;}}
this.GetInputValue=function()
{if(me.input)
{if(me.input.value!=me.strDefaultText)
return me.input.value;else
return"";}
else
return me.strInputText;}
this.OnFocus=function(pEvent)
{if(me.input.value==me.strDefaultText)
{if((typeof(g_InitSettings)=='undefined')||g_InitSettings.strCountryName=="Magyarország")
me.input.value="Budapest ";else
me.input.value="";me.input.select();me.HintExample();}
if(me.IsUnique())
{me.HintExample();}
if(me.HasList())
{}}
this.HideList=function()
{me.bListHidden=true;if(me.divResult&&me.divResult.parentNode)
{me.divResult.style.display="none";}}
this.UnhideList=function()
{me.bListHidden=false;if(me.divResult&&me.divResult.parentNode)
{me.divResult.style.display="";}}
this.OnBlur=function(pEvent)
{if(me.input.value=="")
{me.input.value=me.strDefaultText;me.ClearHint();}
if(me.bAutoSearch)
{if(!me.bOKPressed)
{me.bStrongSearch=true;me.FindAddress();}}
if(me.IsUnique())
me.ClearHint();if(me.HasList())
{if(me.bAutoHideResultList)
{if(me.divResult&&me.divResult.parentNode)
{if(!me.bSkipNextBlur)
{me.killTimer=window.setTimeout(me.HideList,250);window.setTimeout(me.input.focus,250);}
else
me.bSkipNextBlur=false;return;}}}
StopEventPropagation(pEvent);return false;}
this.OnClick=function(pEvent)
{if(me.bAutoHideResultList&&me.HasList())
{if(me.bListHidden)
me.ShowList();else
me.UnhideList();}}
this.OnBeforeDeactivate=function(pEvent)
{var divTo=GetEventRelatedElement(pEvent);if(divTo&&divTo.nodeName.toLowerCase()=="body")
{return false;}
return true;}
this.OnChange=function(pEvent)
{}
this.OnKeyUp=function(pEvent)
{if(me.input.value==me.strDefaultText)
me.input.value="";if(pEvent==null)
pEvent=window.event;if(pEvent.keyCode==38)
{if(me.iActive>0)
me.SetActive(me.iActive-1);else
me.SetActive(GetArrayLength(me.arrAddressList)-1);StopEventPropagation(pEvent);return false;}
if(pEvent.keyCode==40)
{if(me.iActive<GetArrayLength(me.arrAddressList)-1)
me.SetActive(me.iActive+1);else
me.SetActive(0);StopEventPropagation(pEvent);return false;}
if(pEvent.keyCode!=13)
{me.SetActive(-1);}}
this.OnKeyPress=function(pEvent)
{if(me.input.value==me.strDefaultText)
me.input.value="";if(pEvent==null)
pEvent=window.event;if(pEvent.keyCode==13)
{if(me.HasList()&&me.bListHidden)
me.UnhideList();else
me.Go("enter");if(GetArrayLength(me.arrAddressList)==1)
{return true;}
else
{StopEventPropagation(pEvent);return false;}}
else if(pEvent.keyCode==27)
{me.SetAddress(null);me.input.value="";}
else if(me.bAutoComplete&&(me.GetInputValue().length>1))
{keycodes=[9,37,38,39,40];charcodes=[32,46,44]
for(var i=0;i<keycodes.length;i++)
{if(pEvent.keyCode==keycodes[i])
return;}
for(var i=0;i<charcodes.length;i++)
{if(pEvent.charCode==charcodes[i])
return;}
me.bSearchNeeded=true;if(me.timerSearch==null)
{me.timerSearch=window.setTimeout(me.FindAddressListOnly,500);}}}
this.KillTimer=function()
{me.bSkipNextBlur=true;if(me.killTimer)
{window.clearTimeout(me.killTimer);me.killTimer=null;}}
this.SetOnClick=function(a,address,iAddress)
{a.onclick=function()
{me.SetAddress(address);}
a.onmouseover=function()
{me.SetActive(iAddress,true);}
a.onkeyup=me.OnKeyPress;}
this.Show=function()
{me.SetInputValue(me.strInputText);me.ShowList();}
this.ShowList=function()
{me.ClearResultDiv();if(me.HasList())
{me.divResult=NewTag('div',document.body);me.divResult.className="AddressResult";me.divResult.style.position="absolute";me.divResult.style.top=(GetAbsLayerTop(me.input)+GetLayerHeight(me.input))+"px";me.divResult.style.left=(GetAbsLayerLeft(me.input))+"px";me.divResult.style.width=(GetLayerWidth(me.input)-1)+"px";AddEvent(me.divResult,'keyup',me.OnKeyUp);AddEvent(me.divResult,'keypress',me.OnKeyPress);AddEvent(me.divResult,'mousedown',me.KillTimer);AddEvent(me.divResult,'mouseover',me.KillTimer);var iLength=GetArrayLength(me.arrAddressList);var a;var i;for(i=0;i<iLength;i++)
{a=NewTag('a',me.divResult);a.setAttribute('href','javascript:void(0)');if(i==me.iActive)
a.className="AddressResultActive";else
a.className="AddressResult";a.style.zIndex="5";var pAddress=me.arrAddressList[i];me.SetOnClick(a,me.arrAddressList[i],i);NewTextTag(me.arrAddressList[i].strAddress,a);}
if(GetLayerHeight(me.divResult)>150)
{me.divResult.style.height="150px";me.divResult.style.overflowY="scroll";}}}
this.SetActive=function(iActive,bSkipScroll)
{me.iActive=iActive;if(me.divResult)
{var aList=me.divResult.getElementsByTagName("a");for(var i=0;i<aList.length;i++)
{if(i==iActive)
{aList[i].className="AddressResultActive";if(bSkipScroll)
{}
else
{var iTop=GetLayerTop(aList[i]);aList[i].parentNode.scrollTop=iTop;}}
else
aList[i].className="AddressResult";}
if(iActive<=0)
me.UnhideList();}}
this.ClearResultDiv=function()
{if(me.divResult)
{if(me.divResult.parentNode)
me.divResult.parentNode.removeChild(me.divResult);delete me.divResult;me.divResult=null;}}
this.FillAddress=function(addresslist,clientParam,iCommandID)
{me.bIsBusy=false;if(me.iStamp!=clientParam.iStamp)
return;me.iCommandID=null;me.strLastSearchString=clientParam.strInputText;me.arrAddressList=addresslist;if(GetArrayLength(me.arrAddressList)==1)
me.SetActive(0);else
me.SetActive(-1);me.ShowList();me.FindAddress();}
this.FindAddressListOnly=function()
{me.timerSearch=null;if(me.bSearchNeeded)
{if(me.bIsBusy)
me.timerSearch=window.setTimeout(me.FindAddressListOnly,500)
else
me.FindAddress();}}
this.FindAddress=function()
{if(me.timerSearch)
{window.clearTimeout(me.timerSearch);me.timerSearch=null;}
me.bSearchNeeded=false;me.bListHidden=false;me.strInputText=me.GetInputValue();if(me.strInputText!=me.strLastSearchString)
{me.address=null;var clientParam={'strInputText':me.strInputText,'iStamp':me.iStamp};if(me.strInputText!=null&&me.strInputText.length>0)
{me.bIsBusy=true;me.iCommandID=me.pTopoliszMap.NoSessionServer.CallFunction("FindAddress","strAddress="+me.strInputText+"&bComplex="+me.bUseComplexAddress,0,me.FillAddress,clientParam);}
else
{me.FillAddress(null,clientParam,null);return;}}
else if(me.bStrongSearch)
{var iCount=GetArrayLength(me.arrAddressList);if(iCount==1)
{me.SetAddress(me.arrAddressList[0]);me.ClearHint();}
else if(iCount>1)
{me.HintList();me.OnSearchEndedInternal(false);}
else if(me.strInputText.length>0)
{me.HintError();me.OnSearchEndedInternal(false);}}}
this.OnSearchEndedInternal=function(bFound)
{if(me.OnSearchEnded)
{try{me.OnSearchEnded(bFound);}
catch(exp){if(me.pTopoliszMap.OnError)
me.pTopoliszMap.OnError(exp,'AddressSearch.SearchEnded');}}}
this.Go=function(strEventSource)
{me.bOKPressed=true;if(strEventSource!=undefined&&strEventSource!=null)
{me.strEventSource=strEventSource;}
me.strInputText=me.GetInputValue();if(me.strInputText!=me.strLastSearchString)
{me.bStrongSearch=true;me.FindAddress();}
else
{if(me.HasList())
{if(me.iActive>=0&&me.iActive<GetArrayLength(me.arrAddressList))
{if(GetArrayLength(me.arrAddressList)!=1)
me.bOKPressed=false;return me.SetAddress(me.arrAddressList[me.iActive]);}
else
me.UnhideList();}
else
{me.bOKPressed=false;if(me.OnOK)
{try{me.OnOK(me.strEventSource);me.strEventSource=null;}
catch(exp){if(me.pTopoliszMap.OnError)
me.pTopoliszMap.OnError(exp,'AddressSearch.OnOK');}}}}}}

function PageButton(a,iPage,pDrawPager)
{this.a=a;this.iPage=iPage;this.pDrawPager=pDrawPager;this.ClickHandler=function()
{if(me.pDrawPager.aSelected)
me.pDrawPager.aSelected.style.color=me.pDrawPager.strActiveColor;me.pDrawPager.aSelected=me.a;me.pDrawPager.aSelected.style.color=me.pDrawPager.strActualPageColor;me.pDrawPager.OnShowPage(me.iPage);}
var me=this;a.onclick=me.ClickHandler;}
function DrawPager(divParent,iVisiblePagesNumber,iStartPageNumber,iPagesNumber)
{this.iVisiblePagesNumber=(iVisiblePagesNumber!=undefined&&iVisiblePagesNumber!=null?iVisiblePagesNumber:5);this.iStartPageNumber=(iStartPageNumber!=undefined&&iStartPageNumber!=null?iStartPageNumber:1);this.iPagesNumber=(iPagesNumber!=undefined&&iPagesNumber!=null?iPagesNumber:10);this.strPreviousCaption=g_Babel.GetWord('PagerPrevious');this.strNextCaption=g_Babel.GetWord('PagerNext');this.strActiveColor="#70706e";this.strActualPageColor="Black";this.strInActiveColor="White";this.m_actPageNum=1;var i=0;var cen=NewTag("center",divParent);var div=NewTag("div",cen);div.className="pager";var t=NewTag("table",div);var tb=NewTag("tbody",t);this.tr=NewTag("tr",tb);this.aSelected=null;this.OnPageChange=null;this.OnNextPages=null;this.OnPreviousPages=null;this.aPrevious=null;this.aNext=null;var me=this;this.OnShowPage=function(iPageNum)
{if(me.OnPageChange)
me.OnPageChange(iPageNum);}
this.NextHandler=function()
{if(me.OnNextPages)
me.OnNextPages();}
this.PreviousHandler=function()
{if(me.OnPreviousPages)
me.OnPreviousPages();}
this.DoNext=function()
{if(me.iStartPageNumber<me.iPagesNumber-me.iVisiblePagesNumber+1)
me.iStartPageNumber=me.iStartPageNumber+1;}
this.DoPrevious=function()
{if(me.iStartPageNumber>1)
me.iStartPageNumber=me.iStartPageNumber-1;}
this.Clear=function()
{while(me.tr.hasChildNodes())
{me.tr.removeChild(me.tr.firstChild);}}
this.Create=function()
{me.tr.style.visibility="hidden";DeleteChildren(me.tr,"");if((me.iStartPageNumber>=1)&&(me.iPagesNumber>me.iVisiblePagesNumber))
{var td=NewTag("td");td.className="pager";td.style.paddingRight="7px";var a=NewTag("a",td);me.aPrevious=a;a.href="javascript:void(0);";if(me.iStartPageNumber>1)
{a.onclick=function(){me.PreviousHandler();};a.style.color=me.strActiveColor;}
else
{a.onclick="javascript:void(0);";a.style.color=me.strInActiveColor;}
NewTextTag(me.strPreviousCaption,a);AddTag(td,me.tr);}
for(i=0;i<me.iVisiblePagesNumber;i++)
{if(me.iStartPageNumber+i<=me.iPagesNumber)
{var td=NewTag("td");td.className="pager";var a=NewTag("a",td);a.href="javascript:void(0);";if(me.m_actPageNum!=me.iStartPageNumber+i)
a.style.color=me.strActiveColor;else
a.style.color="Red";new PageButton(a,me.iStartPageNumber+i,me);NewTextTag((me.iStartPageNumber+i),a);AddTag(td,me.tr);}}
if(me.iStartPageNumber+me.iVisiblePagesNumber-1<=me.iPagesNumber)
{var td=NewTag("td");td.className="pager";td.style.paddingLeft="7px";var a=NewTag("a",td);a.href="javascript:void(0);";me.aNext=a;if(me.iStartPageNumber+me.iVisiblePagesNumber-1==me.iPagesNumber)
{a.onclick="javascript:void(0);";a.style.color=me.strInActiveColor;}
else
{a.onclick=function(){me.NextHandler();};a.style.color=me.strActiveColor;}
NewTextTag(me.strNextCaption,a);AddTag(td,me.tr);}
me.tr.style.visibility="visible";}
this.OnChangeLang=function()
{}
g_Babel.AddListener(this.OnChangeLang);me.Create();}

function MultiLangItem(item,type,babelID,prefix,suffix)
{this.m_item=item;this.m_type=type;this.m_babelID=babelID;this.m_prefix=prefix;this.m_suffix=suffix;}
function LanguageSupporter()
{this.arrRadioCarOptims=new Array();var me=this;this.Add=function(item,type,babelID,prefix,suffix,bMulti)
{if(item!=null)
{var i;for(i=0;i<me.arrRadioCarOptims.length;i++)
{if((me.arrRadioCarOptims[i].m_item==item)&&(bMulti!=true))
{me.arrRadioCarOptims[i].m_type=type;me.arrRadioCarOptims[i].m_babelID=babelID;me.arrRadioCarOptims[i].m_prefix=prefix;me.arrRadioCarOptims[i].m_suffix=suffix;return;}}
me.arrRadioCarOptims.push(new MultiLangItem(item,type,babelID,prefix,suffix));}};this.Apply=function()
{var i;for(i=0;i<me.arrRadioCarOptims.length;i++)
{var mli=me.arrRadioCarOptims[i];if(mli!=null)
{if(mli.m_type=='innerHTML')
{mli.m_item.innerHTML=mli.m_prefix+g_Babel.GetWord(mli.m_babelID)+mli.m_suffix;}
else if(mli.m_type=='nodeValue')
{mli.m_item.nodeValue=mli.m_prefix+g_Babel.GetWord(mli.m_babelID)+mli.m_suffix;}
else if(mli.m_type=='value')
{mli.m_item.value=mli.m_prefix+g_Babel.GetWord(mli.m_babelID)+mli.m_suffix;}
else if(mli.m_type=='text')
{mli.m_item.text=mli.m_prefix+g_Babel.GetWord(mli.m_babelID)+mli.m_suffix;}
else if(mli.m_type=='alt')
{mli.m_item.alt=mli.m_prefix+g_Babel.GetWord(mli.m_babelID)+mli.m_suffix;}
else if(mli.m_type=='strText')
{mli.m_item.strText=mli.m_prefix+g_Babel.GetWord(mli.m_babelID)+mli.m_suffix;}
else if(mli.m_type=='strTextActive')
{mli.m_item.strTextActive=mli.m_prefix+g_Babel.GetWord(mli.m_babelID)+mli.m_suffix;}}}}}

function CUtvonaltervAddressBlock(pTopoliszMap,pUtvonaltervRouteSearch,bThereCanBeOnlyTwo)
{this.divMain=null;this.pTopoliszMap=pTopoliszMap;this.pRouteSearch=pUtvonaltervRouteSearch;this.iOrder=0;this.inputbox=null;this.panelHeader=null;this.pSearch=new CAddressSearch(this.pTopoliszMap);this.pSearch.SetDefaultText(g_Babel.GetWord('DefaultAddress'));this.OnDelete=function(who){};this.OnMoveDown=function(who){};this.OnMoveUp=function(who){};this.OnMoveBack=function(who){};this.OnAddAddressBefore=function(who){};this.OnOK=function(who,strEventSource){};this.OnAddressFound=function(who,address){};this.OnSearchEnded=function(){};this.divAddressFormatHelp=null;this.bThereCanBeOnlyTwo=bThereCanBeOnlyTwo;var me=this;this.SetAddress=function(address)
{me.pSearch.SetAddress(address);}
this.GetAddress=function()
{return me.pSearch.GetAddress();}
this.Go=function()
{return me.pSearch.Go("buttonShowAddress");}
this.SetDiv=function(div)
{me.divMain=div;}
this.GetDiv=function()
{return me.divMain;}
this.OnOKInternal=function(strEventSource)
{if(me.OnOK)
me.OnOK(me,strEventSource);}
this.pSearch.OnOK=me.OnOKInternal;this.SaveAddress=function()
{var strAppID="";if(g_InitSettings.strCountryName=="Románia")
strAppID="Ro";var address=me.GetAddress();if(address!=null)
{setCookie('strAddress'+strAppID+me.iOrder,address.strAddress);setCookie('strName'+strAppID+me.iOrder,(address.strName!=null?address.strName:""));setCookie('dX'+strAppID+me.iOrder,address.dX);setCookie('dY'+strAppID+me.iOrder,address.dY);setCookie('dMinX'+strAppID+me.iOrder,address.dMinX);setCookie('dMinY'+strAppID+me.iOrder,address.dMinY);setCookie('dMaxX'+strAppID+me.iOrder,address.dMaxX);setCookie('dMaxY'+strAppID+me.iOrder,address.dMaxY);}
else
{var osido=new Date(0);setCookie('strAddress'+strAppID+me.iOrder,"",osido);setCookie('strName'+strAppID+me.iOrder,"",osido);setCookie('dX'+strAppID+me.iOrder,null,osido);setCookie('dY'+strAppID+me.iOrder,null,osido);setCookie('dMinX'+strAppID+me.iOrder,null,osido);setCookie('dMinY'+strAppID+me.iOrder,null,osido);setCookie('dMaxX'+strAppID+me.iOrder,null,osido);setCookie('dMaxY'+strAppID+me.iOrder,null,osido);}}
this.LoadAddress=function()
{var strAppID="";if(g_InitSettings.strCountryName=="Románia")
strAppID="Ro";var strAddress=getCookie('strAddress'+strAppID+me.iOrder);if(strAddress!=null&&g_strAppID.toLowerCase()!="trafficnav")
{var address=new CAddress(strAddress);address.strName=getCookie('strName'+strAppID+me.iOrder);address.dX=parseFloat(getCookie('dX'+strAppID+me.iOrder));address.dY=parseFloat(getCookie('dY'+strAppID+me.iOrder));address.dMinX=parseFloat(getCookie('dMaxX'+strAppID+me.iOrder));address.dMinY=parseFloat(getCookie('dMaxY'+strAppID+me.iOrder));address.dMaxX=parseFloat(getCookie('dMaxX'+strAppID+me.iOrder));address.dMaxY=parseFloat(getCookie('dMaxY'+strAppID+me.iOrder));me.pSearch.SetAddress(address);}}
this.OnAddressFoundInternal=function(address)
{if(me.OnAddressFound)
me.OnAddressFound(me,address);}
this.pSearch.OnAddressFound=me.OnAddressFoundInternal;this.OnSearchEndedInternal=function(bFound)
{if(me.OnSearchEnded)
me.OnSearchEnded(bFound);}
this.pSearch.OnSearchEnded=me.OnSearchEndedInternal;this.Delete=function()
{me.pSearch.SetAddress(null);if(me.OnDelete)
me.OnDelete(me);}
this.MoveDown=function()
{if(me.OnMoveDown)
me.OnMoveDown(me);}
this.MoveUp=function()
{if(me.OnMoveUp)
me.OnMoveUp(me);}
this.MoveBack=function()
{if(me.OnMoveBack)
me.OnMoveBack(me);}
this.AddAddressBefore=function()
{if(me.OnAddAddressBefore)
me.OnAddAddressBefore(me);}
this.Show=function()
{if(me.divMain)
{me.divMain.className="TextResultDragAddress";while(me.divMain.firstChild)
me.divMain.removeChild(me.divMain.firstChild);me.panelHeader=new Panel(me.divMain);me.ShowHeader();me.inputbox=new InputBox(me.divMain);me.pSearch.SetInput(me.inputbox.input);me.pSearch.Show();var td=me.inputbox.AppendIconTd();var a=NewTag('a',td);new ImgLink(a,22,22,"design/BUTTON_delete_off.gif","design/BUTTON_delete_on.gif",null,null,g_Babel.GetWord('hintDeleteAddress'),false);AddEvent(a,"click",me.Delete);var td=me.inputbox.AppendIconTd();var a=NewTag('a',td);new ImgLink(a,22,22,"design/BUTTON_display_off.gif","design/BUTTON_display_on.gif",null,null,g_Babel.GetWord('hintShowAddress'),false);AddEvent(a,"click",me.pSearch.Go);var div=NewTag('div',me.divMain);me.pSearch.SetHintDiv(div);}
if(me.OnShowRegistered){try{me.OnShowRegistered(me);}
catch(exp){if(me.pTopoliszMap.OnError)
me.pTopoliszMap.OnError(exp,'AddressBlock.OnShowRegistered');}}}
this.ShowHeader=function()
{if(me.panelHeader)
{while(me.panelHeader.tr.firstChild)
me.panelHeader.tr.removeChild(me.panelHeader.tr.firstChild);if(me.iOrder==0)
{me.panelHeader.CreateCaption(g_Babel.GetWord('Start'),"design/ICON_flag_green.gif",14,14);}
else if(me.iOrder==GetArrayLength(me.pRouteSearch.arrAddressBlocks)-1)
{me.panelHeader.CreateCaption(g_Babel.GetWord('Stop'),"design/ICON_flag_red.gif",14,14);}
else
{me.panelHeader.CreateCaption(me.iOrder+1+". ","design/ICON_flag_gray.gif",14,14);}
var td=NewTag('td',me.panelHeader.tr);if(!me.bThereCanBeOnlyTwo){if(me.iOrder!=0&&GetArrayLength(me.pRouteSearch.arrAddressBlocks)<me.pRouteSearch.MAXADDRESSBLOCKS)
{var td=NewTag('td',me.panelHeader.tr);td.style.width="15px";var a=NewTag('a',td);new ImgLink(a,15,14,"design/ICON_add2_off.gif","design/ICON_add2_on.gif",null,null,g_Babel.GetWord('capInsertVisitNode'),false)
AddEvent(a,"click",me.AddAddressBefore);}
if(me.iOrder!=GetArrayLength(me.pRouteSearch.arrAddressBlocks)-1)
{var td=NewTag('td',me.panelHeader.tr);td.style.width="15px";var a=NewTag('a',td);new ImgLink(a,15,14,"design/ICON_down_off.gif","design/ICON_down_on.gif",null,null,g_Babel.GetWord('hintMoveDown'),false)
AddEvent(a,"click",me.MoveDown);}
if(me.iOrder!=0)
{var td=NewTag('td',me.panelHeader.tr);td.style.width="15px";var a=NewTag('a',td);new ImgLink(a,15,14,"design/ICON_up_off.gif","design/ICON_up_on.gif",null,null,g_Babel.GetWord('hintMoveUp'),false)
AddEvent(a,"click",me.MoveUp);}}}}
this.OnChangeLang=function()
{me.ShowHeader();me.pSearch.SetDefaultText(g_Babel.GetWord('DefaultAddress'));}
g_Babel.AddListener(this.OnChangeLang);}

function PTServiceProvider(nID,bLocal,bGlobalBus,bGlobalTrain,strName,strAddress,strPhone,strWebSite,strAreaDescription,strLinkPrefix)
{this.nID=(nID!=undefined?nID:0);this.bLocal=(bLocal!=undefined?bLocal:false);this.bGlobalBus=(bGlobalBus!=undefined?bGlobalBus:false);this.bGlobalTrain=(bGlobalTrain!=undefined?bGlobalTrain:false);this.strName=(strName!=undefined?strName:"");this.strAddress=(strAddress!=undefined?strAddress:"");this.strPhone=(strPhone!=undefined?strPhone:"");this.strWebSite=(strWebSite!=undefined?strWebSite:"");this.strAreaDescription=(strAreaDescription!=undefined?strAreaDescription:"");this.strLinkPrefix=(strLinkPrefix!=undefined?strLinkPrefix:"");}
function VehicleType(nID,strName)
{this.nID=(nID!=undefined?nID:0);this.strName=(strName!=undefined?strName:"");}
function PTRunView(iServiceProviderID,strVehicleTypeEnum,strName,iRunSubID)
{this.iServiceProviderID=(iServiceProviderID!=undefined?iServiceProviderID:0);this.strVehicleTypeEnum=(strVehicleTypeEnum!=undefined?strVehicleTypeEnum:"");this.strName=(strName!=undefined?strName:"");this.iRunSubID=(iRunSubID!=undefined?iRunSubID:0);}
function PTRun(strVehicleType,iVehicleTypeID,iServiceProviderID,iRunSubID,strName,strDescription,strLink,bSingleDir,strClass,bShowName,bShowDescription,arrStops)
{this.strVehicleType=(strVehicleType!=undefined?strVehicleType:"");this.iVehicleTypeID=(iVehicleTypeID!=undefined?iVehicleTypeID:0);this.iServiceProviderID=(iServiceProviderID!=undefined?iServiceProviderID:0);this.iRunSubID=(iRunSubID!=undefined?iRunSubID:0);this.strName=(strName!=undefined?strName:"");this.strDescription=(strDescription!=undefined?strDescription:"");this.strLink=(strLink!=undefined?strLink:"");this.bSingleDir=(bSingleDir!=undefined?bSingleDir:0);this.strClass=(strClass!=undefined?strClass:"");this.bShowName=(bShowName!=undefined?bShowName:true);this.bShowDescription=(bShowDescription!=undefined?bShowDescription:false);this.arrStops=(arrStops!=undefined?arrStops:new Array());}
function ClickablePTStop(nID,iPxlX,iPxlY,dWgsX,dWgsY,strName,strLink,arrRuns,strCity)
{this.nID=(nID!=undefined?nID:0);this.iPxlX=(iPxlX!=undefined?iPxlX:0);this.iPxlY=(iPxlY!=undefined?iPxlY:0);this.dWgsX=(dWgsX!=undefined?dWgsX:0);this.dWgsY=(dWgsY!=undefined?dWgsY:0);this.strName=(strName!=undefined?strName:"");this.strLink=(strLink!=undefined?strLink:"");this.arrRuns=(arrRuns!=undefined?arrRuns:[]);this.strCity=(strCity!=undefined?strCity:"");}
function RoutePTRun(strVehicleType,iVehicleTypeID,iServiceProviderID,iRunSubID,strName,strDescription,strLink,iStops,strClass,bShowName,bShowDescription,bLowDeck)
{this.strVehicleType=(strVehicleType!=undefined?strVehicleType:"");this.iVehicleTypeID=(iVehicleTypeID!=undefined?iVehicleTypeID:0);this.iServiceProviderID=(iServiceProviderID!=undefined?iServiceProviderID:0);this.iRunSubID=(iRunSubID!=undefined?iRunSubID:0);this.strName=(strName!=undefined?strName:"");this.strDescription=(strDescription!=undefined?strDescription:"");this.strLink=(strLink!=undefined?strLink:"");this.iStops=(iStops!=undefined?iStops:0);this.strClass=(strClass!=undefined?strClass:"");this.bShowName=(bShowName!=undefined?bShowName:true);this.bShowDescription=(bShowDescription!=undefined?bShowDescription:false);this.bLowDeck=(bLowDeck!=undefined?bLowDeck:false);}
function RouteBkvData(iStops,strName,strVType,bIsAppendType,strClass,strLink,strLinkType,strLinkRunName,strLinkParam)
{this.iStops=(iStops!=undefined?iStops:0);this.strName=(strName!=undefined?strName:"");this.strVType=(strVType!=undefined?strVType:"");this.bIsAppendType=(bIsAppendType!=undefined?bIsAppendType:true);this.strClass=(strClass!=undefined?strClass:"");this.strLink=(strLink!=undefined?strLink:"");this.strLinkType=(strLinkType!=undefined?strLinkType:"");this.strLinkRunName=(strLinkRunName!=undefined?strLinkRunName:"");this.strLinkParam=(strLinkParam!=undefined?strLinkParam:"");}
function RouteSub(dLwrX,dLwrY,dUprX,dUprY,iLength,iTravelSeconds,dtStart,dtStop,eType,eTurnInfo,strCity,strDistrict,strStreet,strRoad,strInternational,strStopFrom,strStopTo,iWaitingMinutes,strVehicleType,arrPTRuns,ePedEnum,arrPolylines)
{this.dLwrX=(dLwrX!=undefined?dLwrX:0.0);this.dLwrY=(dLwrY!=undefined?dLwrY:0.0);this.dUprX=(dUprX!=undefined?dUprX:0.0);this.dUprY=(dUprY!=undefined?dUprY:0.0);this.iLength=(iLength!=undefined?iLength:0);this.iTravelSeconds=(iTravelSeconds!=undefined?iTravelSeconds:0);this.dtStart=(dtStart!=undefined?dtStart:"");this.dtStop=(dtStop!=undefined?dtStop:"");this.eType=(eType!=undefined?eType:0);this.eTurnInfo=(eTurnInfo!=undefined?eTurnInfo:0);this.strCity=(strCity!=undefined?strCity:"");this.strDistrict=(strDistrict!=undefined?strDistrict:"");this.strStreet=(strStreet!=undefined?strStreet:"");this.strRoad=(strRoad!=undefined?strRoad:"");this.strInternational=(strInternational!=undefined?strInternational:"");this.strStopFrom=(strStopFrom!=undefined?strStopFrom:"");this.strStopTo=(strStopTo!=undefined?strStopTo:"");this.iWaitingMinutes=(iWaitingMinutes!=undefined?iWaitingMinutes:0);this.strVehicleType=(strVehicleType!=undefined?strVehicleType:false);this.arrPTRuns=(arrPTRuns!=undefined?arrPTRuns:new Array());this.ePedEnum=(ePedEnum!=undefined?ePedEnum:0);this.arrPolylines=(arrPolylines!=undefined?arrPolylines:[]);}
function RouteMain(dLwrX,dLwrY,dUprX,dUprY,iLength,iTravelSeconds,dtStart,dtStop,strNameFrom,strAddressFrom,dFromX,dFromY,strNameTo,strAddressTo,dToX,dToY,arrSubs)
{this.dLwrX=(dLwrX!=undefined?dLwrX:0.0);this.dLwrY=(dLwrY!=undefined?dLwrY:0.0);this.dUprX=(dUprX!=undefined?dUprX:0.0);this.dUprY=(dUprY!=undefined?dUprY:0.0);this.iLength=(iLength!=undefined?iLength:0);this.iTravelSeconds=(iTravelSeconds!=undefined?iTravelSeconds:0);this.dtStart=(dtStart!=undefined?dtStart:"");this.dtStop=(dtStop!=undefined?dtStop:"");this.strNameFrom=(strNameFrom!=undefined?strNameFrom:"");this.strAddressFrom=(strAddressFrom!=undefined?strAddressFrom:"");this.dFromX=(dFromX!=undefined?dFromX:0.0);this.dFromY=(dFromY!=undefined?dFromY:0.0);this.strNameTo=(strNameTo!=undefined?strNameTo:"");this.strAddressTo=(strAddressTo!=undefined?strAddressTo:"");this.dToX=(dToX!=undefined?dToX:0.0);this.dToY=(dToY!=undefined?dToY:0.0);this.arrSubs=(arrSubs!=undefined?arrSubs:new Array());}
function Route(dLwrX,dLwrY,dUprX,dUprY,iLength,iTravelSeconds,dtStart,dtStop,strTrafficType,iAlternative,arrMains)
{this.dLwrX=(dLwrX!=undefined?dLwrX:0.0);this.dLwrY=(dLwrY!=undefined?dLwrY:0.0);this.dUprX=(dUprX!=undefined?dUprX:0.0);this.dUprY=(dUprY!=undefined?dUprY:0.0);this.iLength=(iLength!=undefined?iLength:0);this.iTravelSeconds=(iTravelSeconds!=undefined?iTravelSeconds:0);this.dtStart=(dtStart!=undefined?dtStart:"");this.dtStop=(dtStop!=undefined?dtStop:"");this.strTrafficType=(strTrafficType!=undefined?strTrafficType:"");this.iAlternative=(iAlternative!=undefined?iAlternative:0);this.iRunChanges=null;this.iDiffHour=0;this.arrMains=(arrMains!=undefined?arrMains:new Array());}
function PTStop(strName,iDistance,iTravelTime,dX,dY)
{this.strName=(strName!=undefined?strName:"");this.iDistance=(iDistance!=undefined?iDistance:0);this.iTravelTime=(iTravelTime!=undefined?iTravelTime:0);this.dX=(dX!=undefined?dX:0);this.dY=(dY!=undefined?dY:0);}
PedEnum=new function()
{this.P_ISSIDEWALK=0x00000001;this.P_HIGHCATEGORY=0x00000002;this.P_MOVINGSTAIRS=0x00000004;this.P_ELEVATOR=0x00000008;this.P_WALKWAY=0x00000010;this.P_PROMENADE=0x00000020;this.P_PATH=0x00000040;this.P_PASSAGE=0x00000080;this.P_PAVEDGOOD=0x00000100;this.P_PAVEDPOOR=0x00000200;this.P_UNPAVEDSHINGLY=0x00000400;this.P_UNPAVEDCARTROAD=0x00000800;this.P_COBBLESTONE=0x00001000;this.P_GRADSTAIRSNEG=0x00002000;this.P_GRADHIGHNEG=0x00004000;this.P_GRADLOWNEG=0x00008000;this.P_GRADLOWPOS=0x00010000;this.P_GRADHIGHPOS=0x00020000;this.P_GRADSTAIRSPOS=0x00040000;this.P_TOLL=0x00080000;this.P_TACTILE=0x00100000;this.P_OBSTACLE=0x00200000;this.P_CROSSING=0x00400000;this.P_PEDCROSSING=0x00800000;this.P_TRAFFICLIGHT=0x01000000;this.P_NOTICESIGNAL=0x02000000;this.P_TLBUTTON=0x04000000;this.P_TCURBSIDE=0x08000000;this.P_LCURBSIDE=0x10000000;this.P_COMPOUND=0x20000000;this.P_SUBWAY=0x40000000;this.P_NONE=0;this.P_ALL=(this.P_ISSIDEWALK|this.P_HIGHCATEGORY|this.P_SHOPPING|this.P_TURIST|this.P_WALKWAY|this.P_PROMENADE|this.P_PATH|this.P_PASSAGE|this.P_PAVEDGOOD|this.P_PAVEDPOOR|this.P_UNPAVEDSHINGLY|this.P_UNPAVEDCARTROAD|this.P_COBBLESTONE|this.P_GRADSTAIRSNEG|this.P_GRADHIGHNEG|this.P_GRADLOWNEG|this.P_GRADLOWPOS|this.P_GRADHIGHPOS|this.P_GRADSTAIRSPOS|this.P_TOLL|this.P_TACTILE|this.P_OBSTACLE|this.P_CROSSING|this.P_PEDCROSSING|this.P_TRAFFICLIGHT|this.P_NOTICESIGNAL|this.P_TLBUTTON|this.P_TCURBSIDE|this.P_LCURBSIDE|this.P_COMPOUND);}

function CUtvonaltervMapPalette(pTopoliszMap,bMiniMapMode,bHasZoomIn,bHasZoomOut,bHasSlider,bHasModeSelector,bHasZoomRect,bHasDistance,bHasUndo,bHasFullScreen,bHasPrint)
{this.div=null;this.pSlider=null;this.pTopoliszMap=pTopoliszMap;this.pTopoliszMap.pMapPalette=this;this.bMiniMapMode=bMiniMapMode;this.iSliderThumbWidth=16;this.imgDistanceMeasure=null;this.imgMiniMap=null;this.aFullScreen=null;this.aRestoreSreen=null;this.ZoomRectImgButton=null;this.MoveModeImgButton=null;this.bHasZoomIn=bHasZoomIn==undefined?true:bHasZoomIn;this.bHasZoomOut=bHasZoomOut==undefined?true:bHasZoomOut;this.bHasSlider=bHasSlider==undefined?true:bHasSlider;this.bHasModeSelector=bHasModeSelector==undefined?true:bHasModeSelector;this.bHasZoomRect=bHasZoomRect==undefined?true:bHasZoomRect;this.bHasDistance=bHasDistance==undefined?true:bHasDistance;this.bHasUndo=bHasUndo==undefined?true:bHasUndo;this.bHasFullScreen=bHasFullScreen==undefined?true:bHasFullScreen;this.bHasPrint=bHasPrint==undefined?true:bHasPrint;var me=this;this.CreateButton=function(onclick,strToolTip)
{var a=NewTag("a",me.div);a.className='UI_map_button';a.setAttribute('href','javascript:void(0)');var onmouseover=function(pEvent)
{me.pTopoliszMap.ShowToolTip(pEvent,strToolTip);}
AddEvent(a,'click',onclick);AddEvent(a,'mouseover',onmouseover);AddEvent(a,'mouseout',me.pTopoliszMap.HideToolTip);var img=NewTag("img",a);img.className="UI_map_button";return img;}
this.Init=function()
{me.div=NewTag("div",me.pTopoliszMap.GetMapDiv(),me.pTopoliszMap.GetMapDiv().firstChild);me.div.className="mapPalette";DisableSelection(me.div);var divBackground=NewTag("div",me.pTopoliszMap.GetMapDiv());divBackground.className="mapPaletteBg";var divBackgroundUpper=NewTag("div",divBackground);divBackgroundUpper.className="mapPaletteBgUpper";var divBackgroundMain=NewTag("div",divBackground);divBackgroundMain.className="mapPaletteBgMain";var divBackgroundLower=NewTag("div",divBackground);divBackgroundLower.className="mapPaletteBgBottom";var a,div,img;if(me.bHasZoomIn){img=me.CreateButton(me.pTopoliszMap.ZoomIn,g_Babel.GetWord('ZoomIn',"Közelít"));new ImgButton(img,17,17,"design/ICON_zoom_in_on.gif","design/ICON_zoom_in_on.gif","design/ICON_zoom_in_on.gif","design/ICON_zoom_in_on.gif","",true);NewTag("br",me.div);}
if(!me.bMiniMapMode&&me.bHasSlider)
{me.pSlider=new SliderControl(me.div);me.pSlider.iYTickNumber=me.pTopoliszMap.GetLevelNumber();var TickText="";var i=0;var unit="?";for(i=me.pTopoliszMap.GetMaximumLevel();i>=me.pTopoliszMap.GetMinimumLevel();i--)
{var pd=me.pTopoliszMap.GetPixelDensityFromLevel(i);if(pd>=1000)
{pd=(pd)/1000;unit="km";}
else
{pd=Math.round(pd);unit="m";}
TickText+="1 px = "+pd+" "+unit;TickText+=";";}
this.pSlider.TickTexts=TickText;this.pSlider.setSize(me.iSliderThumbWidth,70);this.pSlider.setTracking(false,true);this.pSlider.setValue(0);this.pSlider.setColors('transparent','transparent');this.pSlider.onThumbMoved=this.pTopoliszMap.ZoomModifiedBySlider;}
if(me.bHasZoomOut){img=me.CreateButton(me.pTopoliszMap.ZoomOut,g_Babel.GetWord('ZoomOut',"Távolít"));new ImgButton(img,17,17,"design/ICON_zoom_out_on.gif","design/ICON_zoom_out_on.gif","design/ICON_zoom_out_on.gif","design/ICON_zoom_out_on.gif","",true);}
if(!me.bMiniMapMode)
{if(me.bHasModeSelector){NewTag('br',me.div);var divSpace=NewTag('div',me.div);divSpace.style.height="20px";divSpace.style.width="10px";img=me.CreateButton(me.SetMoveMode,"Mozgat");me.MoveModeImgButton=new ImgButton(img,17,17,"design/ICON_move.gif","design/ICON_move.gif","design/ICON_move.gif","design/ICON_move_act.gif","",true);}
if(me.bHasZoomRect){NewTag('br',me.div);img=me.CreateButton(me.SetZoomRectMode,"Nagyító");me.ZoomRectImgButton=new ImgButton(img,17,17,"design/ICON_zoomrect.gif","design/ICON_zoomrect.gif","design/ICON_zoomrect.gif","design/ICON_zoomrect_act.gif","",true);NewTag('br',me.div);}}
if(!me.bMiniMapMode)
{if(me.bHasDistance){NewTag("br",me.div);img=me.CreateButton(me.SwitchDistanceMeasure,g_Babel.GetWord('MeasureDistance',"Távolságmérés"));new ImgButton(img,17,17,"design/ICON_measure_on.gif","design/ICON_measure_on.gif","design/ICON_measure_on.gif","design/ICON_measure_on.gif","",true);me.imgDistanceMeasure=img;}
if(me.bHasUndo){NewTag('br',me.div);img=me.CreateButton(me.pTopoliszMap.Undo,"Vissza");SetTransparentPng(img,"design/ICON_undo_on.gif",17,17,"");}
if(me.pTopoliszMap.bHasMiniMap){me.divMinimapButton=NewTag("div",me.pTopoliszMap.GetMapDiv(),me.pTopoliszMap.GetMapDiv().firstChild);me.divMinimapButton.className="mapPaletteMinimap";var a=NewTag('a',me.divMinimapButton);AddEvent(a,'click',me.SwitchMiniMap);me.imgMiniMap=NewTag("img",a);me.imgMiniMap.style.verticalAlign="bottom";if(me.pTopoliszMap.bMiniMapVisible)
SetImage(me.imgMiniMap,"images/mapctrl/hideminimap_utvonalterv.png",14,14,"");else
SetImage(me.imgMiniMap,"images/mapctrl/showminimap_utvonalterv.png",14,14,"");}}
if(me.bHasFullScreen){NewTag('br',me.div);if(me.bMiniMapMode)
img=me.CreateButton(me.ShowOnMainMap,"Nagy térkép");else
img=me.CreateButton(me.MaximizeMap,"Nagy térkép");new ImgButton(img,17,17,"design/ICON_maximize_on.gif","design/ICON_maximize_on.gif","design/ICON_maximize_on.gif","design/ICON_maximize_on.gif","",true);}
if(!me.bMiniMapMode&&me.bHasPrint)
{NewTag('br',me.div);img=me.CreateButton(me.Print,g_Babel.GetWord('Print',"Nyomtatás"));new ImgButton(img,17,17,"design/ICON_print_map_on.gif","design/ICON_print_map_on.gif","design/ICON_print_map_on.gif","design/ICON_print_map_on.gif","",true);}
divBackgroundMain.style.height=(GetLayerHeight(me.div)-10)+"px";me.SetMoveMode();}
this.SetMoveMode=function()
{me.pTopoliszMap.SetMoveMode();}
this.SetZoomRectMode=function()
{me.pTopoliszMap.SetZoomRectMode();}
this.SwitchDistanceMeasure=function()
{me.pTopoliszMap.OnOffMeasureDistance("button");}
this.SwitchMiniMap=function()
{if(me.pTopoliszMap.bMiniMapVisible)
{me.pTopoliszMap.HideMiniMap();SetImage(me.imgMiniMap,"images/mapctrl/showminimap_utvonalterv.png",14,14,"");}
else
{me.pTopoliszMap.ShowMiniMap();SetImage(me.imgMiniMap,"images/mapctrl/hideminimap_utvonalterv.png",14,14,"");}}
this.MaximizeMap=function()
{var div=GetBlock('tdLeftPart');if(GetStyle(div,'display')=='none')
{div.style.display='';}
else
{div.style.display='none';}
Resizer.OnResize();me.pTopoliszMap.Redraw();}
this.ShowOnMainMap=function()
{var mapdata=me.pTopoliszMap.GetMapData();g_TopoliszMap.ZoomToRect(mapdata.dMinX,mapdata.dMinY,mapdata.dMaxX,mapdata.dMaxY);var divPage=GetBlock("idPage");if(divPage)
window.scrollTo(0,GetAbsLayerTop(divPage));else
window.scrollTo(0,0);}
this.Print=function()
{g_TopoliszControls.Print();me.pTopoliszMap.DrawPrintPreview();}
me.Init();}

function TimeControl()
{this.div=null;this.time=new Date();this.bHasTime=false;this.selectMonth=null;this.selectDay=null;this.inputTime=null;this.divTimeList=null;this.strDefaultTime="--:--";var arrMonths=["január","február","március","április","május","június","július","augusztus","szeptember","október","november","december"];var me=this;var DaysInMonth=function(iYear,iMonth)
{return 32-new Date(iYear,iMonth,32).getDate();}
var FormatTime=function(time)
{var str=time.getHours();str+=":";if(time.getMinutes()<10)
str+="0";str+=time.getMinutes();return str;}
this.SetDiv=function(div)
{me.div=div;}
this.SetTime=function(time)
{me.time=time;me.Show();}
this.GetTime=function()
{return me.time;}
this.HasTime=function()
{return me.bHasTime;}
this.SetTimePart=function(strTime)
{var time=null;if(strTime==g_Babel.GetWord('Now'))
{time=new Date();}
else
{var iHours=NaN;var iMinutes=NaN;var iPos=strTime.indexOf(':');if(iPos>0)
{iHours=parseInt(strTime.substr(0,iPos),10);iMinutes=parseInt(strTime.substr(iPos+1),10);}
else
{if(strTime.length<3)
{iHours=parseInt(strTime);iMinutes=0;}
else if(strTime.length==3)
{iHours=parseInt(strTime.substr(0,1),10);iMinutes=parseInt(strTime.substr(1),10);}
else if(strTime.length==4)
{iHours=parseInt(strTime.substr(0,2),10);iMinutes=parseInt(strTime.substr(2),10);}}
if(iHours!=null&&!isNaN(iHours)&&iMinutes!=null&&!isNaN(iMinutes))
{time=new Date(2009,03,28,iHours,iMinutes,0);}}
if(time!=null)
{me.bHasTime=true;me.time.setHours(time.getHours(),time.getMinutes());}
else
me.bHasTime=false;var div=NewTag('div',me.div);me.FillTimeEdit();}
this.Reset=function()
{me.time=new Date();me.bHasTime=false;me.Show();}
this.FillMonthCombo=function()
{while(me.selectMonth.firstChild)
me.selectMonth.removeChild(me.selectMonth.firstChild);var date=new Date(me.time);date.setDate(1);for(var i=0;i<12;i++)
{var option=NewTag('option',me.selectMonth)
option.value=date.getFullYear().toString()+date.getMonth();NewTextTag(" "+date.getFullYear()+" "+arrMonths[date.getMonth()]+" ",option);date.setMonth(date.getMonth()+1);}}
this.FillDayCombo=function()
{while(me.selectDay.firstChild)
me.selectDay.removeChild(me.selectDay.firstChild);var iMaxDay=DaysInMonth(me.time.getFullYear(),me.time.getMonth());for(var iDay=1;iDay<=iMaxDay;iDay++)
{var option=NewTag('option',me.selectDay);option.value=iDay;NewTextTag(" "+iDay+" ",option);}
me.selectDay.selectedIndex=me.time.getDate()-1;}
this.FillTimeEdit=function()
{if(me.bHasTime)
me.inputTime.value=FormatTime(me.time);else
me.inputTime.value=me.strDefaultTime;}
this.SwitchTimeList=function()
{if(me.divTimeList&&me.divTimeList.parentNode)
me.HideTimeList();else
me.ShowTimeList();}
this.HideTimeList=function()
{if(me.divTimeList&&me.divTimeList.parentNode)
me.divTimeList.parentNode.removeChild(me.divTimeList);me.divTimeList=null;}
this.ShowTimeList=function()
{me.HideTimeList();var input=me.inputTime;me.divTimeList=NewTag('div',document.body);me.divTimeList.className="AddressResult";me.divTimeList.style.position="absolute";me.divTimeList.style.top=(GetAbsLayerTop(input)+GetLayerHeight(input))+"px";me.divTimeList.style.left=(GetAbsLayerLeft(input))+"px";me.divTimeList.style.width=(GetLayerWidth(input)-1+20)+"px";me.divTimeList.style.zIndex=2003;var SetOnClick=function(a,str,i)
{a.onclick=function()
{me.inputTime.value=str;me.SetTimePart(str);me.HideTimeList();}}
var iHour=0;var str="";var date=new Date();var iTop;for(i=-1;i<24;i++)
{a=NewTag('a',me.divTimeList);a.setAttribute('href','javascript:void(0)');a.className="AddressResult";a.style.zIndex="5";if(i==-1)
{str=g_Babel.GetWord("Now");}
else
{if(i<10)
str="0"+i+":00";else
str=i+":00";}
SetOnClick(a,str,i);NewTextTag(str,a);}
if(GetLayerHeight(me.divTimeList)>105)
{me.divTimeList.style.height="105px";me.divTimeList.style.overflowY="scroll";}}
this.Show=function()
{if(me.div)
{while(me.div.firstChild)
me.div.removeChild(me.div.firstChild);var div=NewTag('div',me.div);div.className='combobox';me.selectMonth=NewTag('select',div);me.selectMonth.className="monthcombo";me.FillMonthCombo();AddEvent(me.selectMonth,"change",me.OnMonthChanged);me.selectDay=NewTag('select',div);me.selectDay.className="daycombo";me.FillDayCombo();AddEvent(me.selectDay,"change",me.OnDayChanged);me.inputTime=NewTag('input',div);me.inputTime.setAttribute('maxlength',5);me.inputTime.className="timecombo";AddEvent(me.inputTime,"blur",me.OnTimeBlur);AddEvent(me.inputTime,"focus",me.OnTimeFocus);AddEvent(me.inputTime,"keypress",me.OnTimeKeyPress);me.FillTimeEdit();var a=NewTag('a',div);a.setAttribute('href','javascript:void(0)');a.className="timecombo";AddEvent(a,"click",me.SwitchTimeList);var img=NewTag('img',a);SetImage(img,"design/COMBOBOX.gif",15,14,'V');}}
this.OnMonthChanged=function()
{var str=me.selectMonth.options[me.selectMonth.selectedIndex].value;var year=parseInt(str.substr(0,4),10);var month=parseInt(str.substr(4),10);var str=me.selectDay.options[me.selectDay.selectedIndex].value;var day=parseInt(str,10);if(day>DaysInMonth(year,month))
day=DaysInMonth(year,month);me.time.setFullYear(year,month,day);me.FillDayCombo();}
this.OnDayChanged=function()
{var str=me.selectDay.options[me.selectDay.selectedIndex].value;var day=parseInt(str,10);me.time.setDate(day);}
this.OnTimeFocus=function()
{if(me.inputTime.value==me.strDefaultTime)
me.inputTime.value="";me.HideTimeList();}
this.OnTimeBlur=function()
{if(me.inputTime.value=="")
me.inputTime.value=me.strDefaultTime;me.SetTimePart(me.inputTime.value);}
this.OnTimeKeyPress=function(pEvent)
{if(pEvent==null)
pEvent=window.event;if(pEvent.keyCode==13)
{me.SetTimePart(me.inputTime.value);me.HideTimeList();}}}

function CUtvonaltervRouteSearch(div,pTopoliszMap,bCarOnly,bThereCanBeOnlyTwo)
{this.divMain=div;this.divAlert=null;this.bNeedRouteSearch=false;this.divAddressList=null;this.spanAddThroughAddress=null;this.pTopoliszMap=pTopoliszMap;this.pTopoliszMap.pRouteSearch=this;this.pResultHandler=null;this.arrAddressBlocks=new Array();this.strTrafficType=((g_InitSettings.bShowTrafficChoice&&(getCookie('TrafficType')!=null))?getCookie('TrafficType'):"car");this.txtBtnCar=null;this.txtBtnTaxi=null;this.txtBtnBkv=null;this.txtBtnBicycle=null;this.txtBtnFoot=null;this.strTrafficTime="";this.timectrl=new TimeControl();this.iCarOptim=getIntCookie('CarOptim',0);this.bUseTolledRoute=getBoolCookie('PayCheck',true);this.bUseFerry=getBoolCookie('FerryCheck',false);this.bUseDirtyRoad=getBoolCookie('DirtyCheck',true);this.bUseOnlineTrafficInfo=getBoolCookie('UseOnlineTrafficInfo',true);this.bLowDeckOnly=getBoolCookie('LowDeckOnly',true);this.dConsumption=parseFloat(getCookie('Consumption'));this.dFuelPrice=parseFloat(getCookie('FuelPrice'));this.dTaxiFeeBasic=getFloatCookie('TaxiFeeBasic',300);this.dTaxiFeeKm=getFloatCookie('TaxiFeeKm',240);this.iBkvOptim=0;this.bUsePTLocal=getBoolCookie('UsePTLocal',true);this.bUsePTTrain=getBoolCookie('UsePTTrain',true);this.strGetOnType=((g_InitSettings.iMultiModalVersion==1)?getStringCookie('GetOnType',"pedestrian"):((g_InitSettings.iMultiModalVersion==2)?"pedestrian":""));this.pDragAndDrop=new CDragAndDrop();this.divRegistered=null;this.pRouteParams=new CUtvonaltervRouteParams(this,g_strAppID.toLowerCase()=="trafficnav"?false:true);this.pLanguageSupporter=new LanguageSupporter();this.MAXADDRESSBLOCKS=12;this.bSaveAddresses=false;this.bCarOnly=bCarOnly;this.bThereCanBeOnlyTwo=bThereCanBeOnlyTwo;this.divTimeCtrl=null;var me=this;this.OnShow=null;this.Init=function()
{me.AddThroughAddress();me.AddThroughAddress();me.arrAddressBlocks[0].LoadAddress();if(g_bAdmin)
{var iLength=parseInt(getCookie('iAddressCount'));for(var i=2;i<iLength;i++)
{me.AddThroughAddress();}
for(var i=1;i<iLength;i++)
{me.arrAddressBlocks[i].LoadAddress();}
if(g_bAdmin&&getCookie('TrafficTime')!=null)
{me.SetTrafficTime(getCookie('TrafficTime'));me.timectrl.SetTime(new Date(Date.parse(me.strTrafficTime)));if(me.strTrafficType!="")
me.timectrl.bHasTime=true;}}
me.bSaveAddresses=true;}
this.GetDiv=function()
{return me.divMain;}
this.SetMap=function(pTopoliszMap)
{me.pTopoliszMap=pTopoliszMap;me.pTopoliszMap.pRouteSearch=me;me.pTopoliszMap.pTextResult=me;}
this.SetResultHandler=function(resultHandler)
{me.pResultHandler=resultHandler;resultHandler.pRouteSearch=me;}
this.GetAddressDiv=function(iAddress)
{var divAddress=null;var div=me.divAddressList.firstChild;var i=-1;for(div=me.divAddressList.firstChild;div!=null;div=div.nextSibling)
{if(div.className="TextResultDragAddress")
{i++;if(i>=iAddress)
{divAddress=div;break;}}}
return divAddress;}
this.GetTabImageUrl=function(strBabelID,strPostfix)
{var strUrl="./design/"+g_Babel.GetWord(strBabelID);if(strPostfix!=null&&strPostfix.length>0)
{var iPos=strUrl.lastIndexOf(".");strUrl.substr(0,iPos)
if(iPos>=0)
strUrl=strUrl.substr(0,iPos)+"_"+strPostfix+strUrl.substr(iPos);}
return strUrl;}
this.ShowTrafficButtons=function()
{if(!me.bCarOnly){NewTextTag(g_Babel.GetWord('capSelectTransportType'),me.divMain);}
var panel=new Panel(me.divMain);var trImg=panel.tr;var CreateTd=function(tr)
{var td=NewTag('td',tr);td.className='center';td.style.width='25%';td.style.whiteSpace='normal';return td;}
var iIconWidth=52;var iIconHeight=75;if(!me.bCarOnly){var a=NewTag('a',CreateTd(trImg));me.txtBtnCar=new ImgLink(a,iIconWidth,iIconHeight,me.GetTabImageUrl("TrafficByCarImg",null),me.GetTabImageUrl("TrafficByCarImg","over"),me.GetTabImageUrl("TrafficByCarImg","on"),me.GetTabImageUrl("TrafficByCarImg","on"),g_Babel.GetWord("TrafficByCarShort"),true);AddEvent(a,'click',me.SetByCar);var a=NewTag('a',CreateTd(trImg));me.txtBtnTaxi=new ImgLink(a,iIconWidth,iIconHeight,me.GetTabImageUrl("TrafficByTaxiImg",null),me.GetTabImageUrl("TrafficByTaxiImg","over"),me.GetTabImageUrl("TrafficByCarImg","on"),me.GetTabImageUrl("TrafficByTaxiImg","on"),"Taxi",true);AddEvent(a,'click',me.SetByTaxi);var a=NewTag('a',CreateTd(trImg));me.txtBtnBkv=new ImgLink(a,iIconWidth,iIconHeight,me.GetTabImageUrl("TrafficByBkvImg",null),me.GetTabImageUrl("TrafficByBkvImg","over"),me.GetTabImageUrl("TrafficByBkvImg","on"),me.GetTabImageUrl("TrafficByBkvImg","on"),g_Babel.GetWord("TrafficByBkvShort"),true);AddEvent(a,'click',me.SetByBkv);var a=NewTag('a',CreateTd(trImg));me.txtBtnBicycle=new ImgLink(a,iIconWidth,iIconHeight,me.GetTabImageUrl("TrafficByBikeImg",null),me.GetTabImageUrl("TrafficByBikeImg","over"),me.GetTabImageUrl("TrafficByBikeImg","on"),me.GetTabImageUrl("TrafficByBikeImg","on"),g_Babel.GetWord("TrafficByBikeShort"),true);AddEvent(a,'click',me.SetByBike);var a=NewTag('a',CreateTd(trImg));me.txtBtnFoot=new ImgLink(a,iIconWidth,iIconHeight,me.GetTabImageUrl("TrafficOnFootImg",null),me.GetTabImageUrl("TrafficOnFootImg","over"),me.GetTabImageUrl("TrafficOnFootImg","on"),me.GetTabImageUrl("TrafficOnFootImg","on"),g_Babel.GetWord("TrafficOnFootShort"),true);AddEvent(a,'click',me.SetOnFoot);}
else{me.strTrafficType="car";}
me.SetTrafficType(me.strTrafficType);}
this.ShowTrafficParams=function()
{var divRouteParams=NewTag('div',me.divMain);divRouteParams.className="noprint";me.pRouteParams.SetDiv(divRouteParams);me.pRouteParams.Show();}
this.CreateTimeCtrl=function()
{me.divTimeCtrl=NewTag("div",me.divMain);var panel=new Panel(me.divTimeCtrl);var str=panel.CreateCaption(g_Babel.GetWord('capTimeToTravel'),"design/ICON_settings_off.gif",14,14);me.pLanguageSupporter.Add(str.parentNode,"innerHTML",'capTimeToTravel',"","");var div=NewTag('div',me.divTimeCtrl);me.timectrl.SetDiv(div);me.timectrl.Show();me.divTimeCtrl.style.display="none";}
this.GetTimeControlMustBeVisible=function()
{var bValue=false;if(me.strTrafficType=="public")
bValue=true;return bValue;}
this.RefreshTimeCtrl=function()
{if(me.GetTimeControlMustBeVisible())
me.divTimeCtrl.style.display="";else
me.divTimeCtrl.style.display="none";}
this.Show=function()
{if(me.divMain)
{while(me.divMain.hasChildNodes()){me.divMain.removeChild(me.divMain.firstChild);}
if(g_InitSettings.bShowTrafficChoice)
{me.ShowTrafficButtons();me.ShowTrafficParams();NewTag('hr',me.divMain);}
me.divAddressList=NewTag('div',me.divMain);me.divAddressList.className="AddressList";var i;var iLength=GetArrayLength(me.arrAddressBlocks);var iStartOrder=1;for(var i=0;i<iLength;i++)
{var div=NewTag("div",me.divAddressList);me.arrAddressBlocks[i].SetDiv(div);me.arrAddressBlocks[i].Show(i,iLength);}
me.CreateTimeCtrl();me.RefreshTimeCtrl();var panel=new Panel(me.divMain);var td=NewTag('td',panel.tr);var td=NewTag('td',panel.tr);td.className='right';NewTag("br",td);var a=NewTag('a',td);a.className='UI_button_TEXT';a.style.height="28px";a.setAttribute('href','javascript:void(0)');NewTextTag(g_Babel.GetWord('btnFindRoute',"OK"),a);a.setAttribute("id","btnFindRoute");AddEvent(a,"click",function(){me.FindRoute(true);});me.divAlert=NewTag('div',me.divMain);var maxitable=NewTag("table",me.divMain);var maxitbody=NewTag("tbody",maxitable);var maxitr=NewTag("tr",maxitbody);var maxitd1=NewTag("td",maxitr);var maxitd2=NewTag("td",maxitr);var maxitd3=NewTag("td",maxitr);if(g_strAppID.toLowerCase()!="trafficnav"){var panel=new Panel(maxitd1);var td=NewTag('td',panel.tr);var txtBtn=new TextButton(td);im=txtBtn.CreateImage(14,14,"design/icon_add_off.gif","design/icon_add_on.gif",null,null,false);a=txtBtn.CreateText(g_Babel.GetWord('capInsertVisitNode'));me.pLanguageSupporter.Add(a,"innerHTML","capInsertVisitNode","","");txtBtn.OnClick=me.AddThroughEmptyAddress;me.spanAddThroughAddress=panel.table;me.divRegistered=NewTag('div',me.divMain);var panel=new Panel(maxitd2);var td=NewTag('td',panel.tr);var txtBtn=new TextButton(td);im=txtBtn.CreateImage(14,14,"design/icon_delete_off.gif","design/icon_delete_on.gif",null,null,false);me.pLanguageSupporter.Add(im,"alt","hintRouteClear","","");a=txtBtn.CreateText(g_Babel.GetWord('hintRouteClear'));me.pLanguageSupporter.Add(a,"innerHTML","hintRouteClear","","");txtBtn.OnClick=me.Reset;var panel=new Panel(maxitd3);var td=NewTag('td',panel.tr);var txtBtn=new TextButton(td);var im=txtBtn.CreateImage(20,14,"design/icon_reverse_off.gif","design/icon_reverse_on.gif",null,null,false);var a=txtBtn.CreateText(g_Babel.GetWord('capChangeDirection'));me.pLanguageSupporter.Add(a,"innerHTML","capChangeDirection","","");txtBtn.OnClick=me.OnReverseAddressOrder;}
if(me.OnShow){try{me.OnShow();}
catch(exp){if(me.pTopoliszMap.OnError)
me.pTopoliszMap.OnError(exp,'CUtvonaltervRouteSearch.OnShow');}}}}
this.Reset=function()
{var iLength=GetArrayLength(me.arrAddressBlocks);for(var iOld=1;iOld<iLength-1;iOld++)
{var div=me.arrAddressBlocks[iOld].GetDiv();if(div)
div.parentNode.removeChild(div);me.arrAddressBlocks[iOld]=null;delete me.arrAddressBlocks[iOld];}
me.arrAddressBlocks[1]=me.arrAddressBlocks[iLength-1];if(iLength>2){me.arrAddressBlocks[iLength-1]=null;}
me.arrAddressBlocks[0].Delete();me.arrAddressBlocks[1].Delete();me.DeleteRoute(true);me.Show();}
this.OnAddressListChanged=function()
{}
this.SaveAddresses=function()
{if(me.bSaveAddresses)
{me.arrAddressBlocks[0].SaveAddress();if(g_bAdmin)
{var iLength=GetArrayLength(me.arrAddressBlocks);setCookie('iAddressCount',iLength);for(var i=1;i<iLength;i++)
{me.arrAddressBlocks[i].SaveAddress();}}}}
this.OnAddressListChangedInternal=function(bDeleteRoute)
{var iLength=GetArrayLength(me.arrAddressBlocks);me.SaveAddresses();me.pTopoliszMap.pMarkers.DeleteAllWithType("start");me.pTopoliszMap.pMarkers.DeleteAllWithType("stop");me.pTopoliszMap.pMarkers.DeleteAllWithType("marker");me.pTopoliszMap.pMarkers.DeleteAllWithType("pick");for(var i=0;i<iLength;i++)
{var strClass="marker";if(iLength>1)
{if(i==0)
strClass="start";if(i==iLength-1)
strClass="stop";}
var address=me.arrAddressBlocks[i].GetAddress();if(address)
me.pTopoliszMap.AddMarker(address,strClass,0,0);}
if(bDeleteRoute)
me.DeleteRoute(true);if(me.OnAddressListChanged)
me.OnAddressListChanged();}
this.SetStartAddress=function(address)
{if(GetArrayLength(me.arrAddressBlocks)>0)
{me.arrAddressBlocks[0].SetAddress(address);me.OnAddressListChangedInternal(true);}
g_TopoliszControls.ShowRouteSearch();}
this.SetStopAddress=function(address)
{var iLength=GetArrayLength(me.arrAddressBlocks);if(iLength>1)
{me.arrAddressBlocks[iLength-1].SetAddress(address);me.OnAddressListChangedInternal(true);}
g_TopoliszControls.ShowRouteSearch();}
this.OnAddressFound=function(pAddressBlock,pAddress)
{me.OnAddressListChangedInternal(false);}
this.OnSearchEnded=function(bFound)
{if(!me.HasBusyAddressSearch())
me.ClearAlertDiv();if(me.bNeedRouteSearch)
{if(!me.HasBusyAddressSearch())
{me.FindRoute(true);}}}
this.OnAddAddressBefore=function(pAddressBlock)
{me.AddAddressBlock(pAddressBlock.iOrder);}
this.AddThroughEmptyAddress=function()
{me.AddThroughAddress(null);}
this.AddThroughAddress=function(pAddress)
{if(GetArrayLength(me.arrAddressBlocks)<me.MAXADDRESSBLOCKS)
{var iLength=GetArrayLength(me.arrAddressBlocks);var iAddress=0;if(iLength>0)
iAddress=iLength-1;me.AddAddressBlock(iAddress);if(pAddress!=null)
{me.arrAddressBlocks[iAddress].SetAddress(pAddress);me.OnAddressListChangedInternal(true);g_TopoliszControls.ShowRouteSearch();}}}
this.AddAddressBlock=function(iNewPos)
{var iLength=GetArrayLength(me.arrAddressBlocks);for(var i=iLength;i>iNewPos;i--)
{me.arrAddressBlocks[i]=me.arrAddressBlocks[i-1];me.arrAddressBlocks[i].iOrder=i;}
me.arrAddressBlocks[iNewPos]=new CUtvonaltervAddressBlock(me.pTopoliszMap,me,me.bThereCanBeOnlyTwo);me.arrAddressBlocks[iNewPos].OnOK=me.OnAddressOK;me.arrAddressBlocks[iNewPos].OnDelete=me.OnDeleteAddress;me.arrAddressBlocks[iNewPos].OnMoveDown=me.OnMoveDownAddress;me.arrAddressBlocks[iNewPos].OnMoveUp=me.OnMoveUpAddress;me.arrAddressBlocks[iNewPos].OnMoveBack=me.OnMoveBackAddress;me.arrAddressBlocks[iNewPos].OnAddressFound=me.OnAddressFound;me.arrAddressBlocks[iNewPos].OnSearchEnded=me.OnSearchEnded;me.arrAddressBlocks[iNewPos].OnAddAddressBefore=me.OnAddAddressBefore;me.arrAddressBlocks[iNewPos].iOrder=iNewPos;if(me.divMain!=null)
{var divBefore=null;if(iLength>1)
{divBefore=me.arrAddressBlocks[iNewPos+1].GetDiv();}
var div=NewTag('div',me.divAddressList,divBefore);me.arrAddressBlocks[iNewPos].SetDiv(div);me.arrAddressBlocks[iNewPos].Show();}
me.EnableNewThroughAddress();}
this.EnableNewThroughAddress=function()
{if(me.spanAddThroughAddress)
{if(GetArrayLength(me.arrAddressBlocks)>=me.MAXADDRESSBLOCKS)
Hide(me.spanAddThroughAddress);else
Show(me.spanAddThroughAddress);}
var iLength=GetArrayLength(me.arrAddressBlocks);for(var i=0;i<iLength;i++)
{me.arrAddressBlocks[i].ShowHeader();}}
this.OnDeleteAddress=function(pAddressBlock)
{var iLength=GetArrayLength(me.arrAddressBlocks);var iNew=0;var bWasDelete=false;for(var iOld=0;iOld<iLength;iOld++)
{if(me.arrAddressBlocks[iOld]==pAddressBlock&&(iLength>2))
{var div=pAddressBlock.GetDiv();if(div)
div.parentNode.removeChild(div);me.arrAddressBlocks[iOld]=null;delete pAddressBlock;bWasDelete=true;continue;}
if(iOld!=iNew)
{me.arrAddressBlocks[iNew]=me.arrAddressBlocks[iOld];me.arrAddressBlocks[iOld]=null;}
me.arrAddressBlocks[iNew].iOrder=iNew;iNew++;}
if(bWasDelete)
{iLength=GetArrayLength(me.arrAddressBlocks);for(var i=0;i<iLength;i++)
{me.arrAddressBlocks[i].ShowHeader();}
me.EnableNewThroughAddress();}
if(GetArrayLength(me.GetAddressList())<2)
me.DeleteRoute(false);me.OnAddressListChangedInternal(true);}
this.ChangeAddressOrder=function(pAddressBlock,eMode)
{var iLength=GetArrayLength(me.arrAddressBlocks);var iAddress;var iSwap1=-1;var iSwap2=-1;for(iAddress=0;iAddress<iLength;iAddress++)
{if((me.arrAddressBlocks[iAddress]==pAddressBlock)||((eMode=="back")&&(iAddress<iLength/2)))
{iSwap1=iAddress;if(eMode=="down")
{if(iSwap1<iLength-1)
iSwap2=iSwap1+1;else
iSwap2=0;}
else if(eMode=="up")
{if(iSwap1<0)
iSwap2=iLength-1;else
iSwap2=iSwap1-1;}
else if(eMode=="back")
{iSwap1=iAddress;iSwap2=iLength-1-iAddress;}
var temp=me.arrAddressBlocks[iSwap1];me.arrAddressBlocks[iSwap1]=me.arrAddressBlocks[iSwap2];me.arrAddressBlocks[iSwap2]=temp;me.arrAddressBlocks[iSwap1].iOrder=iSwap1;me.arrAddressBlocks[iSwap2].iOrder=iSwap2;me.arrAddressBlocks[iSwap1].GetDiv().style.visibility="hidden";me.arrAddressBlocks[iSwap2].GetDiv().style.visibility="hidden";SwapNode(me.arrAddressBlocks[iSwap1].GetDiv(),me.arrAddressBlocks[iSwap2].GetDiv());me.arrAddressBlocks[iSwap1].ShowHeader();me.arrAddressBlocks[iSwap2].ShowHeader();me.arrAddressBlocks[iSwap1].GetDiv().style.visibility="visible";me.arrAddressBlocks[iSwap2].GetDiv().style.visibility="visible";if(me.arrAddressBlocks[iSwap1].GetAddress()!=null&&me.arrAddressBlocks[iSwap2].GetAddress()!=null)
me.OnAddressListChangedInternal(true);else
me.SaveAddresses();break;}}}
this.OnMoveDownAddress=function(pAddressBlock)
{me.ChangeAddressOrder(pAddressBlock,"down");}
this.OnMoveUpAddress=function(pAddressBlock)
{me.ChangeAddressOrder(pAddressBlock,"up");}
this.OnMoveBackAddress=function(pAddressBlock)
{me.ChangeAddressOrder(pAddressBlock,"back");}
this.OnReverseAddressOrder=function()
{me.arrAddressBlocks.reverse();var iLength=GetArrayLength(me.arrAddressBlocks);for(var i=0;i<iLength;i++)
{me.divAddressList.removeChild(me.arrAddressBlocks[i].GetDiv());me.divAddressList.appendChild(me.arrAddressBlocks[i].GetDiv());}
for(var i=0;i<iLength;i++)
{me.arrAddressBlocks[i].iOrder=i;me.arrAddressBlocks[i].ShowHeader();}
if(me.arrAddressBlocks[0].GetAddress()!=null&&me.arrAddressBlocks[me.arrAddressBlocks.length-1].GetAddress()!=null)
me.OnAddressListChangedInternal(true);else
me.SaveAddresses();}
this.OnDragAndDropFinished=function()
{me.arrAddressBlocks=me.pDragAndDrop.GetArray();me.OnAddressListChangedInternal(true);}
this.pDragAndDrop.OnArrayChanged=me.OnDragAndDropFinished;this.GetTrafficTime=function()
{if(me.strTrafficTime=="")
me.SetTrafficTime("");return me.strTrafficTime;}
this.SetTrafficTime=function(strTime)
{var myDate=Date.parse(strTime);if(isNaN(myDate)||myDate==null)
myDate=new Date();else
myDate=new Date(myDate);var str=myDate.getFullYear()+"/";if(myDate.getMonth()<9)
str+="0";str+=myDate.getMonth()+1+"/";if(myDate.getDate()<10)
str+="0";str+=myDate.getDate()+" ";if(myDate.getHours()<10)
str+="0";str+=myDate.getHours()+":";if(myDate.getMinutes()<10)
str+="0";str+=myDate.getMinutes();me.strTrafficTime=str;if(g_bAdmin)
setCookie("TrafficTime",str);if(me.timectrl)
{me.timectrl.SetTime(myDate);if(me.strTrafficTime!="")
me.timectrl.bHasTime=true;}
return str;}
this.SetTrafficTimeValue=function(dtTime)
{var str=dtTime.getFullYear()+"/";if(dtTime.getMonth()<9)
str+="0";str+=dtTime.getMonth()+1+"/";if(dtTime.getDate()<10)
str+="0";str+=dtTime.getDate()+" ";if(dtTime.getHours()<10)
str+="0";str+=dtTime.getHours()+":";if(dtTime.getMinutes()<10)
str+="0";str+=dtTime.getMinutes();me.strTrafficTime=str;if(g_bAdmin)
setCookie("TrafficTime",str);if(me.timectrl)
{me.timectrl.SetTime(dtTime);if(me.strTrafficTime!="")
me.timectrl.bHasTime=true;}
return str;}
this.GetAddressList=function()
{var iLength=GetArrayLength(me.arrAddressBlocks);var arrAddressList=new Array();for(i=0;i<iLength;i++)
{var pAddress=me.arrAddressBlocks[i].GetAddress();if(pAddress!=null)
arrAddressList[arrAddressList.length]=pAddress;}
return arrAddressList;}
this.SetAddressList=function(arrAddressList)
{var iLength=GetArrayLength(me.arrAddressBlocks);for(var iOld=1;iOld<iLength-1;iOld++)
{var div=me.arrAddressBlocks[iOld].GetDiv();if(div)
div.parentNode.removeChild(div);me.arrAddressBlocks[iOld]=null;delete me.arrAddressBlocks[iOld];}
me.arrAddressBlocks[1]=me.arrAddressBlocks[iLength-1];if(iLength>2){me.arrAddressBlocks[iLength-1]=null;}
var counter=0;if(arrAddressList!=null)
{for(var i=0;i<arrAddressList.length;i++)
{if(i>0&&i<arrAddressList.length-1){me.AddThroughAddress();}
counter++;if(arrAddressList[i]!=null&&arrAddressList[i].strAddress!=null&&arrAddressList[i].strAddress!='')
{me.arrAddressBlocks[i].SetAddress(arrAddressList[i]);}}}
for(var i=counter;i<2;i++){me.AddThroughAddress();}
if(me.divAddressList)
me.Show();me.OnAddressListChangedInternal(true);}
this.GetAddressListUrl=function()
{var arrAddressList=me.GetAddressList();var arrNames="",arrAddresses="",arrX="",arrY="";var iLength=GetArrayLength(arrAddressList);var i;for(i=0;i<iLength;i++)
{if(i>0)
{arrNames+="|";arrAddresses+="|";arrX+="|";arrY+="|";}
if(arrAddressList[i].strName!=null)
{arrNames+=arrAddressList[i].strName;}
arrAddresses+=arrAddressList[i].strAddress;arrX+=arrAddressList[i].dX;arrY+=arrAddressList[i].dY;}
return"arrAddresses="+arrAddresses+"&arrNames="+arrNames+"&arrX="+arrX+"&arrY="+arrY;}
this.DeleteRoute=function(bServerAsWell)
{me.ClearAlertDiv();if(me.pResultHandler)
{me.pResultHandler.DeleteRoute();}
if(bServerAsWell==true)
{me.timectrl.Reset();me.pTopoliszMap.InciServer.CallFunction("DeleteRoute","",0,me.pTopoliszMap.DrawRoute);if(me.OnRouteChanged)
{try{me.OnRouteChanged(null);}
catch(exp){if(me.pTopoliszMap.OnError)
me.pTopoliszMap.OnError(exp,"CUtvonaltervRouteSearch.OnRouteChanged");}}}}
this.SetTrafficType=function(strTrafficType)
{if(!g_InitSettings.bShowTrafficChoice)
strTrafficType="car";me.strTrafficType=strTrafficType;if(me.strTrafficType!=null)
me.strTrafficType=me.strTrafficType.toLowerCase();if(me.txtBtnCar)
me.txtBtnCar.SetActive(me.IsByCar());if(me.txtBtnTaxi)
me.txtBtnTaxi.SetActive(me.IsByTaxi());if(me.txtBtnBkv)
me.txtBtnBkv.SetActive(me.IsByPublicTransport());if(me.txtBtnBicycle)
me.txtBtnBicycle.SetActive(me.IsByBicycle());if(me.txtBtnFoot)
me.txtBtnFoot.SetActive(me.IsOnFoot());if(g_InitSettings.bShowTrafficChoice)
setCookie('TrafficType',strTrafficType);}
this.GetTrafficType=function()
{if(me.IsByPublicTransport())
{if(me.bUsePTLocal&&!me.bUsePTTrain)
return"local";else if(!me.bUsePTLocal&&me.bUsePTTrain)
return"train";return"public";}
return me.strTrafficType;}
this.IsInList=function(strValue,arrList)
{strValue=strValue.toLowerCase();strValue=strValue.replace(" ",",");var arrStrings=strValue.split(",");for(var i=0;i<arrList.length;i++)
{for(var j=0;j<arrStrings.length;j++)
{if(arrList[i].toLowerCase()==arrStrings[j])
return true;}}
return false;}
this.IsCarString=function(strValue)
{var arrList=["VT_CAR","car","auto"];return me.IsInList(strValue,arrList);}
this.IsByCar=function()
{return me.strTrafficType==null||me.strTrafficType.length<1||me.IsCarString(me.strTrafficType);}
this.IsTaxiString=function(strValue)
{var arrList=["VT_TAXI","taxi"];return me.IsInList(strValue,arrList);}
this.IsByTaxi=function()
{return me.strTrafficType==null||me.strTrafficType.length<1||me.IsTaxiString(me.strTrafficType);}
this.IsPublicTransportString=function(strValue)
{var arrList=["PT_ALL","public","pt","PT_LOCALTRANSPORT","bkv","ptlocal","local","PT_GLOBALBUSTRANSPORT","volan","volanbusz","ptglobal","global","PT_GLOBALTRAINTRANSPORT","mav","mav-start","mavstart","pttrain","train"];return me.IsInList(strValue,arrList);}
this.IsByPublicTransport=function()
{if(me.strTrafficType)
return me.IsPublicTransportString(me.strTrafficType);return false;}
this.IsBicycleString=function(strValue)
{var arrList=["VT_BICYCLE","bicycle","bike"];return me.IsInList(strValue,arrList);}
this.IsByBicycle=function()
{if(me.strTrafficType)
return me.IsBicycleString(me.strTrafficType);return false;}
this.IsFootString=function(strValue)
{var arrList=["VT_PEDESTRIAN","foot","pedestrian","gyalog","gyalogos"];return me.IsInList(strValue,arrList);}
this.IsOnFoot=function()
{if(me.strTrafficType)
return me.IsFootString(me.strTrafficType);return false;}
this.IsTaxiString=function(strValue)
{var arrList=["VT_TAXI","taxi"];return me.IsInList(strValue,arrList);}
this.SetByCar=function()
{me.SetTrafficType("car");me.VehicleTypeChanged()}
this.SetByTaxi=function()
{me.SetTrafficType("taxi");me.VehicleTypeChanged()}
this.SetByBkv=function()
{me.SetTrafficType("public");me.VehicleTypeChanged()}
this.SetByBike=function()
{me.SetTrafficType("bicycle");me.VehicleTypeChanged()}
this.SetOnFoot=function()
{me.SetTrafficType("foot");me.VehicleTypeChanged();}
this.VehicleTypeChanged=function()
{me.pRouteParams.Show();me.RefreshTimeCtrl();}
this.GetWrongAddresses=function()
{var iLength=GetArrayLength(me.arrAddressBlocks);var arrWrongAddresses=new Array();var i;for(i=0;i<iLength;i++)
{var pSearch=me.arrAddressBlocks[i].pSearch;if(pSearch.GetInputValue()!=""&&!pSearch.IsUnique())
arrWrongAddresses[arrWrongAddresses.length]=pSearch.GetInputValue();}
return arrWrongAddresses;}
this.HasBusyAddressSearch=function()
{var iLength=GetArrayLength(me.arrAddressBlocks);var i;for(i=0;i<iLength;i++)
{var pSearch=me.arrAddressBlocks[i].pSearch;if(pSearch.bIsBusy)
{return true;}}
return false;}
this.FindAllAddress=function(strEventSource)
{var iLength=GetArrayLength(me.arrAddressBlocks);var i;for(i=0;i<iLength;i++)
{var pSearch=me.arrAddressBlocks[i].pSearch;if(!pSearch.bIsBusy)
{pSearch.Go(strEventSource);}
else
pSearch.bOKPressed=true;}}
this.OnAddressOK=function(pAddressBlock,strEventSource)
{if(!me.bNeedRouteSearch)
{var address=pAddressBlock.GetAddress();if(address!=null)
{if(address.dMinX>0&&address.dMinY>0&&address.dMaxX>0&&address.dMaxY>0&&address.dMinX!=address.dMaxX&&address.dMinY!=address.dMaxY)
me.pTopoliszMap.ZoomToRect(address.dMinX,address.dMinY,address.dMaxX,address.dMaxY);else if(address.dX>0&&address.dY>0)
me.pTopoliszMap.ZoomToPoint(address.dX,address.dY,250);}
if(!me.HasBusyAddressSearch())
me.ClearAlertDiv();}}
this.DisableTrafficButtonToPressItFrequently=function(){if(g_iJSTrafficButtonTimeDelay>0){}}
this.bCanFindRoute=true;this.tmrFindRoute=0;this.setRouteSearchingEnabled=function(enabled){if(g_iJSTrafficButtonTimeDelay<=0){return;}
me.bCanFindRoute=enabled;if(!enabled){var btn=document.getElementById("btnFindRoute");btn.style.backgroundImage="url(design/BUTTON_bg_disabled.png)";btn.style.cursor="wait";me.tmrFindRoute=window.setTimeout(function(){me.setRouteSearchingEnabled(true);},g_iJSTrafficButtonTimeDelay*1000);}else{var btn=document.getElementById("btnFindRoute");btn.style.backgroundImage="url(design/BUTTON_bg.gif)";btn.style.cursor="pointer";window.clearTimeout(me.tmrFindRoute);}}
this.FindRoute=function(bZoomMap){if(!me.bCanFindRoute){return;}
me.bNeedRouteSearch=true;if(me.HasBusyAddressSearch()){var div=NewTag('div',me.GetAlertDiv());div.className='UI_routingprogress';var tt=NewTextTag(g_Babel.GetWord("capAddressSearchInProgress"),div);return;}
me.bNeedRouteSearch=false;me.DeleteRoute(false);if(me.IsByPublicTransport()&&!me.bUsePTLocal&&!me.bUsePTTrain){me.bUsePTLocal=true;me.bUsePTTrain=true;me.pRouteParams.Show();}
var arrWrongAddresses=me.GetWrongAddresses();if(arrWrongAddresses.length==0){var addressList=me.GetAddressList();var iRoutePointsNum=GetArrayLength(addressList);if(iRoutePointsNum>1){if(me.IsByPublicTransport()&&!me.timectrl.HasTime()){var divPopup=NewTag('div');var timectrl2=new TimeControl();var div=NewTag('div',divPopup);div.style.marginLeft="auto";div.style.marginRight="auto";div.style.width="240px";timectrl2.SetDiv(div);timectrl2.Show();var div=NewTag('div',divPopup);div.style.textAlign="center";var OnOK=function(){me.timectrl.SetTime(timectrl2.GetTime());me.timectrl.bHasTime=timectrl2.bHasTime;me.timectrl.Show();g_PopUpHandler.HidePopup();me.FindRoute();}
var OnNow=function(){me.timectrl.SetTimePart(g_Babel.GetWord('Now'));me.timectrl.Show();g_PopUpHandler.HidePopup();me.FindRoute();}
var OnCancel=function(){g_PopUpHandler.HidePopup();}
var button=NewTag('input');button.type="button";button.value="OK";AddTag(button,div);AddEvent(button,"click",OnOK);var button=NewTag('input');button.type="button";button.value=g_Babel.GetWord('Now');AddTag(button,div);AddEvent(button,"click",OnNow);var button=NewTag('input');button.type="button";button.value="Mégsem";AddTag(button,div);AddEvent(button,"click",OnCancel);g_PopUpHandler.SetContent(g_Babel.GetWord('capTimeToTravel'),divPopup);g_PopUpHandler.SetSize(320,150);g_PopUpHandler.CenterPopup();g_PopUpHandler.ShowPopup();return;}
me.SetTrafficTimeValue(me.timectrl.GetTime());if(me.pResultHandler!=null){var div=NewTag('div',me.GetAlertDiv());div.className='UI_routingprogress';var bid="messageRouting";if(me.IsByCar())
bid+="Car";else if(me.IsByPublicTransport())
bid+="PT";else if(me.IsByBicycle())
bid+="Bike";else if(me.IsOnFoot())
bid+="Foot";else if(me.IsByTaxi())
bid+="Taxi";var tt=NewTextTag(g_Babel.GetWord(bid),div);me.pLanguageSupporter.Add(tt,"nodeValue","capRoutingInProgress","","");var strParams=me.GetAddressListUrl()
+"&strTrafficType="+me.GetTrafficType()
+"&iCarOptim="+me.iCarOptim
+"&iBkvOptim="+me.iBkvOptim
+"&strGetOnType="+me.strGetOnType
+"&strTime="+me.strTrafficTime
+"&bToll="+me.bUseTolledRoute
+"&bFerry="+me.bUseFerry
+"&bDirtyRoad="+me.bUseDirtyRoad
+"&bUseOnlineTrafficInfo="+me.bUseOnlineTrafficInfo
+"&bLowDeckOnly="+me.bLowDeckOnly;me.pTopoliszMap.InciServer.CallFunction("FindRoute",strParams,0,me.FindRouteReturned,{'arrAddressList':me.GetAddressList(),'bZoomMap':bZoomMap,"strTrafficTime":me.strTrafficTime});this.setRouteSearchingEnabled(false);me.iBkvOptim=0;}}
else{var alertbox=new Alert(me.GetAlertDiv());var aa=NewTextTag(g_Babel.GetWord("capAlert"),alertbox.th);me.pLanguageSupporter.Add(aa,"nodeValue","capAlert","","");aa=NewTextTag(g_Babel.GetWord("capMinTwoAddress"),alertbox.td);me.pLanguageSupporter.Add(aa,"nodeValue","capMinTwoAddress","","");window.scrollTo(0,GetAbsLayerTop(alertbox.table));}}
else{var alertbox=new Alert(me.GetAlertDiv());var aa=NewTextTag(g_Babel.GetWord("capAlert"),alertbox.th);me.pLanguageSupporter.Add(aa,"nodeValue","capAlert","","");aa=NewTextTag(g_Babel.GetWord("TrafficErrorAddressList"),alertbox.td);me.pLanguageSupporter.Add(aa,"nodeValue","TrafficErrorAddressList","","");var ul=NewTag('ul',alertbox.td);for(var i=0;i<arrWrongAddresses.length;i++){var li=NewTag('li',ul);NewTextTag(arrWrongAddresses[i],li);}
window.scrollTo(0,GetAbsLayerTop(alertbox.table));}}
this.FindRouteReturned=function(pRoute,pClientParams,iCommandID){me.setRouteSearchingEnabled(true);window.status+=me.bCanFindRoute+" ";me.pResultHandler.FillRoute(pRoute,pClientParams);if(me.OnRouteChanged){try{me.OnRouteChanged(pRoute);}
catch(exp){if(me.pTopoliszMap.OnError)
me.pTopoliszMap.OnError(exp,"CUtvonaltervRouteSearch.OnRouteChanged");}}}
this.GetAlertDiv=function()
{me.ClearAlertDiv();return me.divAlert;}
this.ClearAlertDiv=function()
{if(me.divAlert)
{while(me.divAlert.firstChild)
me.divAlert.removeChild(me.divAlert.firstChild);}}
this.Hide=function()
{me.divMain.style.display="none";}
this.Unhide=function()
{me.divMain.style.display="";}
this.OnChangeLang=function()
{me.pLanguageSupporter.Apply();}
g_Babel.AddListener(this.OnChangeLang);this.Init();}

function CUtvonaltervRouteParams(pRouteSearch,bHasFuelCalculation)
{this.div=null;this.pRouteSearch=pRouteSearch;this.aShowDetails=null;this.inputTrafficTime=null;this.inputTrafficTime2=null;this.divTimeList=null;this.bSkipNextBlur=false;this.killTimer=null;this.colorpanel=null;this.bDetailsVisible=false;this.divDetails=null;this.arrRadioCarOptims=new Array();this.checkFerry=null;this.checkPay=null;this.checkDirtyRoad=null;this.checkOnlineTrafficInfo=null;this.inputConsumption=null;this.inputFuelPrice=null;this.checkPTLocal=true;this.checkPTTrain=true;this.checkLowDeckOnly=null;this.arrRadioGetOnTypes=new Array();this.bHasFuelCalculation=bHasFuelCalculation;this.pLanguageSupporter=new LanguageSupporter();var me=this;this.SetDiv=function(div)
{me.div=div;}
this.GetDiv=function()
{return me.divMain;}
this.ChangeDetailsVisibility=function()
{me.bDetailsVisible=!me.bDetailsVisible;if(me.bDetailsVisible)
{if(me.divDetails&&me.divDetails.parentNode)
{if(me.aShowDetails)
me.aShowDetails.style.display="none";me.divDetails.style.display="";}
else
me.ShowDetails();}
else
{if(me.aShowDetails)
me.aShowDetails.style.display="";if(me.divDetails)
me.divDetails.style.display="none";}}
this.HideDetails=function()
{if(me.bDetailsVisible)
{me.bDetailsVisible=false;if(me.aShowDetails)
me.aShowDetails.style.display="";if(me.divDetails)
me.divDetails.style.display="none";}}
this.Show=function()
{if(me.div&&me.pRouteSearch)
{while(me.div.firstChild)
me.div.removeChild(me.div.firstChild);me.bDetailsVisible=false;if(me.pRouteSearch.IsByCar()||me.pRouteSearch.IsByTaxi()||me.pRouteSearch.IsByPublicTransport())
{me.colorpanel=new ColorPanel(me.div);if(me.pRouteSearch.IsByPublicTransport())
{me.aShowDetails=NewTag("div",me.colorpanel.td);var a=NewTag('a',me.aShowDetails);a.setAttribute('href','javascript:void(0)');AddEvent(a,"click",me.ShowDetails);NewTextTag(g_Babel.GetWord('capPTServiceProviders')+"...",a);me.pLanguageSupporter.Add(a,"innerHTML","capPTServiceProviders","","...");if(me.bDetailsVisible)
me.ShowDetails();}
if(me.pRouteSearch.IsByCar())
{me.aShowDetails=NewTag("div",me.colorpanel.td);var a=NewTag('a',me.aShowDetails);a.setAttribute('href','javascript:void(0)');AddEvent(a,"click",me.ShowDetails);if(me.bHasFuelCalculation){NewTextTag(g_Babel.GetWord('capRouteSettingsCarMore')+"...",a);}
else{NewTextTag(g_Babel.GetWord('capRouteSettingsCarNoFuelMore')+"...",a);}
me.pLanguageSupporter.Add(a,"innerHTML","capRouteSettingsCarMore","","...");if(me.bDetailsVisible)
me.ShowDetails();}
if(me.pRouteSearch.IsByTaxi())
{me.aShowDetails=NewTag("div",me.colorpanel.td);var a=NewTag('a',me.aShowDetails);a.setAttribute('href','javascript:void(0)');AddEvent(a,"click",me.ShowDetails);NewTextTag(g_Babel.GetWord('capRouteSettingsTaxiMore')+"...",a);me.pLanguageSupporter.Add(a,"innerHTML","capRouteSettingsTaxiMore","","...");if(me.bDetailsVisible)
me.ShowDetails();}}
if(me.pRouteSearch.IsByBicycle()||me.pRouteSearch.IsOnFoot())
{me.colorpanel=new ColorPanel(me.div);me.aShowDetails=NewTag("div",me.colorpanel.td);var a=NewTag('a',me.aShowDetails);a.setAttribute('href','javascript:void(0)');AddEvent(a,"click",me.ShowDetails);NewTextTag(g_Babel.GetWord('capRouteSettingsMore')+"...",a);me.pLanguageSupporter.Add(a,"innerHTML","capRouteSettingsMore","","...");if(me.bDetailsVisible)
me.ShowDetails();}}}
this.ShowDetails=function()
{me.bDetailsVisible=true;if(me.div&&me.pRouteSearch)
{if(me.aShowDetails)
me.aShowDetails.style.display="none";me.divDetails=NewTag("div",me.colorpanel.td);if(me.pRouteSearch.IsByCar()||me.pRouteSearch.IsByTaxi()||me.pRouteSearch.IsByPublicTransport()||me.pRouteSearch.IsOnFoot()||me.pRouteSearch.IsByBicycle())
{var div=NewTag('div',me.divDetails);var a=NewTag('a',div);a.setAttribute('href','javascript:void(0)');NewTextTag(g_Babel.GetWord('HideDetails'),a);me.pLanguageSupporter.Add(a,"innerHTML","HideDetails","","");AddEvent(a,"click",me.HideDetails);if(me.pRouteSearch.IsByCar())
me.ShowCarParams(me.divDetails);if(me.pRouteSearch.IsByTaxi())
me.ShowTaxiParams(me.divDetails);if(me.pRouteSearch.IsByPublicTransport())
me.ShowPTParams(me.divDetails);if(me.pRouteSearch.IsOnFoot())
me.ShowFootParams(me.divDetails);if(me.pRouteSearch.IsByBicycle())
me.ShowBicycleParams(me.divDetails);var div=NewTag('div',me.divDetails);var a=NewTag('a',div);a.setAttribute('href','javascript:void(0)');NewTextTag(g_Babel.GetWord('HideDetails'),a);me.pLanguageSupporter.Add(a,"innerHTML","HideDetails","","");AddEvent(a,"click",me.HideDetails);}}}
this.ShowTime=function(divParent)
{var inputbox=new InputBox(divParent);inputbox.tdInput.style.width="100px"
inputbox.input.setAttribute('maxlength',16);inputbox.input.value=me.pRouteSearch.GetTrafficTime();me.inputTrafficTime=inputbox.input;me.inputTrafficTime2=null;AddEvent(inputbox.input,"blur",me.SetTrafficTime);AddEvent(inputbox.input,"focus",inputbox.input.select);AddEvent(inputbox.input,"keypress",me.OnKeyPressTrafficTime);var td=inputbox.InsertTd();td.style.whiteSpace="nowrap";NewTextTag(g_Babel.GetWord('capTimeToTravel'),td);me.pLanguageSupporter.Add(td,"innerHTML","capTimeToTravel","","");}
this.ShowTime2=function(divParent)
{var inputbox=new InputBox(divParent);var td=inputbox.InsertTd();td.style.whiteSpace="nowrap";NewTextTag(g_Babel.GetWord('capTimeToTravel'),td);me.pLanguageSupporter.Add(td,"innerHTML","capTimeToTravel","","");inputbox.tdInput.style.width="70px"
inputbox.input.setAttribute('maxlength',10);inputbox.input.value=me.pRouteSearch.GetTrafficTime().substr(0,10);me.inputTrafficTime=inputbox.input;AddEvent(inputbox.input,"blur",me.SetTrafficTime);AddEvent(inputbox.input,"focus",inputbox.input.select);AddEvent(inputbox.input,"keypress",me.OnKeyPressTrafficTime);td=inputbox.AppendTd();NewTextTag('\u00a0',td);inputbox.CreateInput();inputbox.tdInput.style.width="35px"
inputbox.input.setAttribute('maxlength',5);inputbox.input.value=me.pRouteSearch.GetTrafficTime().substr(11);AddEvent(inputbox.input,"blur",me.OnTimeBlur);AddEvent(inputbox.input,"focus",inputbox.input.select);AddEvent(inputbox.input,"focus",me.ShowTimeList);me.inputTrafficTime2=inputbox.input;}
this.ShowCarParams=function(divParent)
{if(me.bHasFuelCalculation){me.ShowCarFuelParams(divParent);}
var fieldset=NewTag('fieldset',divParent);var legend=NewTag('legend',fieldset);NewTextTag(g_Babel.GetWord('capRoute'),legend);me.pLanguageSupporter.Add(legend,"innerHTML","capRoute","","");var input=CreateRadioButton("radioCarOptim","idCarFastestRoute","0");input.className="checkbox";AddTag(input,fieldset);AddEvent(input,'change',me.SetCarOptim);var label=NewTag('label',fieldset);label.setAttribute('for','idCarFastestRoute');NewTextTag(g_Babel.GetWord('FastestRoute'),label);me.pLanguageSupporter.Add(label,"innerHTML","FastestRoute","","");NewTag('br',fieldset);me.arrRadioCarOptims[0]=input;var input=CreateRadioButton("radioCarOptim","idShortestRoute","1");input.className="checkbox";AddTag(input,fieldset);AddEvent(input,'change',me.SetCarOptim);var label=NewTag('label',fieldset);label.setAttribute('for','idShortestRoute');NewTextTag(g_Babel.GetWord('ShortestRoute'),label);me.pLanguageSupporter.Add(label,"innerHTML","ShortestRoute","","");NewTag('br',fieldset);me.arrRadioCarOptims[1]=input;if(me.pRouteSearch.iCarOptim>=0&&me.pRouteSearch.iCarOptim<2)
me.arrRadioCarOptims[me.pRouteSearch.iCarOptim].checked=true;var input=NewTag('input');input.setAttribute('type','checkbox');input.className="checkbox";input.setAttribute("id","idCheckPay");AddTag(input,fieldset);var label=NewTag('label',fieldset);label.setAttribute('for','idCheckPay');NewTextTag(g_Babel.GetWord('UseTolledRoute'),label);me.pLanguageSupporter.Add(label,"innerHTML","UseTolledRoute","","");NewTag('br',fieldset);me.checkPay=input;if(me.pRouteSearch.bUseTolledRoute)
me.checkPay.checked=true;AddEvent(me.checkPay,'click',me.SetPay);var input=NewTag('input');input.setAttribute('type','checkbox');input.className="checkbox";input.setAttribute("id","idCheckFerry");AddTag(input,fieldset);var label=NewTag('label',fieldset);label.setAttribute('for','idCheckFerry');NewTextTag(g_Babel.GetWord('UseFerry'),label);me.pLanguageSupporter.Add(label,"innerHTML","UseFerry","","");NewTag('br',fieldset);me.checkFerry=input;if(me.pRouteSearch.bUseFerry)
me.checkFerry.checked=true;AddEvent(me.checkFerry,'click',me.SetFerry);var input=NewTag('input');input.setAttribute('type','checkbox');input.className="checkbox";input.setAttribute("id","idCheckDirtyRoad");AddTag(input,fieldset);var label=NewTag('label',fieldset);label.setAttribute('for','idCheckDirtyRoad');NewTextTag(g_Babel.GetWord('UseDirtyRoad'),label);me.pLanguageSupporter.Add(label,"innerHTML","UseDirtyRoad","","");NewTag('br',fieldset);me.checkDirtyRoad=input;if(me.pRouteSearch.bUseDirtyRoad)
me.checkDirtyRoad.checked=true;AddEvent(me.checkDirtyRoad,'click',me.SetDirtyRoad);var input=NewTag('input');input.setAttribute('type','checkbox');input.className="checkbox";input.setAttribute("id","idCheckUseOnlineTrafficInfo");AddTag(input,fieldset);var label=NewTag('label',fieldset);label.setAttribute('for','idCheckUseOnlineTrafficInfo');NewTextTag(g_Babel.GetWord('UseOnlineTrafficInfo'),label);NewTag('br',fieldset);me.checkOnlineTrafficInfo=input;if(me.pRouteSearch.bUseOnlineTrafficInfo)
me.checkOnlineTrafficInfo.checked=true;AddEvent(me.checkOnlineTrafficInfo,'click',me.SetOnlineTrafficInfo);}
this.ShowCarFuelParams=function(divParent)
{var fieldset=NewTag('fieldset',divParent);var div=NewTag('div',fieldset);div.style.color="#999999";NewTextTag(g_Babel.GetWord('capFuelPriceHint')+":",div);me.pLanguageSupporter.Add(div,"innerHTML",'capFuelPriceHint',"",":");var inputbox=new InputBox(fieldset);inputbox.tdInput.style.width="50px";var td=inputbox.InsertTd();td.style.width="120px";NewTextTag(g_Babel.GetWord('Consumption'),td);me.pLanguageSupporter.Add(td,"innerHTML","Consumption","","");td=inputbox.AppendTd();td.style.width="40px";td.style.paddingLeft="5px";NewTextTag("l/100km",td);me.inputConsumption=inputbox.input;if(me.pRouteSearch.dConsumption>0)
me.inputConsumption.value=me.pRouteSearch.dConsumption;AddEvent(me.inputConsumption,'change',me.SetConsumption);var inputbox=new InputBox(fieldset);inputbox.tdInput.style.width="50px";var td=inputbox.InsertTd();td.style.width="120px";NewTextTag(g_Babel.GetWord('capPrice'),td);me.pLanguageSupporter.Add(td,"innerHTML","capPrice","",":");td=inputbox.AppendTd();td.style.width="40px";td.style.paddingLeft="5px";NewTextTag("Ft/l",td);me.inputFuelPrice=inputbox.input;if(me.pRouteSearch.dFuelPrice>0)
me.inputFuelPrice.value=me.pRouteSearch.dFuelPrice;AddEvent(me.inputFuelPrice,'change',me.SetFuelPrice);}
this.ShowBicycleParams=function(divParent)
{var fieldset=NewTag('fieldset',divParent);var legend=NewTag('legend',fieldset);NewTextTag(g_Babel.GetWord('capRoute'),legend);me.pLanguageSupporter.Add(legend,"innerHTML","capRoute","","");var input=NewTag('input');input.setAttribute('type','checkbox');input.className="checkbox";input.setAttribute("id","idCheckFerry");AddTag(input,fieldset);var label=NewTag('label',fieldset);label.setAttribute('for','idCheckFerry');NewTextTag(g_Babel.GetWord('UseFerry'),label);me.pLanguageSupporter.Add(label,"innerHTML","UseFerry","","");NewTag('br',fieldset);me.checkFerry=input;if(me.pRouteSearch.bUseFerry)
me.checkFerry.checked=true;AddEvent(me.checkFerry,'click',me.SetFerry);var input=NewTag('input');input.setAttribute('type','checkbox');input.className="checkbox";input.setAttribute("id","idCheckDirtyRoad");AddTag(input,fieldset);var label=NewTag('label',fieldset);label.setAttribute('for','idCheckDirtyRoad');NewTextTag(g_Babel.GetWord('UseDirtyRoad'),label);me.pLanguageSupporter.Add(label,"innerHTML","UseDirtyRoad","","");NewTag('br',fieldset);me.checkDirtyRoad=input;if(me.pRouteSearch.bUseDirtyRoad)
me.checkDirtyRoad.checked=true;AddEvent(me.checkDirtyRoad,'click',me.SetDirtyRoad);}
this.ShowFootParams=function(divParent)
{var fieldset=NewTag('fieldset',divParent);var legend=NewTag('legend',fieldset);NewTextTag(g_Babel.GetWord('capRoute'),legend);me.pLanguageSupporter.Add(legend,"innerHTML","capRoute","","");var input=NewTag('input');input.setAttribute('type','checkbox');input.className="checkbox";input.setAttribute("id","idCheckFerry");AddTag(input,fieldset);var label=NewTag('label',fieldset);label.setAttribute('for','idCheckFerry');NewTextTag(g_Babel.GetWord('UseFerry'),label);me.pLanguageSupporter.Add(label,"innerHTML","UseFerry","","");NewTag('br',fieldset);me.checkFerry=input;if(me.pRouteSearch.bUseFerry)
me.checkFerry.checked=true;AddEvent(me.checkFerry,'click',me.SetFerry);var input=NewTag('input');input.setAttribute('type','checkbox');input.className="checkbox";input.setAttribute("id","idCheckDirtyRoad");AddTag(input,fieldset);var label=NewTag('label',fieldset);label.setAttribute('for','idCheckDirtyRoad');NewTextTag(g_Babel.GetWord('UseDirtyRoad'),label);me.pLanguageSupporter.Add(label,"innerHTML","UseDirtyRoad","","");NewTag('br',fieldset);me.checkDirtyRoad=input;if(me.pRouteSearch.bUseDirtyRoad)
me.checkDirtyRoad.checked=true;AddEvent(me.checkDirtyRoad,'click',me.SetDirtyRoad);}
this.ShowTaxiParams=function(divParent)
{var fieldset=NewTag('fieldset',divParent);var div=NewTag('div',fieldset);div.style.color="#999999";NewTextTag(g_Babel.GetWord('capTaxiFeeHint')+":",div);me.pLanguageSupporter.Add(div,"innerHTML",'capTaxiFeeHint',"",":");var inputbox=new InputBox(fieldset);inputbox.tdInput.style.width="50px";var td=inputbox.InsertTd();td.style.width="120px";NewTextTag(g_Babel.GetWord('capTaxiFeeBasic'),td);me.pLanguageSupporter.Add(td,"innerHTML","capTaxiFeeBasic","","");td=inputbox.AppendTd();td.style.width="40px";td.style.paddingLeft="5px";NewTextTag("Ft",td);me.inputTaxiFeeBasic=inputbox.input;if(me.pRouteSearch.dTaxiFeeBasic>0)
me.inputTaxiFeeBasic.value=me.pRouteSearch.dTaxiFeeBasic;AddEvent(me.inputTaxiFeeBasic,'change',me.SetTaxiFeeBasic);var inputbox=new InputBox(fieldset);inputbox.tdInput.style.width="50px";var td=inputbox.InsertTd();td.style.width="120px";NewTextTag(g_Babel.GetWord('capTaxiFeeKm'),td);me.pLanguageSupporter.Add(td,"innerHTML","capTaxiFeeKm","",":");td=inputbox.AppendTd();td.style.width="40px";td.style.paddingLeft="5px";NewTextTag("Ft/km",td);me.inputTaxiFeeKm=inputbox.input;if(me.pRouteSearch.dTaxiFeeKm>0)
me.inputTaxiFeeKm.value=me.pRouteSearch.dTaxiFeeKm;AddEvent(me.inputTaxiFeeKm,'change',me.SetTaxiFeeKm);}
this.ShowProvider=function(tbody,strID,strBabelID,strImgUrl,iImgWidth,iImgHeight)
{var tr=NewTag('tr',tbody);var td=NewTag('td',tr);td.className="checkbox";var input=NewTag('input');input.setAttribute('type','checkbox');input.className="checkbox";input.setAttribute("id",strID);AddTag(input,td);var td=NewTag('td',tr);td.className="UI_text_with_logo";var label=NewTag('label',td);label.setAttribute('for',strID);label.setAttribute('id','lab'+strID);NewTextTag(g_Babel.GetWord(strBabelID),label);me.pLanguageSupporter.Add(label,"innerHTML",strBabelID,"","");var td=NewTag('td',tr);var div=NewTag('div',td);div.className="UI_text_with_logo";strImgUrl=null;if(strImgUrl!=null)
{var img=NewTag('img',div);img.className="UI_text_with_logo";SetImage(img,strImgUrl,iImgWidth,iImgHeight,g_Babel.GetWord(strBabelID));}
return input;}
this.ShowPTGetOnVehicleTypes=function(divParent)
{var span=NewTag('span',divParent);NewTextTag("Tömegközlekedési megálló megközelítése",span);NewTag('br',divParent);var fieldset=divParent;me.arrRadioGetOnTypes=[];var CreateRow=function(strInputID,strInputValue,strInputText)
{var input=CreateRadioButton("radioGetOnType",strInputID,strInputValue);input.className="checkbox";AddTag(input,fieldset);AddEvent(input,'change',me.SetGetOnType);if(me.pRouteSearch.strGetOnType==strInputValue)
input.checked=true;var label=NewTag('label',fieldset);label.setAttribute('for',strInputID);NewTextTag(strInputText,label);NewTag('br',fieldset);me.arrRadioGetOnTypes[me.arrRadioGetOnTypes.length]=input;}
CreateRow("idGetOnFoot","foot","Gyalog");CreateRow("idGetOnBicycle","bicycle","Kerékpárral");CreateRow("idGetOnCar","car","Autóval");CreateRow("idGetOnTaxi","taxi","Taxival");}
this.PTSorter=function(a,b)
{if(a==null&&b==null)
return 0;if(a==null)
return-1;if(b==null)
return 1;if(a.nID==1&&b.nID==1)
return 0;if(a.nID==1)
return-1;if(b.nID==1)
return 1;if(a.strAreaDescription<b.strAreaDescription)
return-1;if(a.strAreaDescription>b.strAreaDescription)
return 1;return 0;}
this.ShowPTServiceProviders=function(divParent)
{var fieldset=NewTag('fieldset',divParent);divParent=fieldset;var tbody,iColSpan;var table1=NewTag('table',divParent);table1.className="checkbox";table1.cellPadding=0;table1.cellSpacing=0;table1.style.width="100%";var tbody=NewTag('tbody',table1);var tr=NewTag('tr',tbody);var td=NewTag('td',tr);var td=NewTag('td',tr);var table=NewTag('table',td);table.className="checkbox";table.cellPadding=0;table.cellSpacing=0;table.style.width="100%";var tbody=NewTag('tbody',table);me.checkPTTrain=me.ShowProvider(tbody,"idCheckMAV","ptProviderRailways","design/ICON_PT_mavstart.png",105,29);if(me.pRouteSearch.bUsePTTrain)
me.checkPTTrain.checked=true;AddEvent(me.checkPTTrain,'click',me.SetPTTrain);me.checkPTLocal=me.ShowProvider(tbody,"idCheckBKV","ptProviderLocalPublicTransport",null,76,30);if(me.pRouteSearch.bUsePTLocal)
me.checkPTLocal.checked=true;AddEvent(me.checkPTLocal,'click',me.SetPTLocal);var td=me.checkPTLocal.parentNode.nextSibling;var arrLocals=[];for(var i=0;i<g_arrPTServiceProviders.length;i++)
{if(g_arrPTServiceProviders[i]!=null&&g_arrPTServiceProviders[i].bLocal&&g_arrPTServiceProviders[i].strAreaDescription!=null&&g_arrPTServiceProviders[i].strAreaDescription.length>0)
{arrLocals[arrLocals.length]=g_arrPTServiceProviders[i];}}
arrLocals.sort(me.PTSorter);var MakeUl=function(bColSpan){var ul=NewTag('ul',td);if(!bColSpan)
{ul.style.cssFloat="left";ul.style.styleFloat="left";ul.style.paddingRight="2px";}
return ul;}
var bOdd=arrLocals.length%2==1;var ul=MakeUl(bOdd);for(var i=0;i<arrLocals.length;i++)
{if(bOdd)
{if(i==1||i==(arrLocals.length+1)/2)
ul=MakeUl(false);}
else
{if(i==arrLocals.length/2)
ul=MakeUl(false);}
var li=NewTag('li',ul);NewTextTag(arrLocals[i].strAreaDescription,li);}}
this.ShowPTParams=function(divParent)
{me.ShowPTServiceProviders(divParent);if(g_InitSettings.iMultiModalVersion==1)
me.ShowPTGetOnVehicleTypes(divParent);return;var fieldset=NewTag("fieldset",divParent);var input=NewTag('input');input.setAttribute('type','checkbox');input.className="checkbox";input.setAttribute("id","idCheckLowDeckOnly");AddTag(input,fieldset);var label=NewTag('label',fieldset);label.setAttribute('for','idCheckLowDeckOnly');NewTextTag(g_Babel.GetWord('LowDeckOnly'),label);NewTag('br',fieldset);me.checkLowDeckOnly=input;if(me.pRouteSearch.bLowDeckOnly)
me.checkLowDeckOnly.checked=true;AddEvent(me.checkLowDeckOnly,'click',me.SetLowDeckOnly);}
this.GetCurrentTime=function()
{var date=new Date();var strTimePart="";if(date.getHours()<10)
strTimePart+="0";strTimePart+=date.getHours();strTimePart+=":";if(date.getMinutes()<10)
strTimePart+="0";strTimePart+=date.getMinutes();return strTimePart;}
this.GetTrafficTime=function()
{var strTrafficTime=me.inputTrafficTime.value;if(me.inputTrafficTime2)
{var strTimePart=me.inputTrafficTime2.value;if(strTimePart==null||strTimePart==""||strTimePart==g_Babel.GetWord('Now'))
{strTimePart=me.GetCurrentTime();}
strTrafficTime+=" "+strTimePart;}
return strTrafficTime;}
this.SetTrafficTime=function()
{var strOldTrafficTime=me.pRouteSearch.GetTrafficTime();me.pRouteSearch.SetTrafficTime(me.GetTrafficTime());if(strOldTrafficTime!=me.pRouteSearch.GetTrafficTime())
{if(me.inputTrafficTime2)
{me.inputTrafficTime.value=me.pRouteSearch.GetTrafficTime().substr(0,10);me.inputTrafficTime2.value=me.pRouteSearch.GetTrafficTime().substr(11);}
else
{me.inputTrafficTime.value=me.pRouteSearch.GetTrafficTime();}
me.OnSettingsChanged();}}
this.HideTimeList=function()
{if(me.divTimeList&&me.divTimeList.parentNode)
me.divTimeList.parentNode.removeChild(me.divTimeList);me.divTimeList=null;}
this.OnTimeBlur=function()
{{me.killTimer=window.setTimeout(me.OnTimeBlurFunc,250);}}
this.OnTimeBlurFunc=function()
{me.HideTimeList();me.SetTrafficTime();}
this.KillTimer=function()
{me.bSkipNextBlur=true;if(me.killTimer)
{window.clearTimeout(me.killTimer);me.killTimer=null;}}
this.ShowTimeList=function(input)
{me.HideTimeList();input=me.inputTrafficTime2;me.divTimeList=NewTag('div',document.body);me.divTimeList.className="AddressResult";me.divTimeList.style.position="absolute";me.divTimeList.style.top=(GetAbsLayerTop(input)+GetLayerHeight(input))+"px";me.divTimeList.style.left=(GetAbsLayerLeft(input))+"px";me.divTimeList.style.width=(GetLayerWidth(input)-1+20)+"px";AddEvent(me.divTimeList,"focus",me.KillTimer);AddEvent(me.divTimeList,"blur",me.OnTimeBlur);var SetOnClick=function(a,str,i)
{a.onclick=function()
{me.inputTrafficTime2.value=str;me.SetTrafficTime();me.HideTimeList();}
AddEvent(a,"focus",me.KillTimer);}
var iHour=0;var str="";var date=new Date();var iTop
var bDisplayedCurrentTime=false;for(i=-1;i<24;i++)
{a=NewTag('a',me.divTimeList);a.setAttribute('href','javascript:void(0)');a.className="AddressResult";a.style.zIndex="5";if(i==-1)
{str=g_Babel.GetWord("Now");}
else if(bDisplayedCurrentTime)
{str=me.GetCurrentTime();}
else
{if(i<10)
str="0"+i+":00";else
str=i+":00";}
SetOnClick(a,str,i);NewTextTag(str,a);if(bDisplayedCurrentTime)
{iTop=GetLayerTop(a);}
if(!bDisplayedCurrentTime&&date.getHours()==i&&date.getMinutes()!=0)
{bDisplayedCurrentTime=true;i--;continue;}
bDisplayedCurrentTime=false;}
if(GetLayerHeight(me.divTimeList)>150)
{me.divTimeList.style.height="150px";me.divTimeList.style.overflowY="scroll";me.divTimeList.scrollTop=iTop;}}
this.OnKeyPressTrafficTime=function(pEvent)
{if(pEvent==null)
pEvent=window.event;if(pEvent.keyCode==13)
{me.SetTrafficTime();}}
this.SetCarOptim=function()
{for(var i=0;i<me.arrRadioCarOptims.length;i++)
{if(me.arrRadioCarOptims[i]&&me.arrRadioCarOptims[i].checked)
{me.pRouteSearch.iCarOptim=i;break;}}
setCookie('CarOptim',me.pRouteSearch.iCarOptim);me.OnSettingsChanged();}
this.SetPay=function()
{me.pRouteSearch.bUseTolledRoute=me.checkPay.checked;setCookie('PayCheck',me.pRouteSearch.bUseTolledRoute);me.OnSettingsChanged();}
this.SetFerry=function()
{me.pRouteSearch.bUseFerry=me.checkFerry.checked;setCookie('FerryCheck',me.pRouteSearch.bUseFerry);me.OnSettingsChanged();}
this.SetDirtyRoad=function()
{me.pRouteSearch.bUseDirtyRoad=me.checkDirtyRoad.checked;setCookie('DirtyCheck',me.pRouteSearch.bUseDirtyRoad);me.OnSettingsChanged();}
this.SetOnlineTrafficInfo=function()
{me.pRouteSearch.bUseOnlineTrafficInfo=me.checkOnlineTrafficInfo.checked;setCookie('UseOnlineTrafficInfo',me.pRouteSearch.bUseOnlineTrafficInfo);me.OnSettingsChanged();}
this.SetLowDeckOnly=function(){me.pRouteSearch.bLowDeckOnly=me.checkLowDeckOnly.checked;setCookie('LowDeckOnly',me.pRouteSearch.bLowDeckOnly);me.OnSettingsChanged();}
this.SetConsumption=function()
{me.pRouteSearch.dConsumption=parseFloat(me.inputConsumption.value);me.inputConsumption.value=me.pRouteSearch.dConsumption>0?me.pRouteSearch.dConsumption:"";setCookie('Consumption',me.pRouteSearch.dConsumption);if(me.pRouteSearch.pRouteResult)
me.pRouteSearch.pRouteResult.ShowTotal();}
this.SetFuelPrice=function()
{me.pRouteSearch.dFuelPrice=parseFloat(me.inputFuelPrice.value);me.inputFuelPrice.value=me.pRouteSearch.dFuelPrice>0?me.pRouteSearch.dFuelPrice:"";setCookie('FuelPrice',me.pRouteSearch.dFuelPrice);if(me.pRouteSearch.pRouteResult)
me.pRouteSearch.pRouteResult.ShowTotal();}
this.SetTaxiFeeBasic=function()
{me.pRouteSearch.dTaxiFeeBasic=parseFloat(me.inputTaxiFeeBasic.value);me.inputTaxiFeeBasic.value=me.pRouteSearch.dTaxiFeeBasic>0?me.pRouteSearch.dTaxiFeeBasic:"";setCookie('TaxiFeeBasic',me.pRouteSearch.dTaxiFeeBasic);if(me.pRouteSearch.pRouteResult)
me.pRouteSearch.pRouteResult.ShowTotal();}
this.SetTaxiFeeKm=function()
{me.pRouteSearch.dTaxiFeeKm=parseFloat(me.inputTaxiFeeKm.value);me.inputTaxiFeeKm.value=me.pRouteSearch.dTaxiFeeKm>0?me.pRouteSearch.dTaxiFeeKm:"";setCookie('TaxiFeeKm',me.pRouteSearch.dTaxiFeeKm);if(me.pRouteSearch.pRouteResult)
me.pRouteSearch.pRouteResult.ShowTotal();}
this.SetBkvOptim=function(src)
{for(var i=0;i<me.arrRadioBkvOptims.length;i++)
{if(me.arrRadioBkvOptims[i]&&me.arrRadioBkvOptims[i].checked)
{me.pRouteSearch.iBkvOptim=i;break;}}
setCookie('BkvOptim',me.pRouteSearch.iBkvOptim);me.OnSettingsChanged();}
this.SetPTLocal=function(src)
{me.pRouteSearch.bUsePTLocal=me.checkPTLocal.checked;setCookie('UsePTLocal',me.pRouteSearch.bUsePTLocal);me.OnSettingsChanged();}
this.SetPTTrain=function(src)
{me.pRouteSearch.bUsePTTrain=me.checkPTTrain.checked;setCookie('UsePTTrain',me.pRouteSearch.bUsePTTrain);me.OnSettingsChanged();}
this.SetGetOnType=function(src)
{var strGetOnType="foot";for(var i=0;i<me.arrRadioGetOnTypes.length;i++)
{if(me.arrRadioGetOnTypes[i]&&me.arrRadioGetOnTypes[i].checked)
{strGetOnType=me.arrRadioGetOnTypes[i].value;break;}}
me.pRouteSearch.strGetOnType=strGetOnType;setCookie('GetOnType',strGetOnType);me.OnSettingsChanged();}
this.OnSettingsChanged=function()
{}
this.OnChangeLang=function()
{me.pLanguageSupporter.Apply();}
g_Babel.AddListener(this.OnChangeLang);}

function ExtraInfo(div,pTopoliszMap)
{this.div=div;this.pTopoliszMap=pTopoliszMap;this.cbxDisplayCoords=null;this.cbxDailyNews=null;this.cbxTrafficChanges=null;this.cbxWeather=null;this.cbxUTV=null;this.cbxTMC=null;this.bDailyNews=false;this.bTrafficChanges=false;this.bWeather=false;this.pPoiTree=null;this.bResendNeeded=false;this.bUnderPoiDrawing=false;this.pPoiBox=new POIBOX(null,pTopoliszMap,"layertype");var me=this;this.SetDailyNews=function(bEnable)
{me.bDailyNews=bEnable;if(me.cbxDailyNews)
{me.cbxDailyNews.checked=bEnable;}
if(bEnable)
me.SetTrafficChanges(false);}
this.SetTrafficChanges=function(bEnable)
{me.bTrafficChanges=bEnable;if(me.cbxTrafficChanges)
{me.cbxTrafficChanges.checked=bEnable;}
if(bEnable)
me.SetDailyNews(false);}
this.SetWeather=function(bEnable)
{me.bWeather=bEnable;if(me.cbxWeather)
{me.cbxWeather.checked=bEnable;}}
this.SetUTV=function(bEnable)
{me.bUTV=bEnable;if(me.cbxUTV)
{me.cbxUTV.checked=bEnable;}}
this.Init=function()
{me.pTopoliszMap.AddDrawRouteCallbackListener(me.OnDrawRouteReturned);g_Babel.AddListener(me.Show);}
this.Show=function()
{while(me.div.hasChildNodes())
me.div.removeChild(me.div.firstChild);var panel=new Panel(me.div);panel.CreateCaption(g_Babel.GetWord("capMapSettings"),"design/ICON_settings_off.gif",14,14);var colorpanel=new ColorPanel(me.div);var fieldset=NewTag('fieldset',colorpanel.td);var legend=NewTag('legend',fieldset);NewTextTag(g_Babel.GetWord("capFunctionality"),legend);var input=NewTag('input');input.setAttribute('type','checkbox');input.style.marginRight="4px";input.style.paddingRight="0px";input.setAttribute("id","cbxDisplayCoords");AddTag(input,fieldset);AddEvent(input,"click",me.SwitchDisplayCoords);input.checked=me.pTopoliszMap.bDisplayCoords;me.cbxDisplayCoords=input;var label=NewTag('label',fieldset);label.setAttribute('for','cbxDisplayCoords');NewTextTag(g_Babel.GetWord('cDisplayCoords'),label);NewTag('br',fieldset);var fieldset=NewTag('fieldset',colorpanel.td);var legend=NewTag('legend',fieldset);NewTextTag(g_Babel.GetWord("capExtraInformations"),legend);var divFovinform=NewTag('div',fieldset);divFovinform.className="fovinform";var a=NewTag('a',divFovinform);a.style.color="blue";a.setAttribute('href','http://fovinform.hu');a.setAttribute('target','_blank');var img=NewTag('img',a);SetImage(img,"images/partners/fovinformlogo.jpg",46,62,"Fővinform");NewTag('br',divFovinform);var a=NewTag('a',divFovinform);a.style.color="blue";a.setAttribute('href','http://www.fovinform.hu/home/copyright.php');a.setAttribute('target','_blank');a.setAttribute('alt','Copyright');NewTextTag("\u00A9 Copyright",a);var table=NewTag('table',fieldset);table.cellPadding=0;table.cellSpacing=5;var tbody=NewTag('tbody',table);var tr=NewTag('tr',tbody);var td=NewTag('td',tr);td.style.verticalAlign="top";td.style.padding="0px";var input=NewTag('input');input.setAttribute('type','checkbox');input.style.paddingRight="0px";input.setAttribute("id","cbxDailyNews");AddTag(input,td);AddEvent(input,"click",me.SwitchDailyNews);me.cbxDailyNews=input;var td=NewTag('td',tr);var label=NewTag('label',td);label.setAttribute('for','cbxDailyNews');NewTextTag(g_Babel.GetWord('cDailyNews'),label);var tr=NewTag('tr',tbody);var td=NewTag('td',tr);td.style.verticalAlign="top";td.style.padding="0px";var input=NewTag('input');input.setAttribute('type','checkbox');input.style.paddingRight="0px";input.setAttribute("id","cbxTrafficChanges");AddTag(input,td);AddEvent(input,"click",me.SwitchTrafficChanges);me.cbxTrafficChanges=input;var td=NewTag('td',tr);var label=NewTag('label',td);label.setAttribute('for','cbxTrafficChanges');NewTextTag(g_Babel.GetWord('cTrafficChange'),label);var tr=NewTag('tr',tbody);var td=NewTag('td',tr);td.style.verticalAlign="top";td.style.padding="0px";var input=NewTag('input');input.setAttribute('type','checkbox');input.style.paddingRight="0px";input.setAttribute("id","cbxUTV");input.checked=me.pTopoliszMap.IsDrawUTV();AddTag(input,td);AddEvent(input,"click",me.SwitchUTV);me.cbxUTV=input;me.pTopoliszMap.AddDrawUTVChangedListener(me.RefreshDrawUTVState);var td=NewTag('td',tr);var label=NewTag('label',td);label.setAttribute('for','cbxUTV');NewTextTag(g_Babel.GetWord('utv'),label);var divUTV=NewTag('div',td);divUTV.style.display="inline";divUTV.style.fontSize="10px";var a=NewTag("a",divUTV);a.setAttribute("href","javascript:void(0)");a.style.paddingLeft="10px";a.onclick=function(){window.open("http://www.utv.hu");}
NewTextTag("www.utv.hu",a);if(g_InitSettings.bTMC)
{var tr=NewTag('tr',tbody);var td=NewTag('td',tr);td.style.verticalAlign="top";td.style.padding="0px";var input=NewTag('input');input.setAttribute('type','checkbox');input.style.paddingRight="0px";input.setAttribute("id","cbxTMC");input.checked=me.pTopoliszMap.Get_bDrawTMC();AddTag(input,td);AddEvent(input,"click",me.SwitchTMC);me.cbxTMC=input;me.pTopoliszMap.AddDrawTMCChangedListener(me.RefreshDrawTMCState);var td=NewTag('td',tr);var label=NewTag('label',td);label.setAttribute('for','cbxTMC');NewTextTag(g_Babel.GetWord('cbxTMC'),label);var divTMC=NewTag('div',td);divTMC.style.display="inline";divTMC.style.fontSize="10px";var a=NewTag("a",divTMC);a.setAttribute("href","javascript:void(0)");a.style.paddingLeft="10px";a.onclick=function(){window.open("http://www.trafficnav.hu");}
NewTextTag("www.trafficnav.hu",a);}
var fieldset=NewTag('fieldset',colorpanel.td);var legend=NewTag('legend',fieldset);NewTextTag(g_Babel.GetWord("capMapLayers"),legend);var div=NewTag('div',fieldset);me.FillTree(div);NewTag('hr',me.div);var div=NewTag('div',me.div);me.pPoiBox.SetDiv(div);me.pPoiBox.Show();}
this.FillTree=function(div)
{if(g_TopoliszControls.pLayerPoiTreeMemo==null)
{if(g_arrPoiTypes!=null)
{var arrTreeItems=new Array();var bAllPoisOnMap=true;for(var i=0;i<g_arrPoiTypes.length;i++)
{var pType=g_arrPoiTypes[i];var label=g_Babel.GetWord("poi"+pType.iID);if(g_arrPoiTypes[i].iCount>0)
label+=" ("+g_arrPoiTypes[i].iCount+")";arrTreeItems[arrTreeItems.length]=new CTreeItem(pType.iID,label,pType.iLevel,pType.bOnMap,false,pType.bShowInTree);if(!pType.bOnMap)
bAllPoisOnMap=false;}
arrTreeItems[0].SetChecked(bAllPoisOnMap);me.pPoiTree=new CTree(div,arrTreeItems);me.pPoiTree.OnCheckChanged=function(){me.OnTreeCheckChanged()};me.pPoiTree.Show();arrTreeItems[0].Open();}}
else
{me.pPoiTree=g_TopoliszControls.pLayerPoiTreeMemo;}}
this.Hide=function()
{Hide(me.div);}
this.Unhide=function()
{Show(me.div);me.pTopoliszMap.SetPoiLayers(me.pPoiTree.GetCheckedIDsInStr());me.pTopoliszMap.DrawRoute();}
this.SwitchDisplayCoords=function()
{me.pTopoliszMap.SetDisplayCoords(!me.pTopoliszMap.bDisplayCoords);if(me.cbxDisplayCoords)
{me.cbxDisplayCoords.checked=me.pTopoliszMap.bDisplayCoords;}}
this.SwitchDailyNews=function()
{me.SetDailyNews(!me.bDailyNews);me.pTopoliszMap.RemovePinBoxes("dailynews");me.pTopoliszMap.RemovePinLabels("dailynews");me.pTopoliszMap.pMarkers.DeleteAllWithType("dailynews");if(me.bDailyNews)
{me.pTopoliszMap.NoSessionServer.CallFunction("GetNapiHirek","categories=1",0,me.DrawDailyNews);}}
this.SwitchTrafficChanges=function()
{me.SetTrafficChanges(!me.bTrafficChanges);me.pTopoliszMap.RemovePinBoxes("dailynews");me.pTopoliszMap.RemovePinLabels("dailynews");me.pTopoliszMap.pMarkers.DeleteAllWithType("dailynews");if(me.bTrafficChanges)
{me.pTopoliszMap.NoSessionServer.CallFunction("GetNapiHirek","categories=3",0,me.DrawDailyNews);}}
this.DrawDailyNews=function(dailynewslist,pDummy,iCommandID)
{var length=dailynewslist.length;var i=0;for(i=0;i<length;i++)
{var type="dailynews";var dX=dailynewslist[i].eovx;var dY=dailynewslist[i].eovy;var marker=new Marker(me.pTopoliszMap,type,dX,dY,null,null);marker.SetProperty("start_button",false);marker.SetProperty("through_button",false);marker.SetProperty("stop_button",false);marker.SetProperty("panorama_button",false);marker.SetProperty("pinnumber",0);marker.SetProperty("handle_details",true);marker.SetProperty("pin_css_class","markerDailyNews");marker.SetProperty("div_label_sign_class","markerDailyNews");marker.SetProperty("pin_img_url","http://utvonal.bkv.hu/napihir/public.ashx?appID=NapiHirek&Command=GetImage&id="+dailynewslist[i].signid);marker.SetProperty("pin_img_width",38);marker.SetProperty("pin_img_height",38);marker.SetProperty("pin_img_refx",20);marker.SetProperty("pin_img_refy",20);marker.SetProperty("label_dx",0);marker.SetProperty("label_dy",-9);marker.SetProperty("delete_marker_on_label_close",false);marker.SetProperty("caption",unescape(dailynewslist[i].shortdescription));marker.SetProperty("show_coordinates",me.pTopoliszMap.bDisplayCoords);var divDetails=NewTag("div");NewTextTag(unescape(dailynewslist[i].longdescription),divDetails);marker.SetProperty("details_to_show",divDetails);marker.SetProperty("fix_label_on_click",true);me.pTopoliszMap.pMarkers.Add(marker);}
me.pTopoliszMap.ZoomToPoint(19.1,47.48,10000);}
this.SwitchWeather=function()
{me.SetWeather(!me.bWeather);if(me.bWeather)
{me.pTopoliszMap.NoSessionServer.CallFunction("GetWeather","",0,me.DrawWeather);}
else
{me.pTopoliszMap.RemovePinBoxes("weather");me.pTopoliszMap.RemovePinLabels("weather");me.pTopoliszMap.pMarkers.DeleteAllWithType("weather");}}
this.DrawWeather=function(weatherlist,pDummy,iCommandID)
{if(weatherlist==null)
return;var length=weatherlist.length;var i=0;for(i=0;i<length;i++)
{var pMarker=me.pTopoliszMap.pMarkers.AddWeather(me.pTopoliszMap,weatherlist[i]);}
me.pTopoliszMap.DrawRoute();}
this.SwitchUTV=function()
{me.pTopoliszMap.SetDrawUTV(!me.pTopoliszMap.IsDrawUTV());me.RefreshDrawUTVState();}
this.RefreshDrawUTVState=function()
{if(me.cbxUTV)
{me.cbxUTV.checked=me.pTopoliszMap.IsDrawUTV();}}
this.OnTreeCheckChanged=function()
{if(me.pTopoliszMap)
{if(me.pTopoliszMap.SetPoiLayers)
{me.pTopoliszMap.SetPoiLayers(me.pPoiTree.GetCheckedIDsInStr());if(me.bUnderPoiDrawing==false)
{me.bUnderPoiDrawing=true;me.pTopoliszMap.DrawRoute();}
else
{me.bResendNeeded=true;}}}}
this.OnDrawRouteReturned=function()
{me.bUnderPoiDrawing=false;if(me.bResendNeeded==true)
{me.bResendNeeded=false;me.OnTreeCheckChanged();}}
this.ResetPoiLayers=function()
{me.pPoiBox.ResetLayerPoi();me.pTopoliszMap.SetPoiLayers("");me.pTopoliszMap.DrawRoute();}
this.SwitchTMC=function()
{me.pTopoliszMap.SetDrawTMC(!me.pTopoliszMap.Get_bDrawTMC(),false);me.RefreshDrawTMCState();}
this.RefreshDrawTMCState=function()
{if(me.cbxTMC)
{me.cbxTMC.checked=me.pTopoliszMap.Get_bDrawTMC();}}
me.Init();}

function PoiSearch(div,pTopoliszMap)
{this.div=div;this.pTopoliszMap=pTopoliszMap;this.pAddressSearch=new CAddressSearch(this.pTopoliszMap);this.pAddressSearch.SetDefaultText(g_Babel.GetWord('DefaultAddress'));this.pPOIAddressSearch=new CAddressSearch(this.pTopoliszMap);this.pPOIAddressSearch.SetDefaultText(g_Babel.GetWord('DefaultAddress'));this.iResultPerPages=10;this.iVisiblePages=5;this.OnShow=null;this.pPOIBOX=new POIBOX(null,pTopoliszMap,"searchtype");this.inputSearchPOIName="";this.inputSearchPOIType="";this.strNameDefaultText=g_Babel.GetWord('SearchByNameDefaultText');this.strTypeDefaultText=g_Babel.GetWord('SearchByTypeDefaultText');this.strPlaceDefaultText=g_Babel.GetWord('DefaultAddress');this.m_address=null;this.bZoomMode=false;this.pPoiTree=null;this.m_actPage=1;this.bPagingHappens=false;var me=this;this.Init=function()
{this.pAddressSearch.OnOK=me.OnAddressSearchOK;this.pPOIAddressSearch.OnOK=me.OnPOIAddressSearchOK;g_Babel.AddListener(me.Show);}
this.Show=function()
{while(me.div.hasChildNodes())
me.div.removeChild(me.div.firstChild);var panel=new Panel(me.div,null);panel.CreateCaption(g_Babel.GetWord('SearchAddress'),"design/ICON_home_off.gif",15,14);var inputbox=new InputBox(me.div,null);inputbox.input.value=g_Babel.GetWord('DefaultAddress');var td=inputbox.AppendIconTd();var a=NewTag('a',td);new ImgLink(a,22,22,"design/BUTTON_delete_off.gif","design/BUTTON_delete_on.gif",null,null,g_Babel.GetWord('hintDeleteAddress'),false);AddEvent(a,"click",me.ResetAddressSearch);var td=inputbox.AppendIconTd();var a=NewTag('a',td);new ImgLink(a,22,22,"design/BUTTON_display_off.gif","design/BUTTON_display_on.gif",null,null,g_Babel.GetWord('hintShowAddress'),false);AddEvent(a,"click",me.pAddressSearch.Go);me.pAddressSearch.SetInput(inputbox.input);me.pAddressSearch.SetDefaultText(g_Babel.GetWord('DefaultAddress'));var div=NewTag('div',me.div);me.pAddressSearch.SetHintDiv(div);var okbuttdiv=NewTag("div",me.div);okbuttdiv.style.textAlign="right";var a=NewTag("a",okbuttdiv);a.setAttribute('href','javascript:void(0)');a.className='UI_button_OK';AddEvent(a,"click",me.pAddressSearch.Go);var img=NewTag('img',a);SetImage(img,GetAbsUrl("design/BUTTON_ok.gif"),74,28,"OK");var panel=new Panel(me.div,null);panel.CreateCaption(g_Babel.GetWord('SearchService'),"design/ICON_info_off.gif",15,14);me.strNameDefaultText=g_Babel.GetWord('SearchByNameDefaultText');me.strTypeDefaultText=g_Babel.GetWord('SearchByTypeDefaultText');me.strPlaceDefaultText=g_Babel.GetWord('DefaultAddress');var table=NewTag('table',me.div);table.cellPadding=0;table.cellSpacing=0;table.style.width='100%';var tbody=NewTag('tbody',table);var tr=NewTag('tr',tbody);var td=NewTag('td',tr)
NewTextTag(g_Babel.GetWord('SearchByName')+":",td);var td=NewTag('td',tr)
td.colSpan=2;var inputbox=new InputBox(td,null);inputbox.input.value=me.strNameDefaultText;me.inputSearchPOIName=inputbox.input;AddEvent(inputbox.input,"focus",me.OnServiceNameFocused);AddEvent(inputbox.input,"blur",me.OnServiceNameBlured);AddEvent(inputbox.input,"keypress",me.OnServiceNameKeyPressed);var td=inputbox.AppendIconTd();var a=NewTag('a',td);var ilDelName=new ImgLink(a,22,22,"design/BUTTON_delete_off.gif","design/BUTTON_delete_on.gif",null,null,g_Babel.GetWord('hintDelete'),false);AddEvent(ilDelName.imgButton.img,"click",me.ResetInputSearchPOIName);var tr=NewTag('tr',tbody);var td=NewTag('td',tr)
NewTextTag(g_Babel.GetWord('SearchByPlace')+":",td);var td=NewTag('td',tr)
td.colSpan=2;var inputbox=new InputBox(td,null);inputbox.input.value=me.strPlaceDefaultText;me.pPOIAddressSearch.SetInput(inputbox.input);var div=NewTag('div',td);me.pPOIAddressSearch.SetHintDiv(div);var td=inputbox.AppendIconTd();var a=NewTag('a',td);var ilDelPlace=new ImgLink(a,22,22,"design/BUTTON_delete_off.gif","design/BUTTON_delete_on.gif",null,null,g_Babel.GetWord('hintDelete'),false);AddEvent(ilDelPlace.imgButton.img,"click",me.ResetInputSearchPOIPlace);var tr=NewTag('tr',tbody);var td2=NewTag('td',tr)
NewTextTag(g_Babel.GetWord('SearchByType')+":",td2);var td=NewTag('td',tr)
var divPoiType=NewTag('div',td);td.colSpan=2;me.FillTree(divPoiType);var tr=NewTag('tr',tbody);var td=NewTag('td',tr);NewTextTag('\u00a0',td);var td=NewTag('td',tr);var txtBtn=new TextButton(td);var img=txtBtn.CreateImage(14,14,"design/icon_delete_off.gif","design/icon_delete_on.gif",null,null,false);img.style.paddingRight="8px";var a=txtBtn.CreateText(g_Babel.GetWord('capNewSearch'));txtBtn.OnClick=me.ResetSearch;var td=NewTag('td',tr);td.style.textAlign="right";var submitdiv=td;var a=NewTag("a",td);a.setAttribute('href','javascript:void(0)');a.className='UI_button_OK';AddEvent(a,"click",me.StartSearching);var img=NewTag('img',a);SetImage(img,GetAbsUrl("design/BUTTON_ok.gif"),74,28,"OK");var div=NewTag('div',me.div);me.pPOIBOX.SetDiv(div);me.pPOIBOX.Show();}
this.OnServiceNameKeyPressed=function()
{var str=me.pPoiTree.GetCheckedIDsInStr();if(str==null||str.length<1)
me.pPoiTree.arrItems[0].SetChecked(true);}
this.FillTree=function(div)
{if(g_arrPoiTypes!=null)
{var arrTreeItems=new Array();var bAllPoisOnMap=true;for(var i=0;i<g_arrPoiTypes.length;i++)
{var pType=g_arrPoiTypes[i];var label=g_Babel.GetWord("poi"+pType.iID);if(g_arrPoiTypes[i].iCount>0)
label+=" ("+g_arrPoiTypes[i].iCount+")";arrTreeItems[arrTreeItems.length]=new CTreeItem(pType.iID,label,pType.iLevel,pType.bOnMap,false,pType.bShowInTree);if(!pType.bOnMap)
bAllPoisOnMap=false;}
arrTreeItems[0].SetChecked(bAllPoisOnMap);me.pPoiTree=new CTree(div,arrTreeItems);me.pPoiTree.OnCheckChanged=function(){me.OnTreeCheckChanged()};me.pPoiTree.Show();me.pPoiTree.arrItems[0].Open();}}
this.OnTreeCheckChanged=function()
{}
this.StartSearching=function()
{if((me.pPOIAddressSearch.input.value==me.strPlaceDefaultText)&&(me.inputSearchPOIName.value==me.strNameDefaultText))
{me.bZoomMode=false;me.OnPOIAddressSearchOK();}
else
{me.bZoomMode=true;if(me.pPOIAddressSearch.input.value==me.strPlaceDefaultText)
me.pPOIAddressSearch.input.value="Magyarország";me.pPOIAddressSearch.Go();}}
this.OnServiceNameFocused=function()
{if(me.inputSearchPOIName.value==me.strNameDefaultText)
{me.inputSearchPOIName.value="";}}
this.OnServiceNameBlured=function()
{if(me.inputSearchPOIName.value=="")
{me.inputSearchPOIName.value=me.strNameDefaultText;}}
this.OnServiceTypeFocused=function()
{if(me.inputSearchPOIType.value==me.strTypeDefaultText)
{me.inputSearchPOIType.value="";}}
this.OnServiceTypeBlured=function()
{if(me.inputSearchPOIType.value=="")
{me.inputSearchPOIType.value=me.strTypeDefaultText;}}
this.ResetInputSearchPOIName=function()
{me.inputSearchPOIName.value=me.strNameDefaultText;}
this.ResetInputSearchPOIType=function()
{me.inputSearchPOIType.value=me.strTypeDefaultText;}
this.ResetInputSearchPOIPlace=function()
{me.pPOIAddressSearch.input.value=me.strPlaceDefaultText;}
this.ResetSearch=function()
{me.ResetInputSearchPOIName();me.ResetInputSearchPOIType();me.ResetInputSearchPOIPlace();me.pPOIBOX.Hide();me.pTopoliszMap.pMarkers.DeleteAllWithType("findpoi");me.pTopoliszMap.RemovePinBoxes("findpoi");if(g_TopoliszControls.pPOILAYERBOX)
g_TopoliszControls.pPOILAYERBOX.DeselectPOI();me.pTopoliszMap.RemovePinLabels("findpoi");me.pPoiTree.Reset();me.pPoiTree.arrItems[0].Open();me.pPoiTree.arrItems[0].SetChecked(false);}
this.ResetAddressSearch=function()
{me.pAddressSearch.SetInputValue("");me.pTopoliszMap.pMarkers.DeleteAllWithType("searching");me.pTopoliszMap.RemovePinLabels("searching");}
this.OnAddressSearchOK=function()
{var address=me.pAddressSearch.GetAddress();if(address)
{me.pTopoliszMap.OnNewFoundAddress(address,"searching");if(address.dMinX>0&&address.dMinY>0&&address.dMaxX>0&&address.dMaxY>0&&address.dMinX!=address.dMaxX&&address.dMinY!=address.dMaxY)
me.pTopoliszMap.ZoomToRect(address.dMinX,address.dMinY,address.dMaxX,address.dMaxY);else if(address.dX>0&&address.dY>0)
me.pTopoliszMap.ZoomToPoint(address.dX,address.dY,250);}}
this.OnPOISearchEnded=function(result)
{me.pTopoliszMap.pMarkers.DeleteAllWithType("findpoi");me.pTopoliszMap.RemovePinBoxes("findpoi");if(g_TopoliszControls.pPOILAYERBOX)
g_TopoliszControls.pPOILAYERBOX.DeselectPOI();me.pTopoliszMap.RemovePinLabels("findpoi");me.pLastResults=result;var j;for(j=0;j<Math.min(result.arrRecords.length,me.iResultPerPages);j++)
{var record=result.arrRecords[j];var type="findpoi";var dX=record.dX;var dY=record.dY;var arrNames=record.arrNames;var arrValues=record.arrValues;var marker=new Marker(me.pTopoliszMap,type,dX,dY,arrNames,arrValues);marker.SetProperty("nTypeID",record.nTypeID);marker.SetProperty("start_button",me.pTopoliszMap.bLabelHasStartButton);marker.SetProperty("through_button",me.pTopoliszMap.bLabelHasThroughButton);marker.SetProperty("stop_button",me.pTopoliszMap.bLabelHasStopButton);marker.SetProperty("panorama_button",me.pTopoliszMap.bLabelHasPanoramaButton);marker.SetProperty("pinnumber",j+1);marker.SetProperty("handle_details",true);marker.SetProperty("pin_css_class","markerRed");marker.SetProperty("div_label_sign_class","marker");if(record.iImageID>1)
{marker.SetProperty("pin_img_url","?Command=GetImage&id="+record.iImageID+"&appID="+g_strAppID);}
else
{}
if(record.iImageID>1||record.iListPriority>0)
{marker.SetProperty("label_css_classname",marker.GetProperty("label_css_classname")+" priority_label");marker.SetProperty("list_css_classname",marker.GetProperty("list_css_classname")+" priority_label");}
marker.SetProperty("pin_img_refx",0);marker.SetProperty("pin_img_refy",9);marker.SetProperty("delete_marker_on_label_close",false);marker.SetProperty("caption",arrValues[0]);marker.SetProperty("show_coordinates",me.pTopoliszMap.bDisplayCoords);marker.SetProperty("label_dx",0);marker.SetProperty("label_dy",-9);var divDetails=NewTag("div");divDetails.innerHTML+=g_Babel.GetWord("PoiType")+" = "+g_Babel.GetWord("poi"+record.nTypeID);var i=1;for(i=1;i<arrNames.length;i++)
{var listPoiPropertyNames=["Cím","Telefon","Fax","Email","Web","Nyitva"];if(listPoiPropertyNames.indexOf(arrNames[i])!=-1)
divDetails.innerHTML+="<br/>"+arrNames[i]+" = "+arrValues[i];}
marker.SetProperty("details_to_show",divDetails);marker.SetProperty("fix_label_on_click",true);me.pTopoliszMap.pMarkers.Add(marker);}
var address=me.m_address;if(address)
{if(address.dMinX>0&&address.dMinY>0&&address.dMaxX>0&&address.dMaxY>0&&address.dMinX!=address.dMaxX&&address.dMinY!=address.dMaxY)
me.pTopoliszMap.ZoomToRect(address.dMinX,address.dMinY,address.dMaxX,address.dMaxY);else if(address.dX>0&&address.dY>0)
me.pTopoliszMap.ZoomToPoint(address.dX,address.dY,250);}
else
me.pTopoliszMap.ZoomToDefault();if(me.pPOIBOX.pPager!=null)
{me.pPOIBOX.pPager.Clear();delete me.pPOIBOX.pPager;me.pPOIBOX.pPager=null;}
if(result.arrRecords.length==0)
{me.pPOIBOX.WriteNoResultMessage();}
else
{var pPager=me.pPOIBOX.CreatePager(result.iFirst,result.iFirst+result.arrRecords.length-1,result.bHasNextPage,me.iResultPerPages,me.iVisiblePages);pPager.OnPageChange=me.PagingHandler;pPager.OnNextPages=me.NextPageHandler;pPager.OnPreviousPages=me.PreviousPageHandler;me.pPOIBOX.Unhide();}
window.setTimeout(function(){var divMap=GetBlock("idMap");if(divMap)window.scrollTo(0,GetAbsLayerTop(divMap));},1000);}
this.OnPOIAddressSearchOK=function()
{var strParams="strFilter="+me.GetNameFilter()+"&strType="+"#"+me.GetType()+"&iFirst="+0+"&iLast="+(me.iResultPerPages*me.iVisiblePages);if(me.bZoomMode==true)
{address=me.pPOIAddressSearch.GetAddress();}
else
{address=new CAddress();address.dMinX=me.pTopoliszMap.arrStates[me.pTopoliszMap.iActiveState].dMinX;address.dMinY=me.pTopoliszMap.arrStates[me.pTopoliszMap.iActiveState].dMinY;address.dMaxX=me.pTopoliszMap.arrStates[me.pTopoliszMap.iActiveState].dMaxX;address.dMaxY=me.pTopoliszMap.arrStates[me.pTopoliszMap.iActiveState].dMaxY;}
me.m_address=address;{strParams+="&dMinX="+address.dMinX+"&dMinY="+address.dMinY+"&dMaxX="+address.dMaxX+"&dMaxY="+address.dMaxY;if(me.OnShow)
{try{me.OnShow(me,address);}
catch(exp){if(me.pTopoliszMap.OnError)
me.pTopoliszMap.OnError(exp,'{PoiSearch.OnPOIAddressSearchOK');}}}
me.pTopoliszMap.NoSessionServer.CallFunction('SearchPoi',strParams,0,me.OnPOISearchEnded);}
this.PagingHandler=function(iPage)
{if(me.bPagingHappens==true)
return;me.m_actPage=iPage;me.pTopoliszMap.pMarkers.DeleteAllWithType("findpoi");me.pTopoliszMap.RemovePinBoxes("findpoi");me.pTopoliszMap.RemovePinLabels("findpoi");if(g_TopoliszControls.pPOILAYERBOX)
g_TopoliszControls.pPOILAYERBOX.DeselectPOI();var iStartPageNumber=me.pPOIBOX.pPager.iStartPageNumber;var j;var iSer=0;for(j=me.iResultPerPages*(iPage-iStartPageNumber);j<Math.min(me.pLastResults.arrRecords.length,me.iResultPerPages*(iPage-iStartPageNumber+1));j++)
{var record=me.pLastResults.arrRecords[j];var dX=record.dX;var dY=record.dY;var arrNames=record.arrNames;var arrValues=record.arrValues;var type="findpoi";var marker=new Marker(me.pTopoliszMap,type,dX,dY,arrNames,arrValues);marker.SetProperty("start_button",me.pTopoliszMap.bLabelHasStartButton);marker.SetProperty("through_button",me.pTopoliszMap.bLabelHasThroughButton);marker.SetProperty("stop_button",me.pTopoliszMap.bLabelHasStopButton);marker.SetProperty("panorama_button",me.pTopoliszMap.bLabelHasPanoramaButton);marker.SetProperty("pinnumber",(iStartPageNumber-1)*me.iResultPerPages+j+1);marker.SetProperty("handle_details",true);marker.SetProperty("pin_css_class","markerRed");marker.SetProperty("div_label_sign_class","marker");if(record.iImageID>1)
{marker.SetProperty("pin_img_url","?Command=GetImage&id="+record.iImageID+"&appID="+g_strAppID);}
if(record.iImageID>1||record.iListPriority>0)
{marker.SetProperty("label_css_classname",marker.GetProperty("label_css_classname")+" priority_label");marker.SetProperty("list_css_classname",marker.GetProperty("list_css_classname")+" priority_label");}
marker.SetProperty("delete_marker_on_label_close",false);marker.SetProperty("caption",arrValues[0]);marker.SetProperty("show_coordinates",me.pTopoliszMap.bDisplayCoords);marker.SetProperty("label_dx",0);marker.SetProperty("label_dy",-9);var divDetails=NewTag("div");divDetails.innerHTML+=g_Babel.GetWord("PoiType")+" = "+g_Babel.GetWord("poi"+record.nTypeID);var i=1;for(i=1;i<arrNames.length;i++)
{var listPoiPropertyNames=["Cím","Telefon","Fax","Email","Web","Nyitva"];if(listPoiPropertyNames.indexOf(arrNames[i])!=-1)
divDetails.innerHTML+="<br/>"+arrNames[i]+" = "+arrValues[i];}
marker.SetProperty("details_to_show",divDetails);me.pTopoliszMap.pMarkers.Add(marker);marker.SetProperty("fix_label_on_click",true);iSer++;}
var address=me.m_address;if(address)
{if(address.dMinX>0&&address.dMinY>0&&address.dMaxX>0&&address.dMaxY>0&&address.dMinX!=address.dMaxX&&address.dMinY!=address.dMaxY)
me.pTopoliszMap.ZoomToRect(address.dMinX,address.dMinY,address.dMaxX,address.dMaxY);else if(address.dX>0&&address.dY>0)
me.pTopoliszMap.ZoomToPoint(address.dX,address.dY,250);}
else
me.pTopoliszMap.ZoomToDefault();me.pPOIBOX.pPager.m_actPageNum=me.m_actPage;me.pPOIBOX.pPager.Create();}
this.NextPageHandler=function()
{if(me.bPagingHappens==true)
return;var iStartPageNumber=me.pPOIBOX.pPager.iStartPageNumber+1;var strParams="strFilter="+me.GetNameFilter()
+"&strType="+"#"+me.GetType()
+"&iFirst="+(me.iResultPerPages*(iStartPageNumber-1))+"&iLast="+(me.iResultPerPages*(iStartPageNumber-1+me.iVisiblePages));var address=me.m_address;if(address)
{strParams+="&dMinX="+address.dMinX+"&dMinY="+address.dMinY
+"&dMaxX="+address.dMaxX+"&dMaxY="+address.dMaxY;}
me.pTopoliszMap.NoSessionServer.CallFunction('SearchPoi',strParams,address,me.OnPreviousOrNextPageEnded);me.m_actPage++;}
this.PreviousPageHandler=function()
{if(me.bPagingHappens==true)
return;var iStartPageNumber=me.pPOIBOX.pPager.iStartPageNumber-1;if(iStartPageNumber>0)
{var strParams="strFilter="+me.GetNameFilter()
+"&strType="+"#"+me.GetType()
+"&iFirst="+(me.iResultPerPages*(iStartPageNumber-1))+"&iLast="+(me.iResultPerPages*(iStartPageNumber-1+me.iVisiblePages));var address=me.m_address;if(address)
{strParams+="&dMinX="+address.dMinX+"&dMinY="+address.dMinY
+"&dMaxX="+address.dMaxX+"&dMaxY="+address.dMaxY;}
me.pTopoliszMap.NoSessionServer.CallFunction('SearchPoi',strParams,address,me.OnPreviousOrNextPageEnded);}
me.m_actPage--;}
this.OnPreviousOrNextPageEnded=function(result)
{me.bPagingHappens=false;me.pLastResults=result;me.pPOIBOX.pPager.Clear();var iStartPageNumber=Math.floor(result.iFirst/me.iResultPerPages)+1;var iEndPageNumber=Math.floor((result.iFirst+result.arrRecords.length)/me.iResultPerPages)+1;var iPagesNumber=iEndPageNumber;if(result.bHasNextPage)iPagesNumber=iPagesNumber+1;me.pPOIBOX.pPager.iStartPageNumber=iStartPageNumber;me.pPOIBOX.pPager.iPagesNumber=iPagesNumber;me.pPOIBOX.pPager.Create();me.PagingHandler(me.m_actPage);}
this.SetPOIBOX=function(pPOIBOX)
{me.pPOIBOX=pPOIBOX;}
this.OnResetObjectSearch=function()
{me.pTopoliszMap.RemovePinLabels("findpoi");me.Reset();me.pPOIBOX.ResetFindPoi();}
this.OnStartObjectSearch=function()
{me.pPOIAddressSearch.Go();}
this.OnKeyPress=function(pEvent)
{if(pEvent==null)
pEvent=window.event;if(pEvent.keyCode==13)
{me.OnStartObjectSearch();}}
this.GetNameFilter=function()
{return me.GetInputText(me.inputSearchPOIName,me.strNameDefaultText);}
this.GetType=function()
{if(me.pPoiTree.arrItems[0].IsChecked())
return"0";else
return me.pPoiTree.GetCheckedIDsInStr()}
this.GetInputText=function(input,strDefaultText)
{if(!input||input.value==strDefaultText)
return"";return input.value;}
this.Hide=function()
{Hide(me.div);}
this.Unhide=function()
{Show(me.div);}
this.Init();}

function CUtvonaltervRouteResult(div,pTopoliszMap)
{this.divMain=div;this.divTotal=null;this.tableItinerList=null;this.pTopoliszMap=pTopoliszMap;if(this.pTopoliszMap!=null)
this.pTopoliszMap.pTextResult=this;this.pRouteSearch=null;this.arrRoutes=[];this.pRoute=null;this.iActiveAlt=0;this.arrSortColumns=["iAlternative","dtStart","dtStop","iTravelSeconds","iRunChanges"];this.strSort="iAlternative";this.iSortDir=1;this.iColCount=4;this.iMaxAlternatives=1;this.iStartOrder=0;this.iAltDiffStepHour=1;this.iAltDifferenceBeforeHour=-this.iAltDiffStepHour;this.iAltDifferenceAfterHour=+this.iAltDiffStepHour;this.strTrafficTime="";this.BannerBox=function(strPictureUrl,strLinkUrl)
{this.strPictureUrl=strPictureUrl;this.strLinkUrl=strLinkUrl;this.strFlashUrl=strPictureUrl;this.iMinX=0;this.iMinY=0;this.iMaxX=0;this.iMaxY=0;this.arrDivsDisplayArea=[];this.arrSpansDontHide=[];this.strBgColor=null;this.div=null;var me=this;this.AddDisplayArea=function(td)
{if(me.iMinX==0&&me.iMaxX==0)
{me.iMinX=GetAbsLayerLeft(td);me.iMaxX=GetAbsLayerRight(td);}
else
{me.iMinX=Math.min(GetAbsLayerLeft(td),me.iMinX);me.iMaxX=Math.max(GetAbsLayerRight(td),me.iMaxX);}
if(me.iMinY==0&&me.iMaxY==0)
{me.iMinY=GetAbsLayerTop(td)+2;me.iMaxY=GetAbsLayerBottom(td);}
else
{me.iMinY=Math.min(GetAbsLayerTop(td)+2,me.iMinY);me.iMaxY=Math.max(GetAbsLayerBottom(td),me.iMaxY);}}
this.AddDontHideArea=function(span)
{if(GetAbsLayerLeft(span)<(me.iMinX+me.iMaxX)/2)
me.iMinX=Math.max(GetAbsLayerRight(span),me.iMinX);else
me.iMaxX=Math.min(GetAbsLayerLeft(span),me.iMaxX);}
this.ComputeMinMax=function()
{for(var i=0;i<me.arrDivsDisplayArea.length;i++)
{me.AddDisplayArea(me.arrDivsDisplayArea[i]);}
for(var i=0;i<me.arrSpansDontHide.length;i++)
{me.AddDontHideArea(me.arrSpansDontHide[i]);}}
this.Show=function(divParent)
{if(me.iMinX<me.iMaxX&&me.iMinY<me.iMaxY)
{var iBaseX=GetAbsLayerLeft(divParent);var iBaseY=GetAbsLayerTop(divParent);var div=NewTag('div',divParent);div.className="noprint";div.style.position="absolute";div.style.textAlign="right";div.style.left=(-iBaseX+me.iMinX)+"px";div.style.top=(-iBaseY+me.iMinY)+"px";div.style.width=(me.iMaxX-me.iMinX)+"px";div.style.height=(me.iMaxY-me.iMinY)+"px";var a;if(me.strLinkUrl!=null)
{a=NewTag('a',div);a.setAttribute("href",me.strLinkUrl);a.setAttribute("target","_blank");}
else
a=NewTag('span',div);if(me.strPictureUrl.toLowerCase().lastIndexOf(".swf")>0)
{var flash=NewFlash(me.strPictureUrl,Math.min(400,me.iMaxX-me.iMinX),Math.min(50,me.iMaxY-me.iMinY),a);}
else
{var img=NewTag('img',a);SetImage(img,me.strPictureUrl,Math.min(400,me.iMaxX-me.iMinX),Math.min(50,me.iMaxY-me.iMinY),"");}
me.div=div;if(me.strBgColor!=null)
{for(var i=0;i<me.arrDivsDisplayArea.length;i++)
{var div2=me.arrDivsDisplayArea[i];div2.style.backgroundColor=me.strBgColor;}}}}
this.Clear=function()
{if(me.strBgColor!=null)
{for(var i=0;i<me.arrDivsDisplayArea.length;i++)
{var div2=me.arrDivsDisplayArea[i];div2.style.backgroundColor="";}}
if(me.div&&me.div.parentNode)
{me.div.parentNode.removeChild(me.div);me.div=null;}
me.ClearParentArea();}
this.ClearParentArea=function()
{me.iMinX=me.iMinY=me.iMaxX=me.iMaxY=0;me.arrDivsDisplayArea=[];me.arrSpansDontHide=[];}
this.AddParentArea=function(tdDisplay,spanDontHide)
{me.arrDivsDisplayArea[me.arrDivsDisplayArea.length]=tdDisplay;me.arrSpansDontHide[me.arrSpansDontHide.length]=spanDontHide;}
this.AlignLeft=function(pBanner)
{me.iMinX=pBanner.iMinX=Math.max(me.iMinX,pBanner.iMinX);}}
this.Banner=function(dateFrom,dateTo,pStartBox,pStopBox,strAVCode,strBgColor)
{this.dateFrom=(dateFrom!=null?dateFrom:new Date(2000,0,22));this.dateTo=(dateTo!=null?dateTo:new Date(2020,0,23));this.pStartBox=pStartBox;this.pStartBox.strBgColor=strBgColor;this.pStopBox=pStopBox;this.pStopBox.strBgColor=strBgColor;this.strAVCode=strAVCode;this.strBgColor=strBgColor;var me=this;this.Show=function(divParent)
{if(me.pStartBox&&me.pStopBox)
{eval(me.strAVCode);me.pStartBox.ComputeMinMax();me.pStopBox.ComputeMinMax();me.pStartBox.AlignLeft(me.pStopBox);me.pStartBox.Show(divParent);me.pStopBox.Show(divParent);}}
this.Clear=function()
{me.pStartBox.Clear();me.pStopBox.Clear();}}
this.bShowStartStopBanners=true;this.arrStartStopBanners=[new this.Banner(new Date(2010,4,24),new Date(2010,5,2),new this.BannerBox("images/banners/n97mini-400x50-siin-upper.swf",null),new this.BannerBox("images/banners/n97mini-400x50-siin-lower.swf"),'$("#idRouteResult").append(\'<A HREF="http://ad-emea.doubleclick.net/jump/N5390.156550.UTVONALTERV.HU/B4514538.2;sz=1x1;ord=[timestamp]?"><IMG SRC="http://ad-emea.doubleclick.net/ad/N5390.156550.UTVONALTERV.HU/B4514538.2;sz=1x1;ord=[timestamp]?" BORDER=0 WIDTH=1 HEIGHT=1 ALT="Click Here"></A>\');',"#25a3ed")];var me=this;this.OnShow=null;this.Init=function()
{}
this.GetDiv=function()
{return me.divMain;}
this.SetMap=function(pTopoliszMap)
{me.pTopoliszMap=pTopoliszMap;me.pTopoliszMap.pTextResult=me;}
this.IsCarSub=function(routeSub)
{return me.pRouteSearch.IsCarString(routeSub.strVehicleType);}
this.IsTaxiSub=function(routeSub)
{return me.pRouteSearch.IsTaxiString(routeSub.strVehicleType);}
this.IsBicycleSub=function(routeSub)
{return me.pRouteSearch.IsBicycleString(routeSub.strVehicleType);}
this.IsCar=function()
{return me.pRoute&&me.pRouteSearch.IsCarString(me.pRoute.strTrafficType);}
this.IsTaxi=function()
{return me.pRoute&&me.pRouteSearch.IsTaxiString(me.pRoute.strTrafficType);}
this.IsPublicTransport=function()
{if(me.pRoute&&me.pRoute.strTrafficType)
{return me.pRouteSearch.IsPublicTransportString(me.pRoute.strTrafficType);}
return false;}
this.CalcRunChanges=function(pRoute)
{var iChanges=-1;for(var iMain=0;iMain<pRoute.arrMains.length;iMain++)
{var pMain=pRoute.arrMains[iMain];for(var iSub=0;iSub<pMain.arrSubs.length;iSub++)
{var pSub=pMain.arrSubs[iSub];if(pSub.arrPTRuns.length>0)
iChanges++;}}
pRoute.iRunChanges=iChanges;return iChanges;}
this.ShowChangeData=function(tdParent,pRoute)
{var iChanges=-1;for(var iMain=0;iMain<pRoute.arrMains.length;iMain++)
{var pMain=pRoute.arrMains[iMain];for(var iSub=0;iSub<pMain.arrSubs.length;iSub++)
{var pSub=pMain.arrSubs[iSub];if(pSub.arrPTRuns.length>0)
{iChanges++;if(iChanges>0)
{var img=NewTag('img',tdParent);img.className="UI_itinerlist_change";SetImage(img,GetAbsUrl("design/ICON_PTChange.gif"),17,13,"->");}
var pRun=pSub.arrPTRuns[0];if(pRun.bShowName&&!pRun.bShowDescription)
{var span=NewTag('span',tdParent);span.className=pRun.strClass;NewTextTag(pRun.strName,span);}
else
{var strImage=me.GetVehicleTypeImage(pRun.iVehicleTypeID);if(strImage!="")
{var img=NewTag('img',tdParent);img.className="UI_itinerlist_icon";SetImage(img,"design/"+strImage,35,25);}}}}}}
this.ConvertToMinutes=function(strTime)
{var iPos=strTime.indexOf(':');if(iPos>=0)
{var iHours=parseInt(strTime.substr(0,iPos));var iMinutes=parseInt(strTime.substr(iPos+1));return 60*iHours+iMinutes;}
return strTime;}
this.RouteCompare=function(route1,route2)
{var value1=eval('route1.'+me.strSort);var value2=eval('route2.'+me.strSort);if(me.strSort=="dtStart"||me.strSort=="dtStop")
{value1=me.ConvertToMinutes(value1);value2=me.ConvertToMinutes(value2);}
var iRetval=0;if(value1<value2)
iRetval=-1;else if(value1>value2)
iRetval=+1;if(me.iSortDir<0)
iRetval=iRetval*-1;return iRetval;}
this.SortColumn=function(iCol,iDir)
{me.strSort=me.arrSortColumns[iCol];me.iSortDir=iDir;me.arrRoutes.sort(me.RouteCompare);me.Show();}
this.ShowItinerList=function(divParent)
{var colorPanel=new ColorPanel(divParent);var table=NewTag('table',colorPanel.td);table.setAttribute('border',"0");table.style.marginTop="0px";table.style.marginBottom="10px";table.className='UI_panel'
table.cellPadding=0;table.cellSpacing=0;table.style.width="100%";me.tableItinerList=table;tbody=NewTag('tbody',table);var tr=NewTag('tr',tbody);tr.className="UI_itinerlist_header";var th=NewTag('th',tr);th.style.fontSize="12px";th.colSpan=6;th.style.padding="10px";NewTextTag("ÚTVONALAJÁNLATOK A MEGADOTT INDULÁSI IDŐ SZERINT",th);var div=NewTag('div',th);div.className="noprint";div.style.fontWeight="normal";div.style.fontSize="10px";NewTextTag("(az oszlopok mellett lévő nyilakra kattintva rendezheti a találatokat)",div);var MakeColumn=function(tr,strText)
{var iCol=tr.childNodes.length;var th=NewTag('th',tr);th.className="UI_itinerlist";NewTextTag(strText,th);NewTag('br',th);var a=NewTag('a',th);a.className="noprint";a.setAttribute('href','javascript:void(0)');AddEvent(a,"click",function(){me.SortColumn(iCol,+1);});if(me.iSortDir>0&&me.arrSortColumns[iCol]==me.strSort)
{var img=NewTag('img',a);SetImage(img,"images/trafficctrl/triangle_up_act.gif",10,5,"Növekvő rendezés");}
else
{new ImgLink(a,10,5,"images/trafficctrl/triangle_up.gif","images/trafficctrl/triangle_up_act.gif",null,null,"Növekvő rendezés",false);}
a=NewTag('a',th);a.className='noprint';a.setAttribute('href','javascript:void(0)');AddEvent(a,"click",function(){me.SortColumn(iCol,-1);});if(me.iSortDir<0&&me.arrSortColumns[iCol]==me.strSort)
{var img=NewTag('img',a);SetImage(img,"images/trafficctrl/triangle_down_act.gif",10,5,"Csökkenő rendezés");}
else
{new ImgLink(a,10,5,"images/trafficctrl/triangle_down.gif","images/trafficctrl/triangle_down_act.gif",null,null,"Csökkenő rendezés",false);}
return th;}
var CreateLinkCell=function(tr,iAlt)
{var td=NewTag('td',tr);td.className="UI_itinerlist_last";var a=NewTag('a',td);a.setAttribute('href','javascript:void(0)');NewTextTag(g_Babel.GetWord('Details'),a);AddEvent(a,"click",function()
{var divPage=$("div.DetailedPTItiner").get(0);if(divPage)
window.scrollTo(0,GetAbsLayerTop(divPage));me.SwitchItiner(iAlt);});return td;}
var CreateCell=function(tr,iAlt)
{var td=NewTag('td',tr);td.className="UI_itinerlist";AddEvent(td,"click",function(){me.SwitchItiner(iAlt);});return td;}
tr=NewTag('tr',tbody);tr.className="UI_itinerlist_header";if(screen.width>300)
{MakeColumn(tr,"Útvonal");MakeColumn(tr,"Indulás");MakeColumn(tr,"Érkezés");MakeColumn(tr,"Menetidő");th=MakeColumn(tr,"Átszállás");}
else
{MakeColumn(tr,"Ssz");MakeColumn(tr,"Ind");MakeColumn(tr,"Érk");MakeColumn(tr,"Idő");th=MakeColumn(tr,"Jármű");}
th=NewTag('th',tr);th.className="UI_itinerlist_last";NewTextTag('\u00a0',th);var arrayOrdered=[];me.ShowMakeAltRow(tbody,me.iAltDifferenceBeforeHour);for(var iAlt=0;iAlt<me.arrRoutes.length;iAlt++)
{tr=NewTag('tr',tbody);tr.className="UI_itinerlist";var pRoute=me.arrRoutes[iAlt];if(me.arrRoutes.length>1)
{arrayOrdered[iAlt]=pRoute;if(pRoute==me.pRoute)
{$(tr).addClass("UI_itinerlist_active");}
$(tr).hover(function()
{$(this).addClass("UI_itinerlist_hover");},function()
{$(this).removeClass("UI_itinerlist_hover");});}
td=CreateCell(tr,pRoute.iAlternative);$(td).addClass("PTRoute_Alternative");NewTextTag((pRoute.iAlternative+1)+".",td);td=CreateCell(tr,pRoute.iAlternative);NewTextTag(pRoute.dtStart,td);td=CreateCell(tr,pRoute.iAlternative);NewTextTag(pRoute.dtStop,td);td=CreateCell(tr,pRoute.iAlternative);NewTextTag(me.GetTimeText(pRoute.iTravelSeconds),td);td=CreateCell(tr,pRoute.iAlternative);me.ShowChangeData(td,pRoute);CreateLinkCell(tr,pRoute.iAlternative);}
me.ShowMakeAltRow(tbody,me.iAltDifferenceAfterHour);this.CreateAlternativeQualifier("<div>Leggyorsabb</div>",function(pRoute){return pRoute.iTravelSeconds;});this.CreateAlternativeQualifier("<div>Legrövidebb</div>",function(pRoute){return pRoute.iLength;});this.CreateAlternativeQualifier("<div>Legkevesebb átszállás</div>",function(pRoute){return pRoute.iRunChanges;});this.CreateAlternativeQualifier("<div>Legkevesebb gyaloglás</div>",function(pRoute){return me.GetFootDistanceAndTime(pRoute,-1,-1).iLength;});this.CreateAlternativeQualifier("<div>Legkevesebb várakozás</div>",function(pRoute){return me.GetWaitingTime(pRoute,-1,-1);});}
this.CreateAlternativeQualifier=function(divQualifier,funcGetValue)
{var sorter=function(o1,o2){return o1.iValue-o2.iValue;};var arrayOrdered=[];for(var i=0;i<me.arrRoutes.length;i++)
{var pRoute=me.arrRoutes[i];if(pRoute!=null)
arrayOrdered[arrayOrdered.length]={iID:pRoute.iAlternative,iValue:funcGetValue(pRoute)};}
arrayOrdered.sort(sorter);if(arrayOrdered[0].iValue!=arrayOrdered[arrayOrdered.length-1].iValue)
{for(var i=0;i<arrayOrdered.length;i++)
{if(arrayOrdered[i].iValue==arrayOrdered[0].iValue)
{$(".PTRoute_Alternative:contains("+(arrayOrdered[i].iID+1)+".)").append(divQualifier);}}}}
this.ShowMakeAltRow=function(tbody,iDiffHour)
{tr=NewTag('tr',tbody);tr.className="UI_itinerlist noprint";td=NewTag('td',tr);td.className="UI_itinerlist";NewTextTag("\u00a0",td);td=NewTag('td',tr);td.className="UI_itinerlist";var a=NewTag('a',td);a.setAttribute('href','javascript:void(0)');AddEvent(a,"click",function(){me.FindAltRoute(iDiffHour);});NewTextTag(Math.abs(iDiffHour),a);if(iDiffHour<0)
NewTextTag(' órával előbb',a);else
NewTextTag(' órával később',a);td=NewTag('td',tr);a=NewTag('a',td);a.setAttribute('href','javascript:void(0)');AddEvent(a,"click",function(){me.FindAltRoute(iDiffHour);});td.className="UI_itinerlist_last";td.colSpan=4;NewTextTag("Kattintson ide a kiszámításhoz!",a);}
this.FindAltRoute=function(iDiffHour)
{var strParams="iDiffHour="+iDiffHour;var tr,td;if(iDiffHour<0)
tr=me.tableItinerList.firstChild.childNodes[2];else
tr=me.tableItinerList.firstChild.lastChild;var td=tr.lastChild;while(td.firstChild)
td.removeChild(td.firstChild);var div=NewTag('div',td);div.className='UI_routingprogress';var tt=NewTextTag(g_Babel.GetWord("capRoutingInProgress"),div);me.pTopoliszMap.InciServer.CallFunction("FindAltRoute",strParams,0,me.FillAltRoute,iDiffHour);}
this.SetAltRoute=function(iAlt)
{if(me.arrRoutes!=null)
{if(iAlt>=0&&iAlt<me.arrRoutes.length)
{var tr=null;if(me.tableItinerList)
{tr=me.tableItinerList.firstChild.firstChild;tr=tr.nextSibling;tr=tr.nextSibling;tr=tr.nextSibling;}
for(var i=0;i<me.arrRoutes.length;i++)
{if(me.arrRoutes[i].iAlternative==iAlt)
{me.pRoute=me.arrRoutes[iAlt];me.iActiveAlt=iAlt;if(tr)
{$(tr).addClass("UI_itinerlist_active");}
else
break;}
else if(tr)
{$(tr).removeClass("UI_itinerlist_active");}
if(tr)
tr=tr.nextSibling;}
if(me.tableItinerList)
me.ShowTotal();me.ShowPTChangesOnMap();me.pTopoliszMap.InciServer.CallFunction("SetAltRoute","iAlt="+iAlt,0,me.pTopoliszMap.DrawRoute,null);}}}
this.SwitchItiner=function(iAlternative)
{if(iAlternative!=me.iActiveAlt)
{me.HideStartStopBanners();me.SetAltRoute(iAlternative);k=$("div.DetailedPTItiner").fadeOut(1000,me.SwitchItinerAnimateCallback);}}
this.SwitchItinerAnimateCallback=function()
{$("table.UI_itinerary").remove();jqDiv=$("div.DetailedPTItiner");var divP=jqDiv.get()[0];me.ShowItiner(me.pRoute,divP);jqDiv.fadeIn(500);}
this.Show=function()
{if(me.divMain)
{while(me.divMain.firstChild){me.divMain.removeChild(me.divMain.firstChild);}
me.divMain.style.position="relative";var divNoPrint=NewTag('div',me.divMain);divNoPrint.className='noprint';var table=NewTag('table',divNoPrint);table.className='UI_panel_header_container';table.cellPadding=0;table.cellSpacing=0;var tbody=NewTag('tbody',table);var tr=NewTag('tr',tbody);var td=NewTag('td',tr);td.className='UI_panel_header_left_off';td.style.width="12px";var td=NewTag('td',tr);td.className='UI_panel_header_middle_off';var div=NewTag('div',td);div.className='UI_panel_header_title';div.style.textAlign="center";NewTextTag(g_Babel.GetWord('RouteResult'),div);var td=NewTag('td',tr);td.className='UI_panel_header_right_off';var div=NewTag('div',me.divMain);div.className="itiner";table=NewTag('table',div);table.className='UI_panel'
table.cellPadding=0;table.cellSpacing=0;table.style.width="100%";var td=AddThreeColRow(table,'UI_panel_top');var img=NewTag('img',td);SetImage(img,GetAbsUrl('design/clear.gif'),1,1);var td=AddThreeColRow(table,'UI_panel_content');me.ShowLinks(td);me.divTotal=NewTag('div',td);me.ShowTotal();if(me.IsPublicTransport())
{me.ShowItinerList(td);var div=NewTag('div',td);div.className="DetailedPTItiner";me.ShowItiner(me.pRoute,div);}
else
{me.ShowItiner(me.pRoute,td);}
me.ShowLinks(td);var td=AddThreeColRow(table,'UI_panel_bottom');var img=NewTag('img',td);SetImage(img,GetAbsUrl('design/clear.gif'),1,1);me.divRegistered=NewTag('div',me.divMain);if(GetBlock("idBannerMapBottom"))
window.scrollTo(0,GetAbsLayerTop(GetBlock("idBannerMapBottom"))-10);if(me.OnShow){try{me.OnShow();}
catch(exp){if(me.pTopoliszMap.OnError)
me.pTopoliszMap.OnError(exp,'CUtvonaltervRouteResult.OnShow');}}}}
this.ShowPoiBanner=function(divParent)
{try
{if(typeof(g_pPoiBannerCampaign)!="undefined"&&g_pPoiBannerCampaign!=null)
{if(g_pPoiBannerCampaign.strItinerHeaderHtml!=null)
{$(divParent).append(g_pPoiBannerCampaign.strItinerHeaderHtml);}}}
catch(exp)
{}}
this.GetAddressFlagUrl=function(iAddress)
{if(me.pRoute&&me.pRoute.arrMains)
{if(iAddress==0)
return GetAbsUrl('design/ICON_flag_green.gif');if(iAddress==me.pRoute.arrMains.length)
return GetAbsUrl('design/ICON_flag_red.gif');}
return GetAbsUrl('design/ICON_flag_gray.gif');}
this.GetAddressCaption=function(iAddress)
{var strCaption="";if(me.pRoute&&me.pRoute.arrMains)
{if(iAddress==0)
{strCaption=g_Babel.GetWord('Start');}
else if(iAddress==me.pRoute.arrMains.length)
{strCaption=g_Babel.GetWord('Stop');}
else
{strCaption=(iAddress+1)+". ";}}
return strCaption;}
this.GetAddressTextSpan=function(iAddress)
{var span=NewTag("span");var pMain=null;if(iAddress==0)
{pMain=me.pRoute.arrMains[0];if(pMain.strNameFrom!=null&&pMain.strNameFrom.length>0)
{NewTextTag(pMain.strNameFrom,span);NewTag('br',span);NewTextTag(pMain.strAddressFrom,span);}
else
NewTextTag(pMain.strAddressFrom,span);}
else
{pMain=me.pRoute.arrMains[iAddress-1];if(pMain.strNameTo!=null&&pMain.strNameTo.length>0)
{NewTextTag(pMain.strNameTo,span);NewTag('br',span);NewTextTag(pMain.strAddressTo,span);}
else
NewTextTag(pMain.strAddressTo,span);}
return span;}
this.GetAddressCoord=function(iAddress)
{if(iAddress==0)
return new CCoordinate(me.pRoute.arrMains[0].dFromX,me.pRoute.arrMains[0].dFromY);else
return new CCoordinate(me.pRoute.arrMains[iAddress-1].dToX,me.pRoute.arrMains[iAddress-1].dToY);}
this.ShowTotal=function(){if(me.divTotal){while(me.divTotal.firstChild)
me.divTotal.removeChild(me.divTotal.firstChild);if(me.pRoute&&me.pRoute.arrMains&&me.pRoute.arrMains.length>0){var table=NewTag('table',me.divTotal);table.className="UI_itiner_summary";table.cellPadding=0;table.cellSpacing=0;var tbody=NewTag('tbody',table);var tr=NewTag('tr',tbody);var td=NewTag('td',tr);td.colSpan=4;td.className="strong";var img=NewTag('img',td);img.className="UI_icon";SetImage(img,GetAbsUrl('design/ICON_list_off.gif'),13,14);NewTextTag(g_Babel.GetWord("capRouteDetails"),td);var AddInfo=function(tbody,strName,nodeValue,iCol){var tr=null;if(iCol>0){for(tr=tbody.firstChild;tr!=null;tr=tr.nextSibling){var arrTDs=tr.childNodes;if(arrTDs.length==2*iCol)
break;}}
if(tr==null){tr=NewTag('tr',tbody);for(var iTD=0;iTD<2*iCol;iTD++){var td=NewTag('td',tr);NewTextTag('\u00a0',td);}}
var td=NewTag('td',tr);NewTextTag(strName,td);td=NewTag('td',tr);td.className="strong";AddTag(nodeValue,td);return td;}
for(var iAddress=0;iAddress<me.pRoute.arrMains.length+1;iAddress++){AddInfo(tbody,me.GetAddressCaption(iAddress),me.GetAddressTextSpan(iAddress),0);}
if(me.IsCar()||me.IsPublicTransport()){var strTrafficTime=me.strTrafficTime;if(me.pRoute.iDiffHour<0||me.pRoute.iDiffHour>0){if(me.pRoute.iDiffHour>0)
strTrafficTime+=" +";else
strTrafficTime+=" ";strTrafficTime+=me.pRoute.iDiffHour+" "+g_Babel.GetWord("HourLong");}
AddInfo(tbody,g_Babel.GetWord("capDetartureTime"),NewTextTag(strTrafficTime),1);}
var iOptim=0;if(me.IsCar()&&me.pRouteSearch!=null)
iOptim=me.pRouteSearch.iCarOptim;var bLengthDisplayed=false;for(var j=0;j<2;j++){if((iOptim!=j)&&!bLengthDisplayed){AddInfo(tbody,g_Babel.GetWord("capDistance"),NewTextTag(me.GetLengthText(me.pRoute.iLength)),1);bLengthDisplayed=true;}
else{if(!me.IsPublicTransport()&&(me.pRoute.iTravelSeconds>=60)){AddInfo(tbody,g_Babel.GetWord("capTravelTime"),NewTextTag(g_Babel.GetWord("Approx","kb.")+" "+me.GetTimeText(me.pRoute.iTravelSeconds)),1);}}}
if(me.pRouteSearch.dConsumption>0&&me.pRouteSearch.dFuelPrice>0&&me.IsCar()){var iFuelCost=me.ComputeFuelCost(me.pRoute);AddInfo(tbody,g_Babel.GetWord("capFuelCost"),NewTextTag(iFuelCost+" Ft"),1);}
if(me.pRouteSearch.dTaxiFeeBasic>=0&&me.pRouteSearch.dTaxiFeeKm>=0&&me.IsTaxi()){var iTaxiCost=me.ComputeTaxiCost(me.pRoute);AddInfo(tbody,g_Babel.GetWord("capTaxiCost"),NewTextTag(iTaxiCost+" Ft"),1);}
if(me.IsPublicTransport()&&(me.pRoute.iTravelSeconds>=60)){var div=NewTag("div");var iTravelByVehicles=me.pRoute.iTravelSeconds;var iWalkingTime=me.GetFootDistanceAndTime(me.pRoute,-1,-1).iTravelSeconds;iTravelByVehicles-=iWalkingTime;var iWaitingTime=me.GetWaitingTime(me.pRoute,-1,-1);iTravelByVehicles-=iWaitingTime;$(div).append(g_Babel.GetWord("Approx","kb.")+" "+me.GetTimeText(me.pRoute.iTravelSeconds));$(div).append("<span style='font-weight:normal'> ("+g_Babel.GetWord("capWalkingTime","Gyaloglás")+": </span>");$(div).append(g_Babel.GetWord("Approx","kb.")+" "+me.GetTimeText(iWalkingTime));$(div).append("<span style='font-weight:normal'>, "+g_Babel.GetWord("capWaitingTime","Várakozás")+": </span>");$(div).append(g_Babel.GetWord("Approx","kb.")+" "+me.GetTimeText(iWaitingTime));$(div).append("<span style='font-weight:normal'>, "+g_Babel.GetWord("capTravelTimePTbyVehicles","Utazási idő")+": </span>");$(div).append(g_Babel.GetWord("Approx","kb.")+" "+me.GetTimeText(iTravelByVehicles));$(div).append("<span style='font-weight:normal'>)</span>");AddInfo(tbody,g_Babel.GetWord("capTravelTimePT"),div,1);}
me.divTotal.style.display="";}
else{me.divTotal.style.display="none";}}}
this.ComputeFuelCost=function(pRoute)
{var dCarLength=0;for(var iMain=0;iMain<pRoute.arrMains.length;iMain++)
{var pMain=pRoute.arrMains[iMain];for(var iSub=0;iSub<pMain.arrSubs.length;iSub++)
{var pSub=pMain.arrSubs[iSub];if(me.IsCarSub(pSub))
dCarLength+=pSub.iLength;}}
var iFuelCost=Math.round(dCarLength*me.pRouteSearch.dConsumption*me.pRouteSearch.dFuelPrice/100000);return iFuelCost;}
this.ComputeTaxiCost=function(pRoute)
{var iGetOns=0;var bInTaxi=false;var dTaxiLength=0;for(var iMain=0;iMain<pRoute.arrMains.length;iMain++)
{var pMain=pRoute.arrMains[iMain];bInTaxi=false;for(var iSub=0;iSub<pMain.arrSubs.length;iSub++)
{var pSub=pMain.arrSubs[iSub];if(me.IsTaxiSub(pSub))
{if(!bInTaxi)
iGetOns++;bInTaxi=true;dTaxiLength+=pSub.iLength;}
else
bInTaxi=false;}}
var iTaxiCost=Math.round(iGetOns*me.pRouteSearch.dTaxiFeeBasic+dTaxiLength/1000*me.pRouteSearch.dTaxiFeeKm);return iTaxiCost;}
this.ScrollToMap=function()
{me.pTopoliszMap.ZoomToRect(me.pRoute.dLwrX,me.pRoute.dLwrY,me.pRoute.dUprX,me.pRoute.dUprY);var divPage=GetBlock("idPage");if(divPage)
window.scrollTo(0,GetAbsLayerTop(divPage));else
window.scrollTo(0,0);}
this.AddThroughAddress=function()
{me.pRouteSearch.AddThroughAddress();me.ScrollToMap();}
this.ShowLinks=function(divParent,divBefore)
{if(g_strAppID.toLowerCase()=="trafficnav"){return;}
var div=NewTag('div',divParent,divBefore);div.className='noprint';var colorpanel=new ColorPanel(div);var panel=new Panel(colorpanel.td);var tr=panel.tr;var txtBtn=new TextButton();var td=NewTag('td',tr);td.className='right';txtBtn.SetImgParent(td);txtBtn.CreateImage(15,14,"design/icon_home_off.gif","design/icon_home_on.gif",null,null,false);var td=NewTag('td',tr);td.className='left';txtBtn.SetTextParent(td);var aa=txtBtn.CreateText(g_Babel.GetWord("capJumpToTheMap"));txtBtn.OnClick=me.ScrollToMap;var txtBtn=new TextButton();var td=NewTag('td',tr);td.className='right';txtBtn.SetImgParent(td);txtBtn.CreateImage(14,15,"design/icon_mail_off.gif","design/icon_mail_on.gif",null,null,false);var td=NewTag('td',tr);td.className='left';if(typeof(g_TopoliszControls)!="undefined"&&g_TopoliszControls.pLogin&&g_TopoliszControls.pLogin&&g_TopoliszControls.pLogin.name)
{var mailToDef=g_TopoliszControls.pLogin.name;var mailBody="www.utvonalterv.hu/Handler.ashx?command=loadState%26info="+g_TopoliszMap.SaveState();var mailSubject="Utvonalterv.hu";var mailHREF="mailto:"+mailToDef+"?subject="+mailSubject+"&body="+mailBody;td.innerHTML="<a href="+mailHREF+">"+g_Babel.GetWord("capSendViaEmail")+"</a>";}
else
{txtBtn.SetTextParent(td);var aa=txtBtn.CreateText(g_Babel.GetWord("capSendViaEmail"));txtBtn.OnClick=me.SendMail;}
var txtBtn=new TextButton();var td=NewTag('td',tr);td.className='right';txtBtn.SetImgParent(td);txtBtn.CreateImage(12,15,"design/icon_print_off.gif","design/icon_print_on.gif",null,null,false);var td=NewTag('td',tr);td.className='left';txtBtn.SetTextParent(td);aa=txtBtn.CreateText(g_Babel.GetWord("capPrint"));txtBtn.OnClick=function()
{me.pTopoliszMap.DrawPrintPreview();g_TopoliszControls.Print();};var txtBtn=new TextButton();txtBtn.SetHref("mailto:topolisz@topolisz.hu?subject=Panaszkodom");var td=NewTag('td',tr);td.className='right';txtBtn.SetImgParent(td);txtBtn.CreateImage(15,15,"design/icon_sad_off.gif","design/icon_sad_on.gif",null,null,false);var td=NewTag('td',tr);td.className='left';txtBtn.SetTextParent(td);aa=txtBtn.CreateText(g_Babel.GetWord('mailSad'));var txtBtn=new TextButton();txtBtn.SetHref("mailto:topolisz@topolisz.hu?subject=Dics%c3%a9rek");var td=NewTag('td',tr);td.className='right';txtBtn.SetImgParent(td);txtBtn.CreateImage(15,15,"design/icon_happy_off.gif","design/icon_happy_on.gif",null,null,false);var td=NewTag('td',tr);td.className='left';txtBtn.SetTextParent(td);aa=txtBtn.CreateText(g_Babel.GetWord('mailHappy'));var txtBtn=new TextButton();var td=NewTag('td',tr);td.className='right';txtBtn.SetImgParent(td);txtBtn.CreateImage(14,14,"design/icon_delete_off.gif","design/icon_delete_on.gif",null,null,false);var td=NewTag('td',tr);td.className='left';txtBtn.SetTextParent(td);aa=txtBtn.CreateText(g_Babel.GetWord('hintRouteClear'));txtBtn.OnClick=me.Reset;}
var iTR=0;var GetTRParityClass=function()
{if(iTR%2==0&&me.IsPublicTransport())
return'odd';else
return'even';}
var NewTR=function(tbody,bFirstItem,strCssClass)
{if(bFirstItem)
{if(tbody.lastChild&&(tbody.firstChild!=tbody.lastChild))
tbody.lastChild.className+=' last';}
var tr=NewTag('tr',tbody);tr.className=strCssClass;if(bFirstItem)
{iTR++;tr.className+=" first";}
tr.className+=' '+GetTRParityClass();return tr;}
this.ShowItiner=function(pRoute,divParent,divBefore)
{iTR=0;var table=NewTag("table",divParent,divBefore);table.className="UI_itinerary";if(me.IsCar()){}
else{}
var pBanner=me.GetStartStopBanner();if(pBanner)
pBanner.Clear();table.cellPadding=0;table.cellSpacing=0;var tbody=NewTag("tbody",table);var tr,td,a,img;tr=NewTag('tr',tbody);tr.className="ROUTE_firstline";if(me.IsPublicTransport())
{me.iColCount=7;}
else
{me.iColCount=5;}
var arrColWidth=[0,0,0,0,0,0,30,60];for(var i=0;i<me.iColCount;i++)
{td=NewTag('td',tr);td.className="";img=NewTag('img',td);SetImage(img,GetAbsUrl('images/transparent.gif'),1,1,"");}
me.iStartOrder=0;for(var iMain=-1;(pRoute.arrMains!=null)&&(iMain<pRoute.arrMains.length);iMain++)
{if(iMain>=0)
{if(me.IsPublicTransport())
me.ShowDetailsPublic(tbody,pRoute,iMain);else
me.ShowDetailsCar(tbody,pRoute,iMain,0);}
var pBanner=null;if(iMain==-1)
{pBanner=me.GetStartBanner();}
else if(iMain==pRoute.arrMains.length-1)
{pBanner=me.GetStopBanner();}
tr=NewTR(tbody,true,"ROUTE_addressflag");var td=NewTag('td',tr);if(iMain<0)
{td.style.borderTop='none';}
td.colSpan=me.iColCount;td.className='strong';var img=NewTag('img',td);img.className='UI_icon';SetImage(img,me.GetAddressFlagUrl(iMain+1),14,14,"");var span=NewTag("span",td);NewTextTag(me.GetAddressCaption(iMain+1),span);if(pBanner)
pBanner.AddParentArea(td,span);tr=NewTR(tbody,false,"ROUTE_address");if(me.IsPublicTransport())
{td=NewTag('td',tr);td.className="ROUTE_time";if(iMain<0)
NewTextTag(pRoute.arrMains[0].dtStart,td);else
NewTextTag(pRoute.arrMains[iMain].dtStop,td);if(pBanner)
pBanner.AddParentArea(td,td);}
var td=NewTag('td',tr);if(me.IsPublicTransport())
td.colSpan=me.iColCount-2;else
td.colSpan=me.iColCount-1;td.className='strong';var span=me.GetAddressTextSpan(iMain+1);AddTag(span,td);var tdMapLink=me.AddMapLinkCell(tr,"",pRoute,iMain+1,-1,false,null);if(pBanner)
{pBanner.AddParentArea(td,span);pBanner.AddParentArea(tdMapLink,tdMapLink);}
if(typeof(g_pPoiBannerCampaign)!="undefined"&&g_pPoiBannerCampaign!=null)
{if(g_pPoiBannerCampaign.strItinerHeaderHtml!=null)
{if(iMain==-1)
{tr=NewTR(tbody,false,"ROUTE_address");td=NewTag('td',tr);td.colSpan=me.iColCount;$(td).append(g_pPoiBannerCampaign.strItinerHeaderHtml);}}}}
tr.className+=' last';me.ShowStartStopBanners();}
this.ShowDetailsCar=function(tbody,pRoute,iRouteMain,iRouteSub)
{var pMain=pRoute.arrMains[iRouteMain];var bHasRealData=false;var trOrigLast=tbody.lastChild;var iSumLength=0;var iSumTime=0;var eBlockType=0;var iHiddenLength=0;var iPass=0;var iMaxPass=0;var iTr=0;var iMaxRouteSub=iRouteSub;for(iMaxRouteSub=iRouteSub;iMaxRouteSub<pMain.arrSubs.length-1;iMaxRouteSub++)
{var routeSub=pMain.arrSubs[iMaxRouteSub];if(routeSub.arrPTRuns!=null&&routeSub.arrPTRuns.length>0)
{iMaxRouteSub--;break;}}
while(iRouteSub<=iMaxRouteSub)
{var routeSub=pMain.arrSubs[iRouteSub];var bHeader=false;var bFirstItem=false;var bLastItem=false;var strClassPostFix="";if(iPass==0)
{if(routeSub.eType==1||routeSub.eType==2)
iMaxPass++;if(iRouteSub==iMaxRouteSub)
{iMaxPass++;}}
if(routeSub.eType==1||routeSub.eType==2)
{eBlockType=routeSub.eType;if(iPass==0)
{bHeader=true;}
else if(iPass==1)
bFirstItem=true;}
if((iPass==iMaxPass)&&(iRouteSub==iMaxRouteSub))
{bLastItem=true;}
var bNumbered=false;if(eBlockType==1)
{bNumbered=bHeader;}
else
{bNumbered=!bHeader;}
var bSkip=false;if(!bHeader&&eBlockType==1&&!bLastItem)
{if(routeSub.strCity=="")
bSkip=true;if(iRouteSub>0&&bFirstItem)
{if(pMain.arrSubs[iRouteSub-1].strCity==routeSub.strCity)
bSkip=true;}
if(iRouteSub+1<pMain.arrSubs.length)
{if((pMain.arrSubs[iRouteSub+1].eType==2)&&(pMain.arrSubs[iRouteSub+1].strCity==routeSub.strCity))
bSkip=true;}}
if(!bHeader&&eBlockType!=1)
{if(routeSub.bFoot&&routeSub.strStreet=="")
bSkip=true;}
if(!bSkip)
{var tr=NewTag('tr',tbody);tr.className="UI_itinerary"+((iTr++)%2);if(eBlockType==1)
strClassPostFix='Road';else if(eBlockType==2)
strClassPostFix='City';if(!bHeader)
strClassPostFix+='Item';if(me.IsPublicTransport())
me.CreateOrderCell(tr,false);td=NewTag('td',tr);td.className='RouteSumLength'+strClassPostFix;if(iSumLength>0)
NewTextTag(me.GetLengthText(iSumLength),td);else
NewTextTag('\u00a0',td);td=NewTag('td',tr);td.className='RouteSumTime'+strClassPostFix;if(iSumTime>0)
NewTextTag(me.GetTimeText(iSumTime),td);else
NewTextTag('\u00a0',td);td=NewTag('td',tr);td.className='RouteDirection'+strClassPostFix;img=NewTag('img');img.className="turninfo";if(bNumbered&&!bLastItem)
me.SetTurnImage(img,routeSub.eTurnInfo);else
SetImage(img,"images/transparent.gif",30,22);AddTag(img,td);td=NewTag('td',tr);if(me.IsPublicTransport())
td.colSpan=2;td.className='RouteText'+strClassPostFix;if(bLastItem)
{NewTextTag('\u00a0',td);}
else
{if(bHeader&&routeSub.eType==1)
{var span=me.NewRoadTag(routeSub.strRoad);if(span.hasChildNodes())
{AddTag(span,td);bHasRealData=true;}}
else if(bHeader&&routeSub.eType==2)
{if(routeSub.strCity!=null&&routeSub.strCity.length>0)
{NewTextTag(routeSub.strCity,td);bHasRealData=true;}}
else
{me.AddPedCrossingImage(td,routeSub);var span=me.NewRoadTag(me.GetSubText(routeSub,eBlockType));if(span.hasChildNodes())
{AddTag(span,td);me.AddPedTypeImages(td,routeSub);bHasRealData=true;}}
var span=NewTag('span',td);span.className='RouteLength'+strClassPostFix;var iLength=0;if(bHeader&&eBlockType==1)
{iLength=me.GetRoadLength(pMain,iRouteSub);}
else if(eBlockType==1)
{iLength=0;}
else if(!bHeader)
{iLength=routeSub.iLength;}
else
{iLength=0;}
if(iLength>0)
{NewTextTag(" ("+me.GetLengthText(iLength)+")",span);}}
if(bLastItem)
{td.colSpan=4;}
else
{me.AddMapLinkCell(tr,strClassPostFix,pRoute,iRouteMain,iRouteSub,bHeader,null);}
iHiddenLength=0;}
else
{iHiddenLength+=routeSub.iLength;}
if(!bFirstItem&&(iPass==0))
{iSumLength+=routeSub.iLength;iSumTime+=routeSub.iTravelSeconds;}
if(iPass<iMaxPass)
{iPass++;}
else
{iPass=0;iMaxPass=0;iRouteSub++;}}
if(!bHasRealData)
{while(tbody.lastChild&&(tbody.lastChild!=trOrigLast))
{tbody.removeChild(tbody.lastChild);}}
return iRouteSub;}
this.GetVehicleTypeImage=function(iVehicleTypeID)
{var strImage="";if(iVehicleTypeID==1||(7<=iVehicleTypeID&&iVehicleTypeID<=12)||iVehicleTypeID==16||iVehicleTypeID==24||iVehicleTypeID==29)
strImage="VEHICLE_bus.gif";else if(iVehicleTypeID==5)
strImage="VEHICLE_tram.gif";else if(iVehicleTypeID==3)
strImage="VEHICLE_HEV_railway.gif";else if(iVehicleTypeID==4)
strImage="VEHICLE_metro.gif";else if(iVehicleTypeID==6)
strImage="VEHICLE_trolleybus.gif";else if(13<=iVehicleTypeID)
strImage="VEHICLE_train.gif";return strImage;}
this.CreateOrderCell=function(tr,bNewNumber)
{var td=NewTag('td',tr);td.className='ROUTE_order';td.className+=' '+GetTRParityClass();if(bNewNumber)
{var div=NewTag('div',td);div.className="UI_itinerary_number";NewTextTag((++me.iStartOrder)+'.',div);}
else
NewTextTag('\u00a0',td);return td;}
this.GetWaitingTime=function(pRoute,iRouteMain,iRouteSub)
{var iWaitingTimeMinutes=0;var iMainIndexMin=Math.max(0,iRouteMain);var iMainIndexMax=((iRouteMain>=0)?iRouteMain:pRoute.arrMains.length-1);var DateToMinute=function(strDate)
{var iPos=strDate.indexOf(':');var iMinutes=parseInt(strDate.substr(iPos+1),10);var iHours=parseInt(strDate.substr(0,iPos),10);iMinutes+=60*iHours;return iMinutes;}
for(var iMainIndex=iMainIndexMin;iMainIndex<=iMainIndexMax;iMainIndex++)
{var pMain=pRoute.arrMains[iMainIndex];var iSubIndexMin=Math.max(0,iRouteSub);var iSubIndexMax=((iRouteSub>=0)?iRouteSub:pMain.arrSubs.length-1);var prevSub=null;for(var iSubIndex=iSubIndexMin;iSubIndex<=iSubIndexMax;iSubIndex++)
{var routeSub=pMain.arrSubs[iSubIndex];if(routeSub.arrPTRuns!=null&&routeSub.arrPTRuns.length>0)
{if(prevSub!=null)
{var iPrevMinutes=DateToMinute(prevSub.dtStop);var iThisMinutes=DateToMinute(routeSub.dtStart);while(iPrevMinutes>iThisMinutes)
{iThisMinutes+=24*60;}
iWaitingTimeMinutes+=(iThisMinutes-iPrevMinutes);}
if(iRouteSub<0)
continue;else
break;}
prevSub=routeSub;}}
return iWaitingTimeMinutes*60;}
this.GetFootDistanceAndTime=function(pRoute,iRouteMain,iRouteSub)
{var iLength=0;var iTravelSeconds=0;var iMainIndexMin=Math.max(0,iRouteMain);var iMainIndexMax=((iRouteMain>=0)?iRouteMain:pRoute.arrMains.length-1);for(var iMainIndex=iMainIndexMin;iMainIndex<=iMainIndexMax;iMainIndex++)
{var pMain=pRoute.arrMains[iMainIndex];for(var iSubIndex=Math.max(0,iRouteSub);iSubIndex<pMain.arrSubs.length;iSubIndex++)
{var routeSub=pMain.arrSubs[iSubIndex];if(routeSub.arrPTRuns!=null&&routeSub.arrPTRuns.length>0)
{if(iRouteSub<0)
continue;else
break;}
iLength+=routeSub.iLength;iTravelSeconds+=routeSub.iTravelSeconds;}}
var obj=new Object();obj.iLength=iLength;obj.iTravelSeconds=iTravelSeconds;return obj;}
this.ShowDetailsPublic=function(tbody,pRoute,iRouteMain)
{var tr,td,a,img;var pMain=pRoute.arrMains[iRouteMain];for(var iRouteSub=0;iRouteSub<pMain.arrSubs.length;iRouteSub++)
{var routeSub=pMain.arrSubs[iRouteSub];var strClassPostFix='Item';if(iRouteSub>0&&iRouteSub<pMain.arrSubs.length-1&&(routeSub.iLength==0)&&(pMain.arrSubs[iRouteSub-1].arrPTRuns!=null&&pMain.arrSubs[iRouteSub-1].arrPTRuns.length>0)&&(pMain.arrSubs[iRouteSub+1].arrPTRuns!=null&&pMain.arrSubs[iRouteSub+1].arrPTRuns.length>0))
{tr=NewTR(tbody,true,"ROUTE_line");me.CreateOrderCell(tr,true);td=NewTag('td',tr);td.className='ROUTE_icon';var img=NewTag('img',td);SetImage(img,"images/transparent.gif",35,25);td=NewTag('td',tr);td.className=('ROUTE_line');td.colSpan=4;NewTextTag(g_Babel.GetWord("PTChangeHere"),td);var span=NewTag('span',td);span.className='RouteLength'+strClassPostFix;NewTextTag(" ("+routeSub.strStreet+")",span);me.AddMapLinkCell(tr,strClassPostFix,pRoute,iRouteMain,iRouteSub,false,routeSub.strVehicleType);}
else if(routeSub.arrPTRuns==null||routeSub.arrPTRuns.length==0)
{tr=NewTR(tbody,true,"ROUTE_line");me.CreateOrderCell(tr,true);td=NewTag('td',tr);td.className='ROUTE_icon';var img=NewTag('img',td);if(me.IsCarSub(routeSub))
SetImage(img,"design/VEHICLE_car.gif",35,25);else if(me.IsBicycleSub(routeSub))
SetImage(img,"design/VEHICLE_bicycle.gif",35,25);else if(me.IsTaxiSub(routeSub))
SetImage(img,"design/VEHICLE_taxi.gif",35,25);else
SetImage(img,"design/VEHICLE_pedestrian.gif",35,25);td=NewTag('td',tr);td.className=('ROUTE_line');td.colSpan=4;if(me.IsCarSub(routeSub))
NewTextTag(g_Babel.GetWord("VT_CAR"),td);else if(me.IsBicycleSub(routeSub))
NewTextTag(g_Babel.GetWord("VT_BICYCLE"),td);else if(me.IsTaxiSub(routeSub))
NewTextTag("Taxi",td);else
NewTextTag(g_Babel.GetWord("Walking"),td);var obj=me.GetFootDistanceAndTime(pRoute,iRouteMain,iRouteSub);if(obj.iLength>0||obj.iTravelSeconds>0)
{var span=NewTag('span',td);span.className='RouteLength'+strClassPostFix;NewTextTag(" (",span);if(obj.iLength>0)
{NewTextTag(me.GetLengthText(obj.iLength),span);if(obj.iTravelSeconds>=60)
NewTextTag(", ",span);}
if(obj.iTravelSeconds>=60)
NewTextTag(me.GetTimeText(obj.iTravelSeconds),span);NewTextTag(")",span);}
me.AddMapLinkCell(tr,strClassPostFix,pRoute,iRouteMain,iRouteSub,false,routeSub.strVehicleType);var iNextRouteSub=me.ShowDetailsCar(tbody,pRoute,iRouteMain,iRouteSub);if(iNextRouteSub<pMain.arrSubs.length)
{iRouteSub=iNextRouteSub;routeSub=pMain.arrSubs[iRouteSub];}
else
break;}
for(var iRun=0;(routeSub.arrPTRuns!=null)&&(iRun<routeSub.arrPTRuns.length);iRun++)
{var pRun=routeSub.arrPTRuns[iRun];if(iRun==0)
tr=NewTR(tbody,true,"ROUTE_line");else
tr=NewTR(tbody,false,"ROUTE_altline");me.CreateOrderCell(tr,iRun==0);td=NewTag('td',tr);td.className='ROUTE_icon';var strImage="";if(iRun==0)
{strImage=me.GetVehicleTypeImage(pRun.iVehicleTypeID);}
if(strImage!="")
{var img=NewTag('img',td);SetImage(img,"design/"+strImage,35,25);}
else
{NewTextTag('\u00a0',td);}
td=NewTag('td',tr);td.className=(iRun==0?'ROUTE_line':'ROUTE_altline');td.colSpan=3;if(iRun!=0)
{var span=NewTag('span',td);span.style.fontWeight='normal';span.style.marginRight='2mm';NewTextTag("vagy:",span);}
if(pRun.bShowName&&pRun.bShowDescription)
{var iPos=pRun.strName.indexOf(' ');if(iPos>0)
{span=NewTag('span',td);span.className="weak";NewTextTag(pRun.strName.substr(0,iPos),span);span=NewTag('span',td);span.className=pRun.strClass;NewTextTag(pRun.strName.substr(iPos+1)+" "+pRun.strVehicleType,span);span=NewTag('span',td);span.className="weak";NewTextTag("("+pRun.strDescription+")",span);}
else
{span=NewTag('span',td);span.className="weak";NewTextTag(pRun.strName,span);span=NewTag('span',td);span.className=pRun.strClass;NewTextTag(pRun.strDescription,span);NewTextTag(pRun.strVehicleType,td);}}
else
{span=NewTag('span',td);span.className=pRun.strClass;if(pRun.bShowName)
{NewTextTag(pRun.strName,span);}
if(pRun.bShowDescription)
{NewTextTag(pRun.strName,span);}
NewTextTag(pRun.strVehicleType,td);}
me.AddInfoLinkCell(tr,pRun.strLink);td=NewTag('td',tr);td.className="ROUTE_spicon";var strImage="";if(iRun==0)
{if(pRun.iServiceProviderID==1)
strImage="PTLOGO_bkv_100x35.gif";else if(pRun.iServiceProviderID==2)
strImage="PTLOGO_mavstart_180x35.gif";}
if(strImage!="")
{var img=NewTag('img',td);if(pRun.iServiceProviderID==2)
SetImage(img,"design/"+strImage,90,20);else
SetImage(img,"design/"+strImage,60,20);}
else
NewTextTag('\u00a0',td);if(iRun==0)
{tr=NewTR(tbody,false,"ROUTE_geton");me.CreateOrderCell(tr,false);td=NewTag('td',tr);td.className="ROUTE_time";NewTextTag(routeSub.dtStart,td);td=NewTag('td',tr);td.className="ROUTE_geton";NewTextTag(g_Babel.GetWord('PTGetOn'),td);td=NewTag('td',tr);td.colSpan=3;td.className="ROUTE_stop";NewTextTag(routeSub.strStopFrom,td);tr=NewTR(tbody,false,"ROUTE_travel");td=me.CreateOrderCell(tr,false);td.colSpan=3;td=NewTag('td',tr);td.colSpan=3;td.className='ROUTE_travel';NewTextTag(pRun.iStops,td);NewTextTag(" "+g_Babel.GetWord('PTStops'),td);if(routeSub.iLength>0)
{NewTextTag(", "+me.GetLengthText(routeSub.iLength),td);}
if(routeSub.iTravelSeconds>0)
{NewTextTag(", "+me.GetTimeText(routeSub.iTravelSeconds),td);}
me.AddMapLinkCell(tr,"PT",pRoute,iRouteMain,iRouteSub,true,null);tr=NewTR(tbody,false,"ROUTE_getoff");me.CreateOrderCell(tr,false);td=NewTag('td',tr);td.className="ROUTE_time";NewTextTag(routeSub.dtStop,td);td=NewTag('td',tr);td.className="ROUTE_getoff";NewTextTag(g_Babel.GetWord('PTGetOff'),td);td=NewTag('td',tr);td.className="ROUTE_stop";td.colSpan=4;NewTextTag(routeSub.strStopTo,td);}}}}
this.AddMapLinkCell=function(tr,strClassPostFix,pRoute,iRouteMain,iRouteSub,bHeader,strVehicleType)
{var td=NewTag('td',tr);td.className='RouteMapLink'+strClassPostFix;var txtBtn=new TextButton();txtBtn.SetImgParent(td);txtBtn.CreateImage(12,15,"design/ICON_display_WHITE_off.gif","design/ICON_display_WHITE_on.gif",null,null,false);txtBtn.SetTextParent(td);var txt=txtBtn.CreateText(g_Babel.GetWord("capMap"));var switchsubmap=function()
{me.SwitchSubMap(txtBtn,pRoute,iRouteMain,iRouteSub,bHeader,strVehicleType);}
txtBtn.OnClick=switchsubmap;return td;}
this.AddInfoLinkCell=function(tr,strLink)
{var td=NewTag('td',tr);td.className='ROUTE_infolink';if(strLink!=null&&strLink.length>0)
{var txtBtn=new TextButton();txtBtn.SetHref(strLink);txtBtn.SetImgParent(td);txtBtn.CreateImage(10,15,"design/ICON_document_off.gif","design/ICON_document_on.gif",null,null,false);txtBtn.SetTextParent(td);var txt=txtBtn.CreateText(g_Babel.GetWord("RunInfoLink"));}
else
{NewTextTag('\u00a0',td);}}
var GetOrderTD=function(tr)
{if(tr.firstChild&&tr.firstChild.className.indexOf('ROUTE_order')>=0)
return tr.firstChild;return null;}
this.GetBlockCount=function(pRoute,iRouteMain,iRouteSub,bHeader,strVehicleType)
{if(pRoute)
{var pMain=pRoute.arrMains[iRouteMain];if((iRouteSub<pMain.arrSubs.length)&&(pMain.arrSubs[iRouteSub]!=null))
{if(bHeader||(strVehicleType!=null))
{if(strVehicleType!=null)
strVehicleType=strVehicleType.toLowerCase();var iCount=1;for(i=iRouteSub+1;i<pMain.arrSubs.length;i++)
{if(bHeader&&(pMain.arrSubs[i].eType>0))
break;if((strVehicleType!=null)&&pMain.arrSubs[i].strVehicleType.toLowerCase()!=strVehicleType)
break;iCount++;}
return iCount;}
return 1;}}
return 0;}
this.SwitchSubMap=function(txtBtn,pRoute,iRouteMain,iRouteSub,bHeader,strVehicleType)
{me.HideStartStopBanners();var td=null;var tdMaplink=txtBtn.aText.parentNode;var trParent=tdMaplink.parentNode;if(trParent.nextSibling&&(trParent.nextSibling.className.indexOf('ROUTE_map')>=0))
{trParent.parentNode.removeChild(trParent.nextSibling);return;}
var tr=NewTag('tr',trParent.parentNode,trParent.nextSibling);var strClassName=trParent.className;var iPos=strClassName.indexOf("first");if(iPos>=0)
strClassName=strClassName.substr(0,iPos)+strClassName.substr(iPos+6);strClassName+=" ROUTE_map";tr.className=strClassName;var iColSpan=me.iColCount;var tdOrder=GetOrderTD(trParent);if(tdOrder)
{td=NewTag('td',tr);td.className=tdOrder.className;NewTextTag('\u00a0',td);iColSpan--;}
td=NewTag('td',tr);td.colSpan=iColSpan;me.ShowSubMap(td,pRoute,iRouteMain,iRouteSub,bHeader,strVehicleType);}
this.GetSubMaps=function()
{var arrSubMaps=[];$(me.divMain).find("div.ROUTE_map").each(function(iIndex,element)
{var pMap=$(element).data("map");arrSubMaps[arrSubMaps.length]=pMap;});return arrSubMaps;}
this.ShowSubMap=function(divParent,pRoute,iRouteMain,iRouteSub,bHeader,strVehicleType)
{if(pRoute)
{var pMain=pRoute.arrMains[iRouteMain];var dLwrX,dLwrY,dUprX,dUprY;if(iRouteSub<0)
{var coord=me.GetAddressCoord(iRouteMain);dLwrX=dUprX=coord.dX;dLwrY=dUprY=coord.dY;}
else if((iRouteSub<pMain.arrSubs.length)&&(pMain.arrSubs[iRouteSub]!=null))
{var pSub=pMain.arrSubs[iRouteSub];dLwrX=Math.min(pSub.dLwrX,pSub.dUprX);dLwrY=Math.min(pSub.dLwrY,pSub.dUprY);dUprX=Math.max(pSub.dLwrX,pSub.dUprX);dUprY=Math.max(pSub.dLwrY,pSub.dUprY);var i;var iCount=me.GetBlockCount(pRoute,iRouteMain,iRouteSub,bHeader,strVehicleType);for(i=iRouteSub+1;i<iRouteSub+iCount;i++)
{if(pMain.arrSubs[i].dLwrX<dLwrX)
dLwrX=pMain.arrSubs[i].dLwrX;if(pMain.arrSubs[i].dUprX<dLwrX)
dLwrX=pMain.arrSubs[i].dUprX;if(pMain.arrSubs[i].dLwrY<dLwrY)
dLwrY=pMain.arrSubs[i].dLwrY;if(pMain.arrSubs[i].dUprY<dLwrY)
dLwrY=pMain.arrSubs[i].dUprY;if(pMain.arrSubs[i].dLwrX>dUprX)
dUprX=pMain.arrSubs[i].dLwrX;if(pMain.arrSubs[i].dUprX>dUprX)
dUprX=pMain.arrSubs[i].dUprX;if(pMain.arrSubs[i].dLwrY>dUprY)
dUprY=pMain.arrSubs[i].dLwrY;if(pMain.arrSubs[i].dUprY>dUprY)
dUprY=pMain.arrSubs[i].dUprY;}}
else
return;var div=NewTag('div',divParent);div.className="ROUTE_map";var pMap=new CTopoliszMap(me.pTopoliszMap.GetSessionID(),div,false);pMap.strRole="itinermap";pMap.UnSetFocus();pMap.Init();new CUtvonaltervMapPalette(pMap,true);me.pTopoliszMap.CopyMarkersAndPois(pMap);pMap.InitGrid();pMap.iMainGridImageOpacity=me.pTopoliszMap.iMainGridImageOpacity;pMap.m_bPaleMapGridImage=me.pTopoliszMap.m_bPaleMapGridImage;if(dLwrX==dUprX&&dLwrY==dUprY)
pMap.ZoomToPoint(dLwrX,dLwrY,100);else
pMap.ZoomToRect(dLwrX,dLwrY,dUprX,dUprY);pMap.Show();pMap.SetBorderThickness(2);$(div).data("map",pMap);}}
this.Reset=function()
{me.ScrollToMap();me.pTopoliszMap.pMarkers.DeleteAllWithType("routeptstop");if(me.pRouteSearch)
me.pRouteSearch.Reset();}
this.ResetAltTimes=function()
{me.iAltDifferenceBeforeHour=-me.iAltDiffStepHour;me.iAltDifferenceAfterHour=me.iAltDiffStepHour;}
this.FillRoute=function(pRouteRes,clientParams){var bZoomMap=clientParams.bZoomMap;me.strTrafficTime=clientParams.strTrafficTime;if(me.pRouteSearch)
me.pRouteSearch.ClearAlertDiv();me.DeleteRoute(false);me.arrRoutes=pRouteRes;me.pRoute=null;me.iActiveAlt=0;me.ResetAltTimes();if(me.arrRoutes!=null&&me.arrRoutes.length>0){me.pRoute=me.arrRoutes[0];if(me.IsCar()||me.IsTaxi()){if(me.pTopoliszMap!=null){SetWaType("car");me.pTopoliszMap.SetPalingGridImage(true);if(me.pTopoliszMap.pConnectedMiniMap)
me.pTopoliszMap.pConnectedMiniMap.SetPalingGridImage(true);}}
else{if(me.pTopoliszMap){me.pTopoliszMap.SetPalingGridImage(true);if(me.pTopoliszMap.pConnectedMiniMap)
me.pTopoliszMap.pConnectedMiniMap.SetPalingGridImage(true);}
if(me.pRouteSearch){if(me.pRouteSearch.bUsePTLocal&&me.pRouteSearch.bUsePTTrain)
SetWaType("pt");else if(me.pRouteSearch.bUsePTLocal)
SetWaType("bkv");else if(me.pRouteSearch.bUsePTTrain)
SetWaType("train");}
for(var i=0;i<me.arrRoutes.length;i++){me.CalcRunChanges(me.arrRoutes[i]);}
if(me.pTopoliszMap){me.pTopoliszMap.iMainGridImageOpacity=100;if(me.pTopoliszMap.pConnectedMiniMap)
me.pTopoliszMap.pConnectedMiniMap.iMainGridImageOpacity=100;}}
me.Show();me.ShowPTChangesOnMap();if(me.pTopoliszMap){if(bZoomMap){var pRoute=me.arrRoutes[0];me.pTopoliszMap.ZoomToRect(pRoute.dLwrX,pRoute.dLwrY,pRoute.dUprX,pRoute.dUprY);}
else{me.pTopoliszMap.DrawRoute();}}
var strTitle="Útvonalterv.hu";for(var iMain=0;(me.pRoute.arrMains!=null)&&(iMain<=me.pRoute.arrMains.length);iMain++){strTitle+=" - ";if(iMain==0)
strTitle+=me.pRoute.arrMains[iMain].strAddressFrom;else
strTitle+=me.pRoute.arrMains[iMain-1].strAddressTo;}
strTitle+=" "+g_Babel.GetWord("titleMapAndItiner");document.title=strTitle;}
else{if(me.pRouteSearch){var strMessage=g_Babel.GetWord('TrafficErrorCar');if(me.pRouteSearch.IsByPublicTransport()){strMessage=g_Babel.GetWord('TrafficErrorBkvDefault');strMessage+=" ("+me.strTrafficTime+")";}
else if(me.pRouteSearch.IsOnFoot())
strMessage=g_Babel.GetWord('TrafficErrorFootDefault');var alertbox=new Alert(me.pRouteSearch.GetAlertDiv());NewTextTag("Figyelmeztetés",alertbox.th);NewTextTag(strMessage,alertbox.td);window.scrollTo(0,GetAbsLayerTop(alertbox.table));}}}
this.ShowPTChangesOnMap=function()
{me.pTopoliszMap.pMarkers.DeleteAllWithType("routeptstop");if(me.pRoute!=null)
{for(var iMain=0;(me.pRoute.arrMains!=null)&&(iMain<me.pRoute.arrMains.length);iMain++)
{var pMain=me.pRoute.arrMains[iMain];for(var iSub=0;(pMain.arrSubs!=null)&&(iSub<pMain.arrSubs.length);iSub++)
{var pSub=pMain.arrSubs[iSub];if((pSub.arrPolylines!=null)&&(pSub.arrPolylines.length>0)&&(pSub.arrPTRuns!=null)&&(pSub.arrPTRuns.length>0))
{me.AddPTStopMarker(pSub.arrPolylines[0][0],"Felszállás",pSub.strStopFrom,pSub.arrPTRuns);me.AddPTStopMarker(pSub.arrPolylines[pSub.arrPolylines.length-1][pSub.arrPolylines[pSub.arrPolylines.length-1].length-1],"Leszállás",pSub.strStopTo,pSub.arrPTRuns);}}}}}
this.AddPTStopMarker=function(wgsCoord,strCaption,strStopName,arrPTRuns)
{var marker=new Marker(me.pTopoliszMap,"routeptstop",wgsCoord.dX,wgsCoord.dY,null,null);marker.SetProperty("start_button",false);marker.SetProperty("through_button",false);marker.SetProperty("stop_button",false);marker.SetProperty("panorama_button",true);marker.SetProperty("pinnumber",0);marker.SetProperty("handle_details",false);marker.SetProperty("div_label_sign_class","marker");marker.SetProperty("pin_img_width",19);marker.SetProperty("pin_img_height",19);marker.SetProperty("pin_img_refx",9);marker.SetProperty("pin_img_refy",9);marker.SetProperty("fix_label_on_click",true);marker.SetProperty("delete_marker_on_label_close",false);marker.SetProperty("caption",strCaption);marker.SetProperty("show_coordinates",me.pTopoliszMap.bDisplayCoords);marker.SetProperty("label_dx",0);marker.SetProperty("label_dy",-9);marker.SetProperty("pinnumbercolor","Black");marker.bMouseOverEnabled=true;marker.bLongMouseOver=true;var ptstopDrawBoxContent_Custom=function(divDetails)
{me.PTChangeDrawBoxContentData(divDetails,marker,wgsCoord,strStopName,arrPTRuns);}
marker.DrawBoxContentData=ptstopDrawBoxContent_Custom;var drawZoomButton=function(div,pPinLabel)
{var a1=NewTag("a",div);NewTextTag(g_Babel.GetWord((pPinLabel.pMarker.lastZoomView)==null?'capZoomToMarker':'capZoomBackFromMarker'),a1);a1.href="javascript:void(0)";a1.onclick=function(e)
{if(pPinLabel.pMarker.lastZoomView==null)
{var state=pPinLabel.pMap.GetMapData();pPinLabel.pMarker.lastZoomView={dMinX:state.dMinX,dMinY:state.dMinY,dMaxX:state.dMaxX,dMaxY:state.dMaxY};pPinLabel.pMap.ZoomToPoint(pPinLabel.pMarker.dX,pPinLabel.pMarker.dY,150);}
else
{var rect=pPinLabel.pMarker.lastZoomView;pPinLabel.pMarker.lastZoomView=null;pPinLabel.pMap.ZoomToRect(rect.dMinX,rect.dMinY,rect.dMaxX,rect.dMaxY);}
StopEventPropagation(e);return false;};a1.onmousedown=function(e){StopEventPropagation(e);return false;};a1.onmouseover=function(pEvent){g_TopoliszMap.ShowToolTip(pEvent,g_Babel.GetWord((pPinLabel.pMarker.lastZoomView)==null?'tooltipZoomToMarker':'tooltipZoomBackFromMarker'))};a1.onmouseout=function(){g_TopoliszMap.HideToolTip()};a1.ondragstart=function(){return false;};a1.onselectstart=function(){return false;};}
marker.DrawCustomButtons=drawZoomButton;me.pTopoliszMap.pMarkers.Add(marker)}
this.PTChangeDrawBoxContentData=function(divDetails,marker,wgsCoord,strStopName,arrPTRuns)
{$(divDetails).append($("<div style='font-weight:bold;font-size:12px;white-space:nowrap'>"+strStopName+"</div>"));$(divDetails).css({'cursor':'text'});divDetails.style.whiteSpace="nowrap";divDetails.style.padding="3px";for(var iRun=0;(arrPTRuns!=null)&&(iRun<arrPTRuns.length);iRun++)
{var pRun=arrPTRuns[iRun];var strImage="";if(iRun==0)
{strImage=me.GetVehicleTypeImage(pRun.iVehicleTypeID);}
if(strImage!="")
{var img=NewTag('img',divDetails);img.style.verticalAlign='middle';SetImage(img,"design/"+strImage,35,25);}
var a=$("<a target='_blank' href='"+pRun.strLink+"' style='text-decoration:none;'></a>").appendTo(divDetails);a.click(function(){window.open(pRun.strLink)});if(pRun.bShowName&&pRun.bShowDescription)
{var iPos=pRun.strName.indexOf(' ');if(iPos>0)
{a.append("<span class='weak'>"+pRun.strName.substr(0,iPos)+"</span>");a.append("<span class='"+pRun.strClass+"'>"+pRun.strName.substr(iPos+1)+" "+pRun.strVehicleType+"</span>");a.append("<span class='weak'>"+"("+pRun.strDescription+")</span>");}
else
{a.append("<span class='weak'"+pRun.strName+"</span>");a.append("<span class='"+pRun.strClass+"'>"+pRun.strDescription);a.append(pRun.strVehicleType);}}
else
{var span=$("<span class='"+pRun.strClass+"'></span>").appendTo(a);if(pRun.bShowName)
{span.append(pRun.strName);}
if(pRun.bShowDescription)
{span.append(pRun.strDescription);}}}}
this.FillAltRoute=function(pRouteRes,iDiffHour)
{if(pRouteRes!=null)
{if(iDiffHour>=0)
{for(var i=0;i<pRouteRes.length;i++)
{pRouteRes[i].iDiffHour=iDiffHour;me.CalcRunChanges(pRouteRes[i]);me.arrRoutes[me.arrRoutes.length]=pRouteRes[i];}}
else
{var i=me.arrRoutes.length;while(i--)
{me.arrRoutes[i].iAlternative+=pRouteRes.length;me.arrRoutes[i+pRouteRes.length]=me.arrRoutes[i];}
for(i=0;i<pRouteRes.length;i++)
{pRouteRes[i].iDiffHour=iDiffHour;me.CalcRunChanges(pRouteRes[i]);me.arrRoutes[i]=pRouteRes[i];}}
me.arrRoutes.sort(me.RouteCompare);}
if(iDiffHour==me.iAltDifferenceBeforeHour)
me.iAltDifferenceBeforeHour-=me.iAltDiffStepHour;else if(iDiffHour==me.iAltDifferenceAfterHour)
me.iAltDifferenceAfterHour+=me.iAltDiffStepHour;me.Show();}
this.DeleteRoute=function()
{if(me.divMain)
{while(me.divMain.firstChild)
me.divMain.removeChild(me.divMain.firstChild);}}
this.GetSubText=function(routeSub,eBlockType)
{var strName="";if(eBlockType==1)
{strName=routeSub.strCity;}
else
{strName=routeSub.strStreet;if(strName=="")
strName=routeSub.strRoad;if(strName=="")
strName=routeSub.strInternational;}
return strName;}
this.GetRoadLength=function(pRouteMain,iRouteSub)
{var iRoadLength=0;var bFirst=true;for(;iRouteSub<pRouteMain.arrSubs.length;iRouteSub++)
{var routeSub=pRouteMain.arrSubs[iRouteSub];if(bFirst)
{if(routeSub.eType!=1)
break;bFirst=false;}
else
{if(routeSub.eType==1||routeSub.eType==2)
break;}
iRoadLength+=routeSub.iLength;}
return iRoadLength;}
this.GetLengthText=function(iMeter)
{var str="";if(iMeter>0)
{iMeter=parseInt(iMeter,10);if(iMeter<1000)
str=iMeter+" m";else
str=(Math.round(iMeter/100)/10)+" km";}
return str;}
this.GetTimeText=function(iSeconds)
{var str="";var iMinutes=Math.floor(iSeconds/60);if(iMinutes>0)
{if(iMinutes<60)
str=iMinutes+"'";else
{var iMin=iMinutes%60;str=Math.floor(iMinutes/60)+g_Babel.GetWord('HourShort')+(iMin>9?iMin:"0"+iMin)+g_Babel.GetWord('MinuteShort');}}
return str;}
this.SetTurnImage=function(img,eTurnInfo)
{var strUrl=GetAbsUrl("images/turninfo/");var strAlt="";switch(eTurnInfo)
{case 2:strUrl+="slight_left.gif";strAlt="enyhén balra";break;case 4:strUrl+="left.gif";strAlt="balra";break;case 6:strUrl+="sharp_left.gif";strAlt="élesen balra";break;case 3:strUrl+="slight_right.gif";strAlt="enyhén jobbra";break;case 5:strUrl+="right.gif";strAlt="jobbra";break;case 7:strUrl+="sharp_right.gif";strAlt="élesen jobbra";break;case 8:case 9:case 10:default:strUrl=GetAbsUrl("images/transparent.gif");break;}
SetImage(img,strUrl,20,20,strAlt);return strUrl;}
this.NewRoadTag=function(strRoadName)
{var span=NewTag('span');span.className='routeItem';var strText="";var strHigh="";var iState=1;var i=0;var ch=null;do
{if(i<strRoadName.length)
ch=strRoadName.charAt(i++);else
ch=-1;switch(iState)
{case 0:if(ch==' ')
iState=1;if(ch!=-1)
strText+=ch;break;case 1:if(ch=='M'||ch=='E')
{iState=2;strHigh+=ch;}
else if(ch>='0'&&ch<='9')
{iState=4;strHigh+=ch;}
else if(ch!=-1)
strText+=ch;break;case 2:if(ch>='0'&&ch<='9')
{iState=3;strHigh+=ch;}
else
{iState=0;strText+=strHigh;if(ch!=-1)
strText+=ch;strHigh='';}
break;case 3:if(ch>='0'&&ch<='9')
strHigh+=ch;else if(ch==' '||ch=='/'||ch=='-'||ch==-1)
{iState=1;NewTextTag(strText,span);if(ch!=-1)
strText=ch;var high=NewTag('span',span);high.className='motorway';NewTextTag(strHigh,high);strHigh='';}
else
{iState=0;strText+=strHigh+ch;strHigh='';}
break;case 4:if(ch>='0'&&ch<='9')
strHigh+=ch;else if(ch==' ')
{iState=5;}
else
{iState=0;strText+=strHigh;if(ch!=-1)
strText+=ch;strHigh="";}
break;case 5:if(ch=='s')
iState=6;else
{if(ch==' ')
iState=1;else
iState=0;strText+=strHigh+" ";if(ch!=-1)
strText+=ch;strHigh="";}
break;case 6:if(ch=='z')
iState=7;else
{if(ch==' ')
iState=1;else
iState=0;strText+=strHigh+" s";if(ch!=-1)
strText+=ch;strHigh="";}
break;case 7:if(ch=='.')
{iState=0;NewTextTag(strText,span);strText=" sz.";var high=NewTag('span',span);high.className='countryroad';NewTextTag(strHigh,high);strHigh='';}
else
{if(ch==' ')
iState=1;else
iState=0;strText+=strHigh+" sz";if(ch!=-1)
strText+=ch;strHigh="";}
break;};}while(ch!=-1);if(strText.length>0)
NewTextTag(strText,span);return span;}
this.SendMail=function(txtBtn)
{if(g_TopoliszControls.pLogin&&g_TopoliszControls.pLogin&&g_TopoliszControls.pLogin.name)
{var mailToDef=g_TopoliszControls.pLogin.name;var mailBody="www.utvonalterv.hu/Handler.ashx?command=loadState%26info="+g_TopoliszMap.SaveState();var mailSubject="Utvonalterv.hu";var mailHREF="mailto:"+mailToDef+"?subject="+mailSubject+"&body="+mailBody;txtBtn.aText.setAttribute("href",mailHREF);txtBtn.aImage.setAttribute("href",mailHREF);}
else
{alert("Kérem, jelentkezzen be!");}}
this.SendMailCallback=function(result,clientParam)
{if(result)
{if(result.bSuccess)
{alert("A levelet elküldtük a "+clientParam+" címre.");}
else
{alert(result.strError);}}
else
alert("Hiba");}
this.InnenOda=function()
{var mapdata=me.pTopoliszMap.GetMapData();var strParams="iWidth="+mapdata.iMapWidth
+"&iHeight="+mapdata.iMapHeight
+"&dMinX="+mapdata.dMinX
+"&dMinY="+mapdata.dMinY
+"&dMaxX="+mapdata.dMaxX
+"&dMaxY="+mapdata.dMaxY
+"&"+me.pRouteSearch.GetAddressListUrl();var strUrl=me.pTopoliszMap.ReadSessionServer.GetCommandUrl("InnenOda")+"&"+strParams;window.open(strUrl,"_blank","width=375,height=225,toolbar=0",false);}
this.Hide=function()
{me.divMain.style.display="none";}
this.Unhide=function()
{me.divMain.style.display="";}
this.AddPedCrossingImage=function(divParent,routeSub)
{var img=null;if((routeSub.ePedEnum&PedEnum.P_TLBUTTON)==PedEnum.P_TLBUTTON)
{img=NewTag("img",divParent);SetImage(img,"images/acc/ITINER_zebragomb.png",-1,-1,"Nyomógombos gyalogátkelőhely","Menjen át a nyomógombos zebrán");}
else if((routeSub.ePedEnum&PedEnum.P_NOTICESIGNAL)==PedEnum.P_NOTICESIGNAL)
{img=NewTag("img",divParent);SetImage(img,"images/acc/ITINER_zebrahang.png",-1,-1,"Hangjelzéses gyalogátkelőhely","Menjen át a hangjelzéses zebrán");}
else if((routeSub.ePedEnum&PedEnum.P_TRAFFICLIGHT)==PedEnum.P_TRAFFICLIGHT)
{img=NewTag("img",divParent);SetImage(img,"images/acc/ITINER_zebrafeny.png",-1,-1,"Lámpás gyalogátkelőhely","Menjen át a lámpás zebrán");}
else if((routeSub.ePedEnum&PedEnum.P_PEDCROSSING)==PedEnum.P_PEDCROSSING)
{img=NewTag("img",divParent);SetImage(img,"images/acc/ITINER_zebra.png",-1,-1,"Gyalogátkelőhely","Menjen át a zebrán");}
else if((routeSub.ePedEnum&PedEnum.P_CROSSING)==PedEnum.P_CROSSING)
{img=NewTag("img",divParent);SetImage(img,"images/acc/ITINER_across.png",-1,-1,"Kereszteződés","Menjen át a kereszteződésen");}
if(img!=null)
img.className="acccrossinginfo";}
this.AddPedTypeImages=function(divParent,routeSub)
{var img=null;if((routeSub.ePedEnum&(PedEnum.P_GRADSTAIRSNEG|PedEnum.P_GRADSTAIRSPOS))!=PedEnum.P_NONE)
{img=NewTag('img',divParent);SetImage(img,"images/acc/ITINER_stairs_right.png",-1,-1,"Lépcső","Menjen a lépcsőn");}
else if((routeSub.ePedEnum&(PedEnum.P_MOVINGSTAIR))!=PedEnum.P_NONE)
{img=NewTag('img',divParent);SetImage(img,"images/acc/ITINER_stairs_right.png",-1,-1,"Mozgólépcső","Menjen a mozgólépcsőn");}
else if((routeSub.ePedEnum&(PedEnum.P_ELEVATOR))!=PedEnum.P_NONE){img=NewTag('img',divParent);SetImage(img,"images/acc/ITINER_stairs_right.png",-1,-1,"Lift","Menjen a liften");}
else if((routeSub.ePedEnum&(PedEnum.P_GRADHIGHNEG|PedEnum.P_GRADHIGHPOS))!=PedEnum.P_NONE)
{img=NewTag('img',divParent);SetImage(img,"images/acc/ITINER_slant2_right.png",-1,-1,"Meredek lejtő","Menjen a lejtőn");}
else if((routeSub.ePedEnum&(PedEnum.P_GRADLOWNEG|PedEnum.P_GRADLOWPOS))!=PedEnum.P_NONE)
{img=NewTag('img',divParent);SetImage(img,"images/acc/ITINER_slant1_right.png",-1,-1,"Enyhe lejtő","Menjen a lejtőn");}
if(img!=null)
img.className="accpedtypeinfo";img=null;if((routeSub.ePedEnum&PedEnum.P_TACTILE)==PedEnum.P_TACTILE||(routeSub.ePedEnum&PedEnum.P_TCURBSIDE)==PedEnum.P_TCURBSIDE)
{img=NewTag('img',divParent);SetImage(img,"images/acc/ITINER_vaksegito.png",-1,-1,"","Vaksegítő burkolat");}
if(img!=null)
img.className="accpedtypeinfo";img=null;if((routeSub.ePedEnum&PedEnum.P_LCURBSIDE)==PedEnum.P_LCURBSIDE)
{img=NewTag('img',divParent);img=SetImage(img,"images/acc/ITINER_szegely.png",-1,-1,"","Szegélysüllyesztés");}
if(img!=null)
img.className="accpedtypeinfo";img=null;if((routeSub.ePedEnum&PedEnum.P_COBBLESTONE)==PedEnum.P_COBBLESTONE)
{img=NewTag('img',divParent);SetImage(img,"images/acc/ITINER_macskako.png",-1,-1,"","Kockaköves burkolat");}
else if((routeSub.ePedEnum&PedEnum.P_PAVEDPOOR)==PedEnum.P_PAVEDPOOR)
{img=NewTag('img',divParent);SetImage(img,"images/acc/ITINER_burkolatlan.png",-1,-1,"","Gyengén burkolt út");}
else if((routeSub.ePedEnum&PedEnum.P_UNPAVEDCARTROAD)==PedEnum.P_UNPAVEDCARTROAD||(routeSub.ePedEnum&PedEnum.P_UNPAVEDSHINGLY)==PedEnum.P_UNPAVEDSHINGLY)
{img=NewTag('img',divParent);SetImage(img,"images/acc/ITINER_burkolatlan.png",-1,-1,"","Földút");}
if(img!=null)
img.className="accpedtypeinfo";img=null;}
this.GetStartStopBanner=function()
{if(me.bShowStartStopBanners)
{var now=new Date();for(var iB=0;iB<me.arrStartStopBanners.length;iB++)
{if((me.arrStartStopBanners[iB].dateFrom<now)&&(now<me.arrStartStopBanners[iB].dateTo))
{return me.arrStartStopBanners[iB];}}}
return null;}
this.GetStartBanner=function()
{var pBanner=me.GetStartStopBanner();if(pBanner)
return pBanner.pStartBox;return null;}
this.GetStopBanner=function()
{var pBanner=me.GetStartStopBanner();if(pBanner)
return pBanner.pStopBox;return null;}
this.ShowStartStopBanners=function()
{if(me.bShowStartStopBanners)
{var pBanner=me.GetStartStopBanner();if(pBanner)
pBanner.Show(me.divMain);}}
this.HideStartStopBanners=function()
{var pBanner=me.GetStartStopBanner();if(pBanner)
pBanner.Clear();}
this.Init();}

var SliderControlIsMouseDown=false;function SliderControlMouseDown(e)
{this.parent.isMouseDown=true;SliderControlIsMouseDown=true;this.parent.setThumb();}
function SliderControlMouseUp(e)
{if(this.parent.isMouseDown&&this.parent.bYUseTicks)
{var percentY=this.parent.getPercentY();var newPercentY=(Math.round(percentY/(1/(this.parent.iYTickNumber-1))))*(1/(this.parent.iYTickNumber-1));this.parent.setPercentY(newPercentY);if(this.parent.onThumbMoved)
this.parent.onThumbMoved(newPercentY);}
this.parent.isMouseDown=false;SliderControlIsMouseDown=false;}
function SliderControlMouseOut(e)
{if(e==undefined)
return;var x=GetEventRelatedElement(e).className;if((x!="sliderthumb")&&(x!="")&&(x!="slidertick"))
{var percentY=this.parent.getPercentY();var newPercentY=(Math.round(percentY/(1/(this.parent.iYTickNumber-1))))*(1/(this.parent.iYTickNumber-1));this.parent.setPercentY(newPercentY);if(this.parent.onThumbMoved)
this.parent.onThumbMoved(newPercentY);}}
function SliderControlMouseMove(e)
{try
{var parent=this.parent;parent.mouseX=GetEventXNew(e)-GetAbsLayerLeft(parent.slider);parent.mouseY=GetEventYNew(e)-GetAbsLayerTop(parent.slider);parent.setThumb();}
catch(e)
{}}
function SliderControlMouseMoveOnThumb(e)
{try
{var parent=this.parent;parent.mouseX=GetEventXNew(e)-GetAbsLayerLeft(parent.slider);parent.mouseY=GetEventYNew(e)-GetAbsLayerTop(parent.slider);parent.setThumb();StopEventPropagation(e);}
catch(e)
{}}
function SliderControlSetThumb()
{if(this.mouseX>this.width||this.mouseX<0||this.mouseY>this.height||this.mouseY<0||SliderControlIsMouseDown==false)
{this.isMouseDown=false;}
if(this.isMouseDown)
{this.UpdateThumbPosition(true);}}
function SliderControlDocMouseUp(e)
{SliderControlIsMouseDown=false;}
function SliderTickOnMouseOver(pEvent)
{}
function SliderTickOnMouseOut(pEvent)
{}
function SliderControlSetSize(w,h)
{this.width=w;this.height=h;this.slider.style.width=this.width+"px";this.slider.style.height=this.height+"px";this.UpdateThumbPosition(true);var i=0;var iStartIdxOfTickText=0;for(i=0;i<this.iYTickNumber;i++)
{var slidertick=document.createElement('div');slidertick.className="slidertick";slidertick.style.visibility='hidden';slidertick.style.zIndex=6;slidertick.style.position='absolute';slidertick.style.fontSize='0';slidertick.tickpercent=i/(this.iYTickNumber-1);var newidx=this.TickTexts.indexOf(";",iStartIdxOfTickText);slidertick.hinttext=this.TickTexts.substr(iStartIdxOfTickText,newidx-iStartIdxOfTickText);iStartIdxOfTickText=newidx+1;slidertick.onmouseover=this.SliderTickOnMouseOverInternal;slidertick.onmouseout=this.SliderTickOnMouseOutInternal;slidertick.onmousedown=function(pEvent)
{try
{StopEventPropagation(pEvent);}
catch(e)
{}
return false;}
slidertick.onclick=function()
{this.parentNode.parent.setPercentY(this.tickpercent);if(this.parentNode.parent.onThumbMoved)
this.parentNode.parent.onThumbMoved(this.tickpercent);}
this.slider.appendChild(slidertick);slidertick.style.top=Math.round(((this.height-GetLayerHeight(this.thumb))/(this.iYTickNumber-1))*i+GetLayerHeight(this.thumb)/2-GetLayerHeight(slidertick)/2)+"px";slidertick.style.left=Math.round(this.x+this.width/2-GetLayerWidth(slidertick)/2)+"px";slidertick.style.visibility='visible';}}
function SliderControlSetPosition(x,y)
{this.x=x;this.y=y;this.slider.style.left=this.x+"px";this.slider.style.top=this.y+"px";this.UpdateThumbPosition(true);}
function SliderControlSetTracking(x,y)
{this.trackX=x;this.trackY=y;this.UpdateThumbPosition(true);}
function SliderControlNotify(x,y)
{}
function SliderControlUpdateThumbPosition(notify)
{if(this.trackX){this.thumbWidth=this.thumbSize;}
else
{this.thumbWidth=this.width;}
if(this.trackY){this.thumbHeight=this.thumbSize;}
else
{this.thumbHeight=this.height;}
this.thumb.style.width=this.thumbWidth+"px";this.thumb.style.height=this.thumbHeight+"px";if(this.mouseX>this.width-this.thumbWidth/2)
{this.mouseX=Math.round(this.width-this.thumbWidth/2);}
if(this.mouseY>this.height-this.thumbHeight/2)
{this.mouseY=Math.round(this.height-this.thumbHeight/2);}
if(this.mouseX<this.thumbWidth/2)
{this.mouseX=Math.round(this.thumbWidth/2);}
if(this.mouseY<this.thumbHeight/2)
{this.mouseY=Math.round(this.thumbHeight/2);}
if(!this.trackX)
{this.mouseX=Math.round(this.width/2);}
if(!this.trackY)
{this.mouseY=Math.round(this.height/2);}
if(this.trackX){this.xValue=Math.round(this.mouseX-this.thumbWidth/2)/(this.width-this.thumbWidth);}
else
{this.xValue=0;}
if(this.trackY){this.yValue=Math.round(this.mouseY-this.thumbHeight/2)/(this.height-this.thumbHeight);}
else
{this.yValue=0;}
this.thumb.style.left=Math.round(this.mouseX-this.thumbWidth/2)+"px";this.thumb.style.top=Math.round(this.mouseY-this.thumbHeight/2)+"px";if(notify)
{if(this.trackY&&this.trackX)
{this.notify(this.xValue,this.yValue);}
if(this.trackY&&!this.trackX)
{this.notify(this.yValue,this.yValue);}
if(!this.trackY&&this.trackX)
{this.notify(this.xValue,this.xValue);}}}
function SliderControlSetColors(color,thumbColor)
{this.color=color;this.thumbColor=thumbColor;this.slider.style.backgroundColor=this.color;this.thumb.style.backgroundColor=this.thumbColor;}
function SliderControlSetValue(x,y,notify)
{this.xValue=x;this.yValue=y;if(x==undefined||isNaN(x))
{x=0.5;}
if(x>1)
{x=1;}
if(x<0)
{x=0;}
if(y==undefined||isNaN(y))
{y=x;}
if(this.trackX){this.xValue=x;this.mouseX=Math.round((this.xValue*(this.width-this.thumbWidth))+this.thumbWidth/2);}
if(this.trackY){this.yValue=y;this.mouseY=Math.round((this.yValue*(this.height-this.thumbHeight))+this.thumbHeight/2);}
if(notify==undefined)
{notify=true;}
this.UpdateThumbPosition(notify);}
function SliderControlSetNotifier(func)
{if(typeof func=='function')
{this.notify=func;}
else
{alert('Notifier must be a function with 2 parameters');}}
function SliderControlSetThumbSize(sz)
{this.thumbSize=sz;this.UpdateThumbPosition(true);}
function SliderControlGetPercentY()
{return this.yValue;}
function SliderControlSetPercentY(value)
{this.mouseY=Math.round(value*(this.height-this.thumbHeight)+this.thumbHeight/2);this.UpdateThumbPosition(true);}
function SliderControl(divParent)
{var me=this;this.thumbWidth=17;this.thumbHeight=4;this.thumbSize=4;this.xValue=0;this.yValue=0;this.x=0;this.y=0;this.mouseX=0;this.mouseY=0;this.width=10;this.height=10;this.color='#FFFFFF';this.thumbColor='#000000';this.trackX=true;this.trackY=true;this.isMouseDown=false;this.iYTickNumber=10;this.TickTexts="";this.bYUseTicks=true;this.slider=document.createElement('div');this.slider.className="slider";this.slider.style.zIndex=6;this.slider.style.width=me.width+"px";this.slider.style.height=me.height+"px";this.slider.style.left=me.x+"px";this.slider.style.top=me.y+"px";this.slider.style.backgroundColor=me.color;this.slider.style.visibility='visible';this.slider.style.position='relative';this.slider.style.fontSize='0';this.slider.parent=me;divParent.appendChild(me.slider);this.mouseDown=SliderControlMouseDown;this.setValue=SliderControlSetValue;this.setThumb=SliderControlSetThumb;this.setThumbSize=SliderControlSetThumbSize;this.setSize=SliderControlSetSize;this.setPosition=SliderControlSetPosition;this.setTracking=SliderControlSetTracking;this.setColors=SliderControlSetColors;this.setNotifier=SliderControlSetNotifier;this.setPercentY=SliderControlSetPercentY;this.getPercentY=SliderControlGetPercentY;this.UpdateThumbPosition=SliderControlUpdateThumbPosition;this.mouseUp=SliderControlMouseUp;this.mouseOut=SliderControlMouseOut;this.mouseMove=SliderControlMouseMove;this.notify=SliderControlNotify;this.onThumbMoved=null;this.slider.onmousedown=me.mouseDown;this.slider.onmouseup=me.mouseUp;this.slider.onmouseout=me.mouseOut;this.slider.onmousemove=me.mouseMove;this.thumb=document.createElement('div');this.thumb.className="sliderthumb";this.thumb.style.zIndex=7;this.thumb.style.width=me.thumbWidth+"px";this.thumb.style.height=me.thumbHeight+"px";this.thumb.style.left=me.x+me.mouseX+"px";this.thumb.style.top=me.y+me.mouseY+"px";this.thumb.style.backgroundColor=me.thumbColor;this.thumb.style.visibility='visible';this.thumb.style.position='absolute';this.thumb.style.fontSize='0';this.slider.appendChild(me.thumb);this.thumb.onmousedown=me.mouseDown;this.thumb.onmouseup=me.mouseUp;this.thumb.onmousemove=SliderControlMouseMoveOnThumb;this.thumb.parent=me;this.SliderTickOnMouseOver=SliderTickOnMouseOver;this.SliderTickOnMouseOut=SliderTickOnMouseOut;this.SliderTickOnMouseOverInternal=function(pEvent){if(me.SliderTickOnMouseOver)me.SliderTickOnMouseOver(pEvent);}
this.SliderTickOnMouseOutInternal=function(pEvent){if(me.SliderTickOnMouseOut)me.SliderTickOnMouseOut(pEvent);}
this.GetTickDiv=function(iTick)
{var i=0;for(var div=me.slider.firstChild;div!=null;div=div.nextSibling)
{if(div.className!='slidertick')
continue;if(i==iTick)
return div;i++;}
return;}
document.onmouseup=SliderControlDocMouseUp;}

function DistanceMeter(graphics,dMeterPerPixelX,dMeterPerPixelY,parentDiv,pDistancePolyLine)
{var me=this;this.iMaxRubberLength=750;this.iDistPoints=0;this.iDistance=0;this.iDistX=0;this.iDistY=0;this.iLastMoveX=0;this.iLastMoveY=0;this.graphics=graphics;this.rubberLine=null;this.cursorParent=parentDiv;this.cursorList=new Array();this.divDisplay=null;this.dMeterPerPixelX=dMeterPerPixelX;this.dMeterPerPixelY=dMeterPerPixelY;this.pPolyLine=pDistancePolyLine;this.iMoveToX=0;this.iMoveToY=0;this.bMoving=false;this.onInit=null;this.onMove=null;this.onClose=null;this.DisplayLength=null;this.Init=function()
{me.iDistPoints=0;me.iDistance=0;if(me.onInit)
me.onInit();me.CreateDistCursor("imgDistCursor",0,0,false);}
this.Close=function()
{me.ClearRubberLine();me.ClearCursors();if(me.onClose)
me.onClose();}
this.GetLastDistance=function(iX,iY)
{var x=(iX-me.iDistX)*me.dMeterPerPixelX/1000;var y=(iY-me.iDistY)*me.dMeterPerPixelY/1000;var x2=Math.pow(x,2);var y2=Math.pow(y,2);var res=Math.sqrt(x2+y2)*1000;return res;}
this.AddDistPoint=function(iX,iY)
{++me.iDistPoints;if(me.iDistPoints>1)
{me.graphics.drawLine(me.iDistX,me.iDistY,iX,iY,2,true);me.iDistance+=me.GetLastDistance(iX,iY);}
me.iLastMoveX=me.iDistX=iX;me.iLastMoveY=me.iDistY=iY;}
this.CreateDistCursor=function(id,iX,iY,bShow)
{var img=NewTag("img",me.cursorParent);me.cursorList[me.cursorList.length]=img;img.setAttribute("id",id);img.setAttribute("class","distcursor");if(!bShow)
img.style.visibility="hidden";img.style.position="absolute";SetImage(img,GetAbsUrl("images/mapctrl/cross.gif"),15,15);img.style.left=(iX-8)+"px";img.style.top=(iY-8)+"px";}
this.iCounter=0;this.MoveDistCursor=function(iX,iY)
{me.iMoveToX=iX;me.iMoveToY=iY;if(me.bMoving==false)
{me.bMoving=true;wsto_id=window.setTimeout(me.MoveDistCursorMain,25);}}
this.GetDistXY=function(iLimitL)
{var Len=Math.sqrt((me.iLastMoveX-me.iDistX)*(me.iLastMoveX-me.iDistX)+
(me.iLastMoveY-me.iDistY)*(me.iLastMoveY-me.iDistY));var vex=(me.iLastMoveX-me.iDistX)/Len;var vey=(me.iLastMoveY-me.iDistY)/Len;if(Len>iLimitL)
return[me.iLastMoveX-iLimitL*vex,me.iLastMoveY-iLimitL*vey];else
return[me.iDistX,me.iDistY];}
this.MoveDistCursorMain=function()
{iX=me.iMoveToX;iY=me.iMoveToY;if(iX==me.iLastMoveX&&iY==me.iLastMoveY)
{me.bMoving=false;return;}
me.iLastMoveX=iX;me.iLastMoveY=iY;if(me.rubberLine)
me.graphics.removeShape(me.rubberLine);if(me.onMove)
me.onMove(iX,iY);var id="imgDistCursor";var img=GetBlock(id);if(img)
{img.style.visibility="visible";img.style.left=(iX-8)+"px";img.style.top=(iY-8)+"px";}
if(me.iDistPoints>0)
{me.graphics.penColor="blue";var drawDistXY=me.GetDistXY(me.iMaxRubberLength);me.rubberLine=me.graphics.drawLine(drawDistXY[0],drawDistXY[1],me.iLastMoveX,me.iLastMoveY,2,true);var lastDist=me.GetLastDistance(iX,iY);if(me.DisplayLength)
me.DisplayLength(me.iDistance+me.pPolyLine.dDistanceMeter+lastDist,lastDist);}
me.bMoving=false;}
this.RefreshDistCursor=function(iNewStartX,iNewStartY,iNewEndX,iNewEndY)
{if(me.rubberLine)
{me.iDistX=iNewStartX;me.iDistY=iNewStartY;me.iLastMoveX=iNewEndX;me.iLastMoveY=iNewEndY;me.graphics.removeShape(me.rubberLine);me.graphics.penColor="blue";var drawDistXY=me.GetDistXY(me.iMaxRubberLength);me.rubberLine=me.graphics.drawLine(drawDistXY[0],drawDistXY[1],me.iLastMoveX,me.iLastMoveY,2,true);var id="imgDistCursor";var img=GetBlock(id);if(img)
{img.style.visibility="visible";img.style.left=(iNewEndX-8)+"px";img.style.top=(iNewEndY-8)+"px";}}}
this.SetEndPoint=function(iNewEndX,iNewEndY)
{if(me.rubberLine)
{me.iLastMoveX=iNewEndX;me.iLastMoveY=iNewEndY;me.graphics.removeShape(me.rubberLine);me.graphics.penColor="blue";var drawDistXY=me.GetDistXY(me.iMaxRubberLength);me.rubberLine=me.graphics.drawLine(drawDistXY[0],drawDistXY[1],me.iLastMoveX,me.iLastMoveY,2,true);var id="imgDistCursor";var img=GetBlock(id);if(img)
{img.style.visibility="visible";img.style.left=(iNewEndX-8)+"px";img.style.top=(iNewEndY-8)+"px";}}}
this.SetPixelDensity=function(D)
{me.dMeterPerPixelX=D;me.dMeterPerPixelY=D;}
this.ClearRubberLine=function()
{if(me.rubberLine)
me.graphics.clear();}
this.ClearCursors=function()
{for(var i=0;i<me.cursorList.length;i++)
{if(me.cursorList[i]!=null)
{me.cursorList[i].parentNode.removeChild(me.cursorList[i]);me.cursorList[i]=null;}}}}
function DistanceDisplay(tmTopoliszMap)
{this.tmTopoliszMap=tmTopoliszMap;var parentDiv=tmTopoliszMap.pGridMain.mainGridDiv;this.parentDiv=parentDiv;this.mainDiv=NewTag("div",parentDiv);this.mainDiv.className="distpanel";this.mainDiv.style.visibility="hidden";this.distTr=null;this.exitTr=null;var table,tr,td;table=NewTag("table",this.mainDiv);table.cellPadding="0";table.cellSpacing="0";table=NewTag("tbody",table);tr=NewTag("tr",table);this.distTr=tr;td=NewTag("td",tr);td.className="distcaption";NewTextTag(g_Babel.GetWord('MeasureDistance',"Távolságmérés")+":",td);td.style.paddingRight="5px";td.style.paddingLeft="5px";td=NewTag("td",tr);td.className="distvalue";td.style.whiteSpace="nowrap";this.displayLastDist=td;td.style.paddingRight="5px";NewTextTag("0 km",this.displayLastDist);tr=NewTag("tr",table);td=NewTag("td",tr);td.className="distcaption";NewTextTag(g_Babel.GetWord('MeasureTotal',"Összesen")+":",td);td.style.paddingRight="5px";td.style.paddingLeft="5px";td=NewTag("td",tr);td.className="distvalue";td.style.whiteSpace="nowrap";this.displaySumDist=td;td.style.paddingRight="5px";NewTextTag("0 km",this.displaySumDist);tr=NewTag("tr",table);this.exitTr=tr;td=NewTag("td",tr);td.className="distcaption";NewTextTag(g_Babel.GetWord('ExitDistanceMeasuring',"Kilépéshez Esc"),td);td.style.paddingRight="5px";td.style.paddingLeft="5px";td=NewTag("td",tr);td.className="distcaption";td.style.whiteSpace="nowrap";var ExitImage=NewTag("img",td);SetImage(ExitImage,GetAbsUrl("design/ICON_measure_on.gif"),17,17,"Distance");ExitImage.style.top=0+"px";ExitImage.style.left=0+"px";td.style.paddingBottom="5px";var me=this;this.Move=function(iX,iY)
{var mvw=me.tmTopoliszMap.GetMapViewWidth();var mvh=me.tmTopoliszMap.GetMapViewHeight();var mvvx=me.tmTopoliszMap.pGridMain.GetMapViewVectorX();var mvvy=me.tmTopoliszMap.pGridMain.GetMapViewVectorY();var mvt=mvvy;var mvl=mvvx;var mvb=mvt+mvh;var mvr=mvl+mvw;var mdw=GetLayerWidth(me.mainDiv);var mdh=GetLayerHeight(me.mainDiv);var L;if(iX+11+mdw<mvr)
L=iX+11;else
L=mvr-mdw;var H;if(iY+11+mdh<mvb)
H=iY+11;else
H=mvb-mdh;if((iX+11+mdw>=mvr)&&(iY+11+mdh>=mvb))
{L=iX-11-mdw;H=iY-11-mdh;}
me.mainDiv.style.left=L+"px";me.mainDiv.style.top=H+"px";me.mainDiv.style.visibility="visible";}
this.DisplayLength=function(iTotal,iLast)
{me.displaySumDist.lastChild.nodeValue=GetLengthText(iTotal);me.displayLastDist.lastChild.nodeValue=GetLengthText(iLast);}
this.Close=function()
{if(me.mainDiv)
me.mainDiv.parentNode.removeChild(me.mainDiv);}}
function GetLengthText(iMeter)
{var str;iMeter=parseInt(iMeter,10);if(iMeter<1000)
str=iMeter+" m";else
str=(iMeter/1000)+" km";return str;}

function Graphics(canvas)
{this.canvas=canvas;this.cache=new Array;this.shapes=new Object;this.nObject=0;this.penColor="black";this.zIndex=0;var me=this;this.createPlotElement=function(x,y,w,h)
{if(!me.oCanvas)
{if((me.canvas==undefined)||(me.canvas==""))
me.oCanvas=document.body;else
me.oCanvas=document.getElementById(me.canvas);}
var oDiv;if(me.cache.length)
oDiv=me.cache.pop();else
{oDiv=document.createElement('div');me.oCanvas.appendChild(oDiv);oDiv.style.position="absolute";oDiv.style.margin="0px";oDiv.style.padding="0px";oDiv.style.overflow="hidden";oDiv.style.border="0px";}
oDiv.style.zIndex=me.zIndex;oDiv.style.backgroundColor=me.penColor;oDiv.style.left=x+"px";oDiv.style.top=y+"px";oDiv.style.width=w+"px";oDiv.style.height=h+"px";oDiv.style.visibility="visible";return oDiv;}
this.releasePlotElement=function(oDiv)
{oDiv.style.visibility="hidden";me.cache.push(oDiv);}
this.addShape=function(shape)
{shape.oGraphics=me;shape.graphicsID=me.nObject;me.shapes[me.nObject]=shape;me.nObject++;shape.draw();return shape;}
this.removeShape=function(shape)
{if((shape instanceof Object)&&(shape.oGraphics==me)&&(me.shapes[shape.graphicsID]==shape))
{shape.undraw();me.shapes[shape.graphicsID]=undefined;shape.oGraphics=undefined;}}
this.clear=function()
{for(var i in me.shapes)
me.removeShape(me.shapes[i]);}
this.drawLine=function(x1,y1,x2,y2,width,dotted)
{return me.addShape(new Line(x1,y1,x2,y2,width,dotted))}}
function Line(x1,y1,x2,y2,width,dotted)
{this.x1=x1;this.y1=y1;this.x2=x2;this.y2=y2;this.width=width;this.dotted=dotted;var me=this;this.draw=function()
{me.plots=new Array;var dx=me.x2-me.x1;var dy=me.y2-me.y1;var x=me.x1;var y=me.y1;var n=Math.max(Math.abs(dx),Math.abs(dy));dx=dx/n;dy=dy/n;for(i=0;i<=n;i++)
{if(i%5==0||!me.dotted){me.plots.push(me.oGraphics.createPlotElement(Math.round(x),Math.round(y),me.width,me.width));}
x+=dx;y+=dy;}}
this.undraw=function()
{if(me.plots!=undefined)
{while(me.plots.length)
me.oGraphics.releasePlotElement(me.plots.pop());me.plots=undefined;}}}

function CMiniMapInfo()
{this.iInnerFrameWidth=0;this.iInnerFrameHeight=0;this.iInnerFrameTop=0;this.iInnerFrameLeft=0;}
function CMiniMapFrame(pMainMap,pMiniMap)
{this.pMainMap=pMainMap;this.pMiniMap=pMiniMap;this.divFrameFill=null;this.divFrame=null;this.divSecFrame=null;this.divSecFrameFill=null;var me=this;me.miniMapMargin=2;me.miniMapFrameBorder=2;me.miniMapSecFrameFillBorder=1;this.MouseMoveOnFrame=function(pEvent)
{me.pMiniMap.OnMouseMoveFunc(pEvent);StopEventPropagation(pEvent);return false;}
this.MouseOutOnMovingFrame=function(pEvent)
{me.divSecFrame.style.visibility="hidden";me.divSecFrameFill.style.visibility="hidden";me.pMiniMap.bFrameMouseDown=false;StopEventPropagation(pEvent);return false;}
this.MouseOutOnFrame=function(pEvent)
{StopEventPropagation(pEvent);return false;}
this.MouseUpOnFrame=function(pEvent)
{if(pEvent==undefined)
{me.pMiniMap.bFrameMouseDown=false;me.divSecFrame.style.visibility="hidden";StopEventPropagation(pEvent);document.onselectstart=function(){return true;};return false;}
var x=GetLayerX(pEvent);var y=GetLayerY(pEvent);me.pMiniMap.OnMouseUpFunc(x,y,pEvent);me.pMiniMap.bFrameMouseDown=false;me.divSecFrame.style.visibility="hidden";StopEventPropagation(pEvent);document.onselectstart=function(){return true;};return false;}
this.MouseDownOnFrame=function(pEvent)
{document.onselectstart=function(){return false;};me.ReArrange();var x=GetLayerX(pEvent);var y=GetLayerY(pEvent);var fb=me.miniMapFrameBorder;var ww=GetLayerWidth(me.divFrame);var hh=GetLayerHeight(me.divFrame);if((x<0)||(y<0)||(x>=ww-2*fb)||(y>=hh-2*fb))
return false;me.divSecFrame.style.visibility='visible';me.divSecFrameFill.style.visibility='visible';x+=me.GetFrameLeft();y+=me.GetFrameTop();me.pMiniMap.bFrameMouseDown=true;me.pMiniMap.iFrameMouseX=x;me.pMiniMap.iFrameMouseY=y;me.pMiniMap.iFrameMouseStartX=GetEventXNew(pEvent);me.pMiniMap.iFrameMouseStartY=GetEventYNew(pEvent);StopEventPropagation(pEvent);return false;}
this.Init=function()
{setAlpha(".minimapsecframefill");setAlpha(".minimapframefill");me.divFrameFill=document.createElement("div");me.divFrameFill.id=me.pMiniMap.divMap.id+"_framefill";me.pMiniMap.divFace.appendChild(me.divFrameFill);me.divFrameFill.className="minimapframefill";SetOpac(me.divFrameFill,35);me.divFrame=document.createElement("div");me.divFrame.id=me.pMiniMap.divMap.id+"_frame";me.pMiniMap.divFace.appendChild(me.divFrame);me.divFrame.className="minimapframe";me.divFrame.onmousemove=me.MouseMoveOnFrame;me.divFrame.onmousedown=me.MouseDownOnFrame;me.divFrame.onmouseup=me.MouseUpOnFrame;me.divFrame.onmouseout=me.MouseOutOnFrame;me.divSecFrame=document.createElement("div");me.divSecFrame.style.visibility='hidden';me.divSecFrame.id=me.pMiniMap.divMap.id+"_secframe";me.pMiniMap.divFace.appendChild(me.divSecFrame);me.divSecFrame.className="minimapsecframe";me.divSecFrame.onmouseout=me.MouseOutOnMovingFrame;me.divSecFrameFill=document.createElement("div");me.divSecFrameFill.style.visibility='hidden';me.divSecFrameFill.id=me.pMiniMap.divMap.id+"_secframefill";me.pMiniMap.divFace.appendChild(me.divSecFrameFill);me.divSecFrameFill.className="minimapsecframefill";SetOpac(me.divSecFrameFill,35);}
this.ReArrange=function(bCaseMapResize)
{var mainMapPD=me.pMainMap.GetPixelDensity();var miniMapPD=me.pMiniMap.GetPixelDensity();var ratio=mainMapPD/miniMapPD;var mainAbsLeft=me.pMainMap.pGridMain.GetViewAbsoluteLeft();var mainAbsTop=me.pMainMap.pGridMain.GetViewAbsoluteTop();var miniAbsLeft=me.pMiniMap.pGridMain.GetViewAbsoluteLeft();var miniAbsTop=me.pMiniMap.pGridMain.GetViewAbsoluteTop();var FW=Math.ceil(me.pMainMap.GetMapViewWidth()*ratio);var FH=Math.ceil(me.pMainMap.GetMapViewHeight()*ratio);var SFW=FW;var SFH=FH;var SFFW=SFW-2*me.miniMapSecFrameFillBorder;var SFFH=SFH-2*me.miniMapSecFrameFillBorder;if(SFFW<0)SFFW=0;if(SFFH<0)SFFH=0;var SFW=FW;var SFH=FH;var SFFW=Math.max(SFW-2*me.miniMapSecFrameFillBorder,0);var SFFH=Math.max(SFH-2*me.miniMapSecFrameFillBorder,0);var FL=Math.ceil(mainAbsLeft*ratio)-miniAbsLeft-(me.miniMapMargin+1);var FT=Math.ceil(mainAbsTop*ratio)-miniAbsTop-(me.miniMapMargin+1);var oldFL=GetLayerLeft(me.divFrame)+me.miniMapFrameBorder;var oldFT=GetLayerTop(me.divFrame)+me.miniMapFrameBorder;if(((Math.abs(FL-oldFL)>1)||(Math.abs(FT-oldFT)>1))||(bCaseMapResize==true))
{me.divFrame.style.width=FW+"px";me.divFrame.style.height=FH+"px";me.divFrame.style.left=(FL-me.miniMapFrameBorder)+"px";me.divFrame.style.top=(FT-me.miniMapFrameBorder)+"px";me.divFrameFill.style.width=FW+"px";me.divFrameFill.style.height=FH+"px";me.divFrameFill.style.left=FL+"px";me.divFrameFill.style.top=FT+"px";me.divSecFrame.style.width=SFW+"px";me.divSecFrame.style.height=SFH+"px";me.divSecFrame.style.left=FL+"px";me.divSecFrame.style.top=FT+"px";me.divSecFrameFill.style.width=SFFW+"px";me.divSecFrameFill.style.height=SFFH+"px";me.divSecFrameFill.style.left=FL+"px";me.divSecFrameFill.style.top=FT+"px";}
else
{me.divSecFrame.style.left=oldFL+"px";me.divSecFrame.style.top=oldFT+"px";me.divSecFrameFill.style.left=oldFL+"px";me.divSecFrameFill.style.top=oldFT+"px";}}
this.GetFrameTop=function()
{return GetLayerTop(me.divFrame);}
this.GetFrameLeft=function()
{return GetLayerLeft(me.divFrame);}
me.Init();}

function CPolyline()
{this.PointsX=new Array();this.PointsY=new Array();this.PointNum=0;this.dDistanceMeter=0;this.arrPointsPixelX=new Array();this.arrPointsPixelY=new Array();var me=this;this.AddPoint=function(y,x)
{me.PointsX[me.PointsX.length]=x;me.PointsY[me.PointsY.length]=y;me.PointNum++;}
this.Init=function()
{me.PointsX=new Array();me.PointsY=new Array();me.PointNum=0;me.dDistanceMeter=0;}
this.GetXs=function()
{var str="";var i;for(i=0;i<me.PointsX.length;i++)
{str+=me.PointsX[i];if(i<me.PointsX.length-1)
str+="|";}
return str;}
this.GetYs=function()
{var str="";var i;for(i=0;i<me.PointsY.length;i++)
{str+=me.PointsY[i];if(i<me.PointsY.length-1)
str+="|";}
return str;}
this.SetPointsPixelX=function(arrX)
{me.arrPointsPixelX=arrX;}
this.SetPointsPixelY=function(arrY)
{me.arrPointsPixelY=arrY;}
this.GetLastPointPixelX=function()
{var iLength=GetArrayLength(me.arrPointsPixelX);if(iLength>0)
return me.arrPointsPixelX[iLength-1];return-1;}
this.GetLastPointPixelY=function()
{var iLength=GetArrayLength(me.arrPointsPixelY);if(iLength>0)
return me.arrPointsPixelY[iLength-1];return-1;}}

function BabelWord(strID,strLangID,strWord)
{this.strID=(strID!=undefined?strID:"");this.strLangID=(strLangID!=undefined?strLangID:"");this.strWord=(strWord!=undefined?strWord:"");};function Babel(arrBabelWords)
{this.strLangID="hu";this.mapWordsByLangAndID=new Object();this.arrChangeListeners=new Array();var me=this;this.AddWord=function(babelWord)
{if(babelWord!=null)
{if(me.mapWordsByLangAndID[babelWord.strLangID]==undefined)
{me.mapWordsByLangAndID[babelWord.strLangID]=new Object();}
me.mapWordsByLangAndID[babelWord.strLangID][babelWord.strID]=babelWord.strWord;}}
this.Init=function()
{var i;var iLength=(arrBabelWords!=null?arrBabelWords.length:0);for(i=0;i<iLength;i++)
{me.AddWord(arrBabelWords[i]);}
if(typeof(g_strLangID)!='undefined')
{me.strLangID=g_strLangID;}
if(me.mapWordsByLangAndID[me.strLangID]==null)
{me.strLangID="hu";}}
me.Init();this.SetLang=function(strLangID)
{if(me.strLangID!=strLangID)
{me.strLangID=strLangID;var i;for(i=0;i<me.arrChangeListeners.length;i++)
{if(me.arrChangeListeners[i]!=null)
{me.arrChangeListeners[i]();}}}}
this.GetLang=function()
{return me.strLangID;}
this.GetWord=function(strID,strDefault)
{if(me.mapWordsByLangAndID&&me.mapWordsByLangAndID[me.strLangID]&&me.mapWordsByLangAndID[me.strLangID][strID]!=undefined)
{return me.mapWordsByLangAndID[me.strLangID][strID];}
if(strDefault!=null&&strDefault!=undefined)
return strDefault;return"";}
this.AddListener=function(func)
{var i=0;for(i=0;i<me.arrChangeListeners.length;i++)
{if(me.arrChangeListeners[i]==null||me.arrChangeListeners[i]==undefined)
break;}
me.arrChangeListeners[i]=func;return i;}
this.GetListener=function(idListener)
{return me.arrChangeListeners[idListener];}
this.DeleteListener=function(idListener)
{me.arrChangeListeners[idListener]=null;}}

function Marker(pTopoliszMap,mainType,dX,dY,arrNames,arrValues)
{this.pTopoliszMap=pTopoliszMap;this.mainType=mainType;this.dX=dX;this.dY=dY;this.arrNames=arrNames;this.arrValues=arrValues;this.bLabelBoxMustBeVisible=false;this.bDetailsMustBeVisible=false;this.iPixX=null;this.iPixY=null;this.sID=null;this.bHandleDetails=true;this.pLabel=null;this.pVPLI=null;this.bContentLoaded=true;this.bMouseOverEnabled=true;this.bLongMouseOver=false;this.DrawSign_Custom=null;this.DrawBox_Custom=null;this.DrawBoxHeader_Custom=null;this.DrawBoxContent_Custom=null;this.DrawBoxContentData=null;this.DrawCustomButtons=null;this.m_bSignlessActive=false;var me=this;this.SetPixelCoordinates=function(iX,iY)
{me.iPixX=iX;me.iPixY=iY;}
this.Clone=function()
{var baby=new Marker(me.pTopoliszMap,me.sID,me.dX,me.dY,me.arrNames,me.arrValues);return baby;}
this.DeleteLabel=function()
{if(me.pLabel)
{me.pLabel.Delete();delete me.pLabel;me.pLabel=null;}}
this.GetProperty=function(name)
{if(me.arrNames==null)
return"???";var i;for(i=0;i<me.arrNames.length;i++)
{if(me.arrNames[i]==name)
return me.arrValues[i];}
return"???";}
this.IsLabelBoxVisible=function()
{if(!me.pLabel)
return false;else
return me.pLabel.IsLabelBoxVisible();}
this.SetProperty=function(name,value)
{if(me.arrNames==null)
me.arrNames=new Array();if(me.arrValues==null)
me.arrValues=new Array();var i;for(i=0;i<me.arrNames.length;i++)
{if(me.arrNames[i]==name)
{me.arrValues[i]=value;return;}}
me.arrNames.push(name);me.arrValues.push(value);}
this.ArrNamesAsString=function()
{var str="";var i;for(i=0;i<me.arrNames.length;i++)
{str=str+me.arrNames[i]+"#";}
return str;}
this.ArrValuesAsString=function()
{var str="";var i;for(i=0;i<me.arrValues.length;i++)
{str=str+me.arrValues[i]+"#";}
return str;}
this.GetLabelCaption=function(name)
{return me.GetProperty("caption");}
this.IsSignless=function()
{if(me.GetProperty("pin_img_url")=="???")
return true;else
return false;}
this.HasWGSCoords=function()
{var bCoordIsSet=((me.dX!=0)||(me.dY!=0));return bCoordIsSet;}
this.ToAddress=function()
{var address=new Object();address.dX=me.dX;address.dY=me.dY;address.strName="";address.strAddress="";if(me.GetProperty("Név")!="???")
address.strName=me.GetProperty("Név");else if(me.GetProperty("caption")!="???")
address.strName=me.GetProperty("caption");if(me.GetProperty("Cím")!="???")
address.strAddress=me.GetProperty("Cím");else if(me.GetProperty("caption")!="???")
address.strAddress=me.GetProperty("caption");if(address.strAddress!=address.strName)
{var idxFirstSpace=address.strAddress.indexOf(' ');var alreadyExists=address.strName.indexOf('(');if((idxFirstSpace!=-1)&&(alreadyExists==-1))
{var firstChar=address.strAddress.charAt(0);if((firstChar!='0')&&(firstChar!='1')&&(firstChar!='2')&&(firstChar!='3')&&(firstChar!='4')&&(firstChar!='5')&&(firstChar!='6')&&(firstChar!='7')&&(firstChar!='8')&&(firstChar!='9'))
{if(address.strAddress.charAt(idxFirstSpace-1)==',')idxFirstSpace--;var strCity=address.strAddress.substring(0,idxFirstSpace);address.strName=address.strName+" ("+strCity+")";}
else
{var idxSecondSpace=address.strAddress.indexOf(' ',idxFirstSpace+1);if(address.strAddress.charAt(idxSecondSpace-1)==',')idxSecondSpace--;if(idxSecondSpace!=-1)
{var strCity=address.strAddress.substring(idxFirstSpace+1,idxSecondSpace);address.strName=address.strName+" ("+strCity+")";}}}}
else
{address.strName="";}
return address;}
this.OnLabelSignClick=function(pEvent)
{me.pTopoliszMap.OnLabelSignClick(me);return false;}
this.OnLabelSignMouseOver=function(pEvent)
{me.pTopoliszMap.OnLabelSignMouseOver(me);return false;}
me.SetProperty("label_css_classname","label_v2");me.SetProperty("labelbox_css_classname","label_box");me.SetProperty("list_css_classname","poi_list_row");me.SetProperty("close_button",true);me.SetProperty("fix_label_on_click",false);var func_label_sign_on_click=function(){}
me.SetProperty("func_label_sign_on_click",func_label_sign_on_click);}
function Markers()
{this.arrMarkers=new Array();this.m_iLastID=0;var me=this;this.Clone=function()
{var baby=new Markers();for(var i=0;i<me.arrMarkers.length;i++)
{if(me.arrMarkers[i]!=null)
{baby.arrMarkers[baby.arrMarkers.length]=me.arrMarkers[i];}}
return baby;}
this.Find=function(id)
{var i;for(i=0;i<me.arrMarkers.length;i++)
{if(me.arrMarkers[i]!=null)
{if(id==me.arrMarkers[i].sID)
return me.arrMarkers[i];}}
return null;}
this.FindIdx=function(id)
{var i;for(i=0;i<me.arrMarkers.length;i++)
{if(me.arrMarkers[i]!=null)
{if(id==me.arrMarkers[i].sID)
return i;}}
return-1;}
this.Add=function(marker)
{marker.sID=me.m_iLastID;me.m_iLastID++;me.arrMarkers[me.arrMarkers.length]=marker;return marker;}
this.Delete=function(id)
{var idx=me.FindIdx(id);if(idx!=-1)
{me.arrMarkers[idx].DeleteLabel();delete me.arrMarkers[idx];me.arrMarkers[idx]=null;}}
this.DeleteAll=function()
{var i;for(i=0;i<me.arrMarkers.length;i++)
{if(me.arrMarkers[i]!=null)
me.arrMarkers[i].DeleteLabel();}
delete me.arrMarkers;me.arrMarkers=new Array();}
this.DeleteAllWithType=function(type)
{var arrCleaned=new Array();var i;for(i=0;i<me.arrMarkers.length;i++)
{if(me.arrMarkers[i]!=null)
{if(me.arrMarkers[i].mainType==type)
{me.arrMarkers[i].DeleteLabel();delete me.arrMarkers[i];me.arrMarkers[i]=null;}
else
{arrCleaned.push(me.arrMarkers[i]);}}}
delete me.arrMarkers;me.arrMarkers=arrCleaned;}
this.GetUrl=function()
{var strIDs="";var strXs="";var strYs="";for(i=0;i<me.arrMarkers.length;i++)
{if(me.arrMarkers[i]!=null)
{if(strIDs!="")
{strIDs+="|";strXs+="|";strYs+="|";}
strIDs+=me.arrMarkers[i].sID;strXs+=me.arrMarkers[i].dX;strYs+=me.arrMarkers[i].dY;}}
var strUrl="arrMarkerIDs="+strIDs+"&arrMarkerX="+strXs+"&arrMarkerY="+strYs;return strUrl;}
this.GetUrlParams=function(filterFunc)
{var strIDs="";var strXs="";var strYs="";var strTexts="";for(i=0;i<me.arrMarkers.length;i++)
{var pMarker=me.arrMarkers[i];if(pMarker!=null)
{if(filterFunc!=null)
{if(!filterFunc(pMarker))
continue;}
if(strIDs!="")
{strIDs+="|";strXs+="|";strYs+="|";strTexts+="|";}
strIDs+=pMarker.sID;strXs+=pMarker.dX;strYs+=pMarker.dY;var strNumber=pMarker.GetProperty("pinnumber");if(strNumber!="???"&&strNumber!="0")
{strTexts+=strNumber;}}}
return{"arrMarkerIDs":strIDs,"arrMarkerX":strXs,"arrMarkerY":strYs,"arrMarkerText":strTexts};}
this.GetMouseOutDistance=function()
{return 10;}
this.GetPinNearXY=function(x,y)
{var method="combi";if(method=="firstnear")
{var i;for(i=me.arrMarkers.length-1;i>=0;i--)
{var pPin=me.arrMarkers[i];if(pPin!=null)
{if(pPin.m_bSignlessActive)
{if((Math.abs((pPin.iPixX-x))<10)&&(Math.abs((pPin.iPixY-y))<10))
{return pPin;}}}}
return null;}
else if(method=="nearest")
{var i;var mindistsqr=-1;var pRetPin=null;for(i=0;i<me.arrMarkers.length;i++)
{var pPin=me.arrMarkers[i];if(pPin!=null)
{if(pPin.m_bSignlessActive)
{if((Math.abs((pPin.iPixX-x))<15)&&(Math.abs((pPin.iPixY-y))<15))
{var distsqr=(pPin.iPixX-x)*(pPin.iPixX-x)+(pPin.iPixY-y)*(pPin.iPixY-y);if((distsqr<mindistsqr)||(mindistsqr==-1))
{mindistsqr=distsqr;pRetPin=pPin;}}}}}
return pRetPin;}
else if(method=="combi")
{var i;var mindistsqr=-1;var pRetPin=null;for(i=me.arrMarkers.length-1;i>=0;i--)
{var pPin=me.arrMarkers[i];if(pPin!=null)
{if(pPin.m_bSignlessActive)
{if((Math.abs((pPin.iPixX-x))<15)&&(Math.abs((pPin.iPixY-y))<15))
{var distsqr=(pPin.iPixX-x)*(pPin.iPixX-x)+(pPin.iPixY-y)*(pPin.iPixY-y);if((distsqr<mindistsqr)||(mindistsqr==-1))
{mindistsqr=distsqr;pRetPin=pPin;}
if(distsqr<=25)
{return pPin;}}}}}
return pRetPin;}}}

function GetCoords(iT,iL,iRX,iRY,iWT,iWL,iWW,iWH,iBW,iBH)
{var mvt=iWT;var mvl=iWL;var mvb=iWT+iWH;var mvr=iWL+iWW;var mdw=iBW;var mdh=iBH;var oL;if(iL+mdw<mvr)
oL=iL;else
oL=mvr-mdw;var oT;if(iT+mdh<mvb)
oT=iT;else
oT=mvb-mdh;if((iL+mdw>=mvr)&&(iT+mdh>=mvb))
{oL=iL-mdw;oT=iT-mdh;}
if(((mvt<=iT+iRY)&&(iT+iRY<=mvb))&&((mvl+iRX<=iL)&&(iL+iRX<=mvr)))
return[oT,oL];else if((mvt<=iT+iRY)&&(iT+iRY<=mvb))
return[oT,iL];else
return[iT,iL];}
function GetPxlX(label)
{return label.pMarker.iPixX-label.pMap.pGridMain.GetMapViewVectorX();}
function GetPxlY(label)
{return label.pMarker.iPixY-label.pMap.pGridMain.GetMapViewVectorY();}
function SetSignParamsG(label,strClass,strImgUrl,iImgWidth,iImgHeight,iImgRefX,iImgRefY)
{label.strCssClass=strClass;label.strImgUrl=strImgUrl;label.iImgWidth=iImgWidth;label.iImgHeight=iImgHeight;label.iImgRefX=iImgRefX;label.iImgRefY=iImgRefY;}
function FormatCoordG(dX,dY)
{var str="";if(isFinite(dX)&&isFinite(dY)&&(dX!=0||dY!=0))
{str=(dY<0)?"S":"N";str+=(Math.round(dY*100000)/100000);str+="°; ";str+=(dX<0)?"W":"E";str+=(Math.round(dX*100000)/100000);str+="°";}
return str;}
function GetLabelCaptionClassG()
{if(typeof(g_TopoliszControls)!='undefined'&&g_TopoliszControls!=null)
{if(g_TopoliszControls.pLogin&&g_TopoliszControls.pLogin&&g_TopoliszControls.pLogin.name)
return"labelcaptionlogged";}
return"labelcaption";}
function PreLabelCreateG(pLabel)
{if(pLabel&&pLabel.pMap)
{if(pLabel.pMap.PreLabelCreate)
{try
{pLabel.pMap.PreLabelCreate(pLabel);}
catch(e)
{}}}}
function OnLabelCreateG(pLabel)
{if(pLabel&&pLabel.pMap)
{if(pLabel.pMap.OnLabelCreate)
{try
{pLabel.pMap.OnLabelCreate(pLabel);}
catch(e)
{}}}}
function PinLabel(tmTopoliszMap,pMarker)
{this.pMap=tmTopoliszMap;this.divParent=tmTopoliszMap.divPoiParent;this.divLabelSign=null;this.pMarker=pMarker;this.divLabelBox=null;this.divLabelBoxHeader=null;this.divLabelBoxContent=null;this.aDetails=null;this.divDetails=null;this.iImgRefX=2;this.iImgRefY=14;this.iImgWidth=16;this.iImgHeight=16;this.iPxlX=pMarker.iPixX-tmTopoliszMap.pGridMain.GetMapViewVectorX();this.iPxlY=pMarker.iPixY-tmTopoliszMap.pGridMain.GetMapViewVectorY();this.iLabDX=pMarker.GetProperty("label_dx");this.iLabDY=pMarker.GetProperty("label_dy");this.iLabW=0;this.iLabH=0;this.iLabLegD=0;this.iLabLegY=0;if(this.iLabDX=="???")this.iLabDX=0;if(this.iLabDY=="???")this.iLabDY=0;this.registeredButtons=null;this.divAddMapIcon=null;this.strCssClass=pMarker.GetProperty("div_label_sign_class");this.strImgUrl=GetAbsUrl("images/mapctrl/marker.gif");this.bDeleteMarkerOnLabelClose=false;this.strID=pMarker.sID;this.m_bSignless=true;this.m_bPositionCorrection=true;this.divLabelLeg=null;this.divLabelBox2=null;if(this.pMap.iLabelDesignVersion==1)
this.m_Position="undersign";else
this.m_Position="abovesign";this.bHandleDetails=pMarker.bHandleDetails;var me=this;this.GetDesignVersion=function()
{if((me.pMap.iLabelDesignVersion!=null)&&(me.pMap.iLabelDesignVersion!=undefined))
{return me.pMap.iLabelDesignVersion;}
return 1;}
this.OnDelete=function(pEvent)
{if(me.bDeleteMarkerOnLabelClose)
{me.RemoveBox();me.pMap.pMarkers.Delete(me.strID);}
else
{me.RemoveBox();}}
this.OnAddRoute=function(pEvent)
{var addressList=me.pMap.pRouteSearch.GetAddressList();addressList[GetArrayLength(addressList)]=me.pMarker.ToAddress();me.pMap.pRouteSearch.SetAddressList(addressList);me.pMap.pRouteSearch.FindRoute(false);if(me.divAddMapIcon!=null)
me.divAddMapIcon.style.display="none";}
this.WGSDataArrived=function(result,func)
{me.pMarker.dX=result.arrRecords[0].dX;me.pMarker.dY=result.arrRecords[0].dY;if(me.pMarker.HasWGSCoords())
func();}
this.OnAddStartAddress=function(pEvent)
{if(me.pMap.OnAddStartAddress!=null)
{me.pMap.OnAddStartAddress(me.pMarker);}
else
{var ServerID=me.pMarker.GetProperty("get_wgs_from_server");if(me.pMarker.HasWGSCoords())
{g_TopoliszControls.ShowRouteSearch();me.pMap.pRouteSearch.SetStartAddress(me.pMarker.ToAddress());}
else if(ServerID!="???")
{me.pMap.NoSessionServer.CallFunction("SearchPoi","iID="+ServerID,0,me.WGSDataArrived,me.OnAddStartAddress);}}}
this.OnAddStopAddress=function(pEvent)
{if(me.pMap.OnAddStopAddress!=null)
{me.pMap.OnAddStopAddress(me.pMarker);}
else
{var ServerID=me.pMarker.GetProperty("get_wgs_from_server");if(me.pMarker.HasWGSCoords())
{g_TopoliszControls.ShowRouteSearch();me.pMap.pRouteSearch.SetStopAddress(me.pMarker.ToAddress());}
else if(ServerID!="???")
{me.pMap.NoSessionServer.CallFunction("SearchPoi","iID="+ServerID,0,me.WGSDataArrived,me.OnAddStopAddress);}}}
this.OnAddThroughAddress=function(pEvent)
{var ServerID=me.pMarker.GetProperty("get_wgs_from_server");if(me.pMarker.HasWGSCoords())
{g_TopoliszControls.ShowRouteSearch();me.pMap.pRouteSearch.AddThroughAddress(me.pMarker.ToAddress());}
else if(ServerID!="???")
{me.pMap.NoSessionServer.CallFunction("SearchPoi","iID="+ServerID,0,me.WGSDataArrived,me.OnAddThroughAddress);}}
this.DrawSign=function()
{if(me.pMarker.DrawSign_Custom!=null)
me.pMarker.DrawSign_Custom();else
me.DrawSign_Default();}
this.DrawBox=function()
{if(me.pMarker.DrawBox_Custom!=null)
me.pMarker.DrawBox_Custom(me);else
me.DrawBox_Default();}
this.DrawBoxHeader=function()
{if(me.pMarker.DrawBoxHeader_Custom!=null)
me.pMarker.DrawBoxHeader_Custom(me.divLabelBox);else
me.DrawBoxHeader_Default();}
this.DrawBoxContent=function()
{if(me.pMarker.DrawBoxContent_Custom!=null)
me.pMarker.DrawBoxContent_Custom(me.divLabelBox);else
me.DrawBoxContent_Default();}
this.DrawBoxContent_Default=function()
{if(me.GetDesignVersion()==1)
return me.DrawBoxContent_Default_v1();else
return me.DrawBoxContent_Default_v2();}
this.DrawBoxHeader_Default=function()
{if(me.divLabelBoxHeader==null)
return;if(me.GetDesignVersion()==1)
return me.DrawBoxHeader_Default_v1();else
return me.DrawBoxHeader_Default_v2();}
this.DrawBoxContent_Default_v2=function()
{return me.DrawBoxContent_Default_v1();}
this.DrawBoxContent_Default_v1=function()
{if(me.pMarker.GetProperty("show_coordinates"))
{var divCoord=NewTag('div',me.divLabelBoxContent);NewTextTag(FormatCoordG(me.pMarker.dX,me.pMarker.dY),divCoord);divCoord.ondragstart=function(){return false;};divCoord.onselectstart=function(){return false;};}
if(me.pMarker.DrawBoxContentData!=null)
me.pMarker.DrawBoxContentData(me.divLabelBoxContent);if(me.pMarker.GetProperty("handle_details"))
{var oDetails=me.pMarker.GetProperty("details_to_show");var bShowLink=false;if(oDetails!="???")
{var containerdiv=NewTag("div",me.divLabelBoxContent);me.divDetails=NewTag("div",containerdiv);me.divDetails.style.display=(me.pMarker.bDetailsMustBeVisible?"":"none");AddTag(oDetails,me.divDetails);bShowLink=true;}
var actGetDetails=me.pMarker.GetProperty("get_details_from_server");bShowLink=bShowLink||(actGetDetails!="???");if(bShowLink)
{var detailslinkdiv=NewTag("div",containerdiv);var detailslinkdiv=NewTag("div",me.divLabelBoxContent);detailslinkdiv.style.textAlign="right";me.aDetails=NewTag("a",detailslinkdiv);me.aDetails.onclick=me.ShowHideDetails;me.aDetails.onmousedown=function(e){StopEventPropagation(e);return false;};me.aDetails.setAttribute("href","javascript:void(0)");NewTextTag(g_Babel.GetWord('AddressLabelDetails'),me.aDetails);}}}
this.DrawBoxHeader_Default_v2_callBack=function(hasNorc)
{var tab2=NewTag("table",me.divLabelBoxHeader);tab2.cellSpacing="0";tab2.cellPadding="0";tab2.style.border="0px";var tb2=NewTag("tbody",tab2);var tr2=NewTag("tr",tb2);var td3=NewTag("td",tr2);td3.className="label_caption";AddEvent(td3,"click",me.pMarker.OnLabelSignClick);NewTextTag(me.pMarker.GetLabelCaption(),td3);var td4=NewTag("td",tr2);td4.className="label_buttons";if(me.pMarker.DrawCustomButtons){me.pMarker.DrawCustomButtons(td4,me);}
if(me.pMarker.GetProperty("panorama_button")&&hasNorc&&g_strAppID.toLowerCase()!="trafficnav"){var a=NewTag("a",td4);a.setAttribute("href","javascript:void(0)");NewTextTag(g_Babel.GetWord('capLabHeaderBtnNorc'),a);var NorcLoader=function(serverParams){serverParams=eval(serverParams);me.m_bPositionCorrection=true;me.m_Position="abovesign";if(serverParams!=null){me.divLabelBoxContent.innerHTML="<iframe src='http://www.norc.ro/embed.aspx?id="+serverParams.m_id+"&ppa="+serverParams.m_angle+"&r=0&vla=5&lz=70&acc=f005f0ae-728b-4d6a-9e91-ae03fb095bcd&hrg=0&hrg=0' frameborder='0' scrolling='no' width='360' height='298' top='0' left = '0'></iframe>";}
else{me.divLabelBoxContent.innerHTML="<div style='line-height: 50px; vertical-align: middle; text-align: center'>"+g_Babel.GetWord("noPanorama")+"</div>";}
a.style.display="none";me.ReArrange();}
var NorcQuery=function(param){if(param!=null){me.divLabelBoxContent.innerHTML="<div style='line-height: 50px; vertical-align: middle; text-align: center'><img src='/design/globe32.gif' alt='"+g_Babel.GetWord("loadingPanorama")+"'></img></div>";var strParams="lat="+param.arrRecords[0].dY+"&lon="+param.arrRecords[0].dX;var ajax=new Ajax();ajax.doPost("/norc/norc.ashx",strParams,NorcLoader,"text");}
else{NorcLoader(null);}}
a.onclick=function(e){var ServerID=me.pMarker.GetProperty("get_wgs_from_server");if(me.pMarker.HasWGSCoords())
{var temp=new Object();temp.arrRecords=new Array();temp.arrRecords[0]=me.pMarker;NorcQuery(temp);}
else if(ServerID!="???")
{me.pMap.NoSessionServer.CallFunction("SearchPoi","iID="+ServerID,0,NorcQuery);}
else{NorcQuery(null);}
return false;};a.onmousedown=function(e){StopEventPropagation(e);return false;};a.onmouseover=function(pEvent){g_TopoliszMap.ShowToolTip(pEvent,g_Babel.GetWord('NorcHint'))};a.onmouseout=function(){g_TopoliszMap.HideToolTip()};a.ondragstart=function(){return false;};a.onselectstart=function(){return false;};}
if(me.pMarker.GetProperty("start_button")){var a1=NewTag("a",td4);NewTextTag(g_Babel.GetWord('capLabHeaderBtnStart'),a1);a1.href="javascript:void(0)";a1.onclick=function(e)
{me.OnAddStartAddress();StopEventPropagation(e);return false;};a1.onmousedown=function(e){StopEventPropagation(e);return false;};a1.onmouseover=function(pEvent){g_TopoliszMap.ShowToolTip(pEvent,g_Babel.GetWord('TrafficFromHere'))};a1.onmouseout=function(){g_TopoliszMap.HideToolTip()};a1.ondragstart=function(){return false;};a1.onselectstart=function(){return false;};}
if(me.pMarker.GetProperty("through_button")&&g_strAppID.toLowerCase()!="trafficnav")
{var a2=NewTag("a",td4);a2.href="javascript:void(0)";NewTextTag(g_Babel.GetWord('capLabHeaderBtnThrough'),a2);a2.onclick=function()
{me.OnAddThroughAddress();};a2.onmousedown=function(e){StopEventPropagation(e);return false;};a2.onmouseover=function(pEvent){g_TopoliszMap.ShowToolTip(pEvent,g_Babel.GetWord('Through'))};a2.onmouseout=function(){g_TopoliszMap.HideToolTip()};a2.ondragstart=function(){return false;};a2.onselectstart=function(){return false;};}
if(me.pMarker.GetProperty("stop_button")){var a3=NewTag("a",td4);a3.href="javascript:void(0)";NewTextTag(g_Babel.GetWord('capLabHeaderBtnStop'),a3);a3.onclick=function()
{me.OnAddStopAddress();};a3.onmousedown=function(e){StopEventPropagation(e);return false;};a3.onmouseover=function(pEvent){g_TopoliszMap.ShowToolTip(pEvent,g_Babel.GetWord('TrafficToHere'))};a3.onmouseout=function(){g_TopoliszMap.HideToolTip()};a3.ondragstart=function(){return false;};a3.onselectstart=function(){return false;};}
me.registeredButtons=NewTag("span",td4);if(me.pMarker.GetProperty("close_button"))
{var a5=NewTag("a",td4);NewTextTag("X",a5);a5.onclick=me.OnDelete;a5.onmousedown=function(e){StopEventPropagation(e);return false;};a5.onmouseover=function(pEvent){g_TopoliszMap.ShowToolTip(pEvent,"Bezár")};a5.onmouseout=function(){g_TopoliszMap.HideToolTip()};a5.ondragstart=function(){return false;};a5.onselectstart=function(){return false;};}}
this.DrawBoxHeader_Default_v2=function()
{me.DrawBoxHeader_Default_v2_callBack(true);}
this.DrawBoxHeader_Default_v1=function()
{var caption=NewTag('div',me.divLabelBoxHeader);caption.className=GetLabelCaptionClassG();caption.ondragstart=function(){return false;};caption.onselectstart=function(){return false;};NewTextTag(me.pMarker.GetLabelCaption(),caption);var linkdiv=NewTag("div",me.divLabelBoxHeader);linkdiv.className="labelclose";linkdiv.ondragstart=function(){return false;};linkdiv.onselectstart=function(){return false;};if(me.pMarker.DrawCustomButtons){me.pMarker.DrawCustomButtons(linkdiv,me);}
if(me.pMarker.GetProperty("start_button")){a=NewTag("a",linkdiv);a.setAttribute("href","javascript:void(0)");a.onclick=function(e)
{me.OnAddStartAddress();StopEventPropagation(e);return false;};a.onmousedown=function(e){StopEventPropagation(e);return false;};img=NewTag("img",a);img.paddingRight="2px";SetImage(img,GetAbsUrl("images/trafficctrl/traffic_from_small.gif"),12,12,"");img.onmouseover=function(pEvent){g_TopoliszMap.ShowToolTip(pEvent,g_Babel.GetWord('TrafficFromHere'))};img.onmouseout=function(){g_TopoliszMap.HideToolTip()};img.ondragstart=function(){return false;};img.onselectstart=function(){return false;};}
if(me.pMarker.GetProperty("through_button"))
{a=NewTag("a",linkdiv);a.setAttribute("href","javascript:void(0)");a.onclick=function()
{me.OnAddThroughAddress();};a.onmousedown=function(e){StopEventPropagation(e);return false;};img=NewTag("img",a);img.paddingRight="2px";SetImage(img,GetAbsUrl("images/trafficctrl/traffic_through_small.gif"),12,12,"");img.onmouseover=function(pEvent){g_TopoliszMap.ShowToolTip(pEvent,g_Babel.GetWord('Through'))};img.onmouseout=function(){g_TopoliszMap.HideToolTip()};img.ondragstart=function(){return false;};img.onselectstart=function(){return false;};}
if(me.pMarker.GetProperty("stop_button")){a=NewTag("a",linkdiv);a.setAttribute("href","javascript:void(0)");a.onclick=function()
{me.OnAddStopAddress();};a.onmousedown=function(e){StopEventPropagation(e);return false;};img=NewTag("img",a);img.paddingRight="2px";SetImage(img,GetAbsUrl("images/trafficctrl/traffic_to_small.gif"),12,12,"");img.onmouseover=function(pEvent){g_TopoliszMap.ShowToolTip(pEvent,g_Babel.GetWord('TrafficToHere'))};img.onmouseout=function(){g_TopoliszMap.HideToolTip()};img.ondragstart=function(){return false;};img.onselectstart=function(){return false;};}
me.registeredButtons=NewTag("span",linkdiv);if(me.pMarker.GetProperty("close_button"))
{a=NewTag("a",linkdiv);a.setAttribute("href","javascript:void(0)");a.onclick=me.OnDelete;a.onmousedown=function(e){StopEventPropagation(e);return false;};var img=NewTag("img",a);img.paddingRight="2px";SetImage(img,GetAbsUrl("images/mapctrl/close.gif"),12,12,"");img.onmouseover=function(pEvent){g_TopoliszMap.ShowToolTip(pEvent,"Bezár")};img.onmouseout=function(){g_TopoliszMap.HideToolTip()};img.ondragstart=function(){return false;};img.onselectstart=function(){return false;};}}
this.DrawSign_Default=function()
{me.m_bSignless=(me.pMarker.GetProperty("pin_img_url")=="???");var bNumberedSign=((me.pMarker.GetProperty("pinnumber")!=0)&&(me.pMarker.GetProperty("pinnumber")!="???"));if(!me.m_bSignless||bNumberedSign)
{if(bNumberedSign)
{return me.DrawSign_Numbered();}
var newImg=new Image();newImg.src=me.pMarker.GetProperty("pin_img_url");var iSignImgW=me.pMarker.GetProperty("pin_img_width");if(iSignImgW=="???")iSignImgW=newImg.width;var iSignImgH=me.pMarker.GetProperty("pin_img_height");if(iSignImgH=="???")iSignImgH=newImg.height;SetSignParamsG(me,me.pMarker.GetProperty("pin_css_class"),me.pMarker.GetProperty("pin_img_url"),iSignImgW,iSignImgH,me.pMarker.GetProperty("pin_img_refx"),me.pMarker.GetProperty("pin_img_refy"));me.bDeleteMarkerOnLabelClose=me.pMarker.GetProperty("delete_marker_on_label_close");me.divLabelSign=NewTag("div",me.divParent);me.divLabelSign.className=me.strCssClass;me.divLabelSign.style.position="absolute";me.divLabelSign.style.width=me.iImgWidth+"px";me.divLabelSign.style.height=me.iImgHeight+"px";me.divLabelSign.onselectstart=function(){return false;};me.divLabelSign.ondragstart=function(){return false;};AddEvent(me.divLabelSign,"mouseover",me.pMarker.OnLabelSignMouseOver);AddEvent(me.divLabelSign,"click",me.pMarker.OnLabelSignClick);AddEvent(me.divLabelSign,"click",me.pMarker.GetProperty("func_label_sign_on_click"));me.divLabelSign.ondblclick=function(pEvent){StopEventPropagation(pEvent);return false;}
if((me.pMarker.GetProperty("pinnumber")!=0)&&(me.pMarker.GetProperty("pinnumber")!="???"))
{var imgMarker=NewTag("span",me.divLabelSign);imgMarker.className="findpoinumber";NewTextTag(me.pMarker.GetProperty("pinnumber"),imgMarker);}
else
{var imgMarker=NewTag("img",me.divLabelSign);imgMarker.style.paddingTop="0px";imgMarker.style.top="0px";imgMarker.style.left="0px";SetImage(imgMarker,me.strImgUrl,me.iImgWidth,me.iImgHeight,"");imgMarker.ondragstart=function(){return false;};imgMarker.onselectstart=function(){return false;};}
OnLabelCreateG(me);me.ReArrange();}
else
{me.pMarker.m_bSignlessActive=true;}}
this.DrawSign_Numbered=function()
{me.bDeleteMarkerOnLabelClose=me.pMarker.GetProperty("delete_marker_on_label_close");me.divLabelSign=NewTag("div",me.divParent);me.divLabelSign.style.position="absolute";me.iImgRefX=me.pMarker.GetProperty("pin_img_refx");me.iImgRefY=me.pMarker.GetProperty("pin_img_refy");var strNumber=me.pMarker.GetProperty("pinnumber");var arrDivs=me.DrawStructureNr_1(me.divLabelSign);var divLL=arrDivs[0];var divLBC=arrDivs[1];var divLBH=arrDivs[2];var propColor=me.pMarker.GetProperty("pinnumbercolor");if(propColor=="???")
me.DrawStructureNr_2(divLBH,strNumber);else
me.DrawStructureNr_2(divLBH,strNumber,propColor);me.divLabelSign.style.zIndex=7;divLBH.style.fontSize="20px";me.divLabelSign.onselectstart=function(){return false;};me.divLabelSign.ondragstart=function(){return false;};AddEvent(me.divLabelSign,"mouseover",me.pMarker.OnLabelSignMouseOver);AddEvent(me.divLabelSign,"click",me.pMarker.OnLabelSignClick);AddEvent(me.divLabelSign,"click",me.pMarker.GetProperty("func_label_sign_on_click"));me.divLabelSign.ondblclick=function(pEvent){StopEventPropagation(pEvent);return false;}
OnLabelCreateG(me);me.ReArrange();}
this.DrawBox_Default=function()
{if(me.divLabelBox!=null)
return null;me.divLabelBox=NewTag('div',me.divParent);me.divLabelBox.style.visibility="hidden";me.divLabelBox.style.display="none";me.divLabelBox.ondblclick=function(pEvent){StopEventPropagation(pEvent);return false;}
me.divLabelBox.onclick=function(pEvent){StopEventPropagation(pEvent);return false;}
me.divLabelBox.onmousewheel=function(pEvent){StopEventPropagation(pEvent);return false;}
me.divLabelBox.onselectstart=function(){return false;};me.divLabelBox.ondragstart=function(){return false;};me.divLabelBox.style.left="0px";me.divLabelBox.style.top="0px";me.DrawBoxSkeleton();me.DrawBoxHeader();me.DrawBoxContent();me.divLabelBox.style.visibility="visible";me.divLabelBox.style.display="";me.pMarker.bLabelBoxMustBeVisible=true;me.ReArrange();me.pMap.OnPinLabelBoxCreated(me.pMarker);return me.divLabelBox;}
this.DrawBoxSkeleton=function()
{if(me.divLabelBox==null)
return;if(me.GetDesignVersion()==1)
me.DrawBoxSkeleton_v1();else
me.DrawBoxSkeleton_v2();}
this.DrawBoxSkeleton_v1=function()
{me.divLabelBox.className=me.pMarker.GetProperty("labelbox_css_classname");me.divLabelBoxHeader=NewTag("div",me.divLabelBox);me.divLabelBoxContent=NewTag("div",me.divLabelBox);}
this.DrawBoxSkeleton_v2=function()
{me.divLabelBox.className=me.pMarker.GetProperty("label_css_classname");AddEvent(me.divLabelBox,"click",me.pMarker.OnLabelSignClick);me.divLabelLeg=NewTag("div",me.divLabelBox);me.divLabelLeg.className="label_leg";AddEvent(me.divLabelLeg,"click",me.pMarker.OnLabelSignClick);me.divLabelLeg.style.paddingLeft="0px";if(me.pMarker.GetProperty("LeglessLabel")=="true")
me.divLabelLeg.style.display="none";me.divLabelBox2=NewTag("div",me.divLabelBox);me.divLabelBox2.className=me.pMarker.GetProperty("labelbox_css_classname");var tab1=NewTag("table",me.divLabelBox2);tab1.cellSpacing="0";tab1.cellPadding="0";tab1.style.border="0px";var tb1=NewTag("tbody",tab1);var tr1=NewTag("tr",tb1);tr1.className="lbl_top";var td1=NewTag("td",tr1);td1.className="lbl_left";var td2=NewTag("td",tr1);td2.className="lbl_center";me.divLabelBoxHeader=NewTag("div",td2);var td5=NewTag("td",tr1);td5.className="lbl_right";var tr3=NewTag("tr",tb1);tr3.className="lbl_mid";var td6=NewTag("td",tr3);td6.className="lbl_left";var td7=NewTag("td",tr3);td7.className="lbl_center";me.divLabelBoxContent=NewTag("div",td7);me.divLabelBoxContent.className="label_content";var td8=NewTag("td",tr3);td8.className="lbl_right";var tr4=NewTag("tr",tb1);tr4.className="lbl_bottom";var td9=NewTag("td",tr4);td9.className="lbl_left";var td10=NewTag("td",tr4);td10.className="lbl_center";var td11=NewTag("td",tr4);td11.className="lbl_right";}
this.DrawStructureNr_1=function(divLB)
{var divLL;var divLBC;var divLBH;divLB.className=me.pMarker.GetProperty("label_css_classname");AddEvent(divLB,"click",me.pMarker.OnLabelSignClick);divLL=NewTag("div",divLB);divLL.className="label_leg";AddEvent(divLL,"click",me.pMarker.OnLabelSignClick);divLL.style.paddingLeft="0px";if(me.pMarker.GetProperty("LeglessLabel")=="true")
divLL.style.display="none";var divLabelContentBox=NewTag("div",divLB);divLabelContentBox.className="label_box";var tab1=NewTag("table",divLabelContentBox);tab1.cellSpacing="0";tab1.cellPadding="0";tab1.style.border="0px";var tb1=NewTag("tbody",tab1);var tr1=NewTag("tr",tb1);tr1.className="lbl_top";var td1=NewTag("td",tr1);td1.className="lbl_left";var td2=NewTag("td",tr1);td2.className="lbl_center";divLBH=NewTag("div",td2);var td5=NewTag("td",tr1);td5.className="lbl_right";var tr3=NewTag("tr",tb1);tr3.className="lbl_mid";var td6=NewTag("td",tr3);td6.className="lbl_left";var td7=NewTag("td",tr3);td7.className="lbl_center";divLBC=NewTag("div",td7);divLBC.className="label_content";var td8=NewTag("td",tr3);td8.className="lbl_right";var tr4=NewTag("tr",tb1);tr4.className="lbl_bottom";var td9=NewTag("td",tr4);td9.className="lbl_left";var td10=NewTag("td",tr4);td10.className="lbl_center";var td11=NewTag("td",tr4);td11.className="lbl_right";var divLL;var divLBC;var divLBH;return[divLL,divLBC,divLBH];}
this.DrawStructureNr_2=function(divLBH,captionText,color)
{var tab2=NewTag("table",divLBH);tab2.cellSpacing="0";tab2.cellPadding="0";tab2.style.border="0px";var tb2=NewTag("tbody",tab2);var tr2=NewTag("tr",tb2);var td3=NewTag("td",tr2);td3.className="label_caption";if(color!=undefined)
td3.style.color=color;td3.style.textAlign="center";td3.style.minWidth="18px";AddEvent(td3,"click",me.pMarker.OnLabelSignClick);NewTextTag(captionText,td3);var strSignUrl=me.pMarker.GetProperty("pin_img_url");if(strSignUrl!="???")
{var td4=NewTag("td",tr2);var img=NewTag("img",td4);img.src=strSignUrl;img.alt="";}}
this.IsLabelBoxVisible=function()
{if(me.divLabelBox==null)
return false;else
{if((me.divLabelBox.style.visibility=="visible")&&(me.divLabelBox.style.display==""))
return true;else
return false;}}
this.DestroyDivLabelBox=function()
{if(me.divLabelBox)
{if(me.divLabelBox.parentNode)
{me.divLabelBox.parentNode.removeChild(me.divLabelBox);me.divLabelBox=null;return true;}}
return false;}
this.RemoveBox=function()
{var bExisted=me.DestroyDivLabelBox();if(bExisted)
{me.pMarker.bLabelBoxMustBeVisible=false;me.pMarker.bDetailsMustBeVisible=false;me.pMap.OnPinLabelBoxDestroyed(me.pMarker);}}
this.RemoveSign=function()
{if(!me.m_bSignless)
{if(me.divLabelSign)
{if(me.divLabelSign.parentNode)
me.divLabelSign.parentNode.removeChild(me.divLabelSign);me.divLabelSign=null;}}
else
{me.pMarker.m_bSignlessActive=false;}}
this.DetailsDataArrived=function(result)
{me.divDetails=NewTag("div",me.divLabelBoxContent);NewTextTag(g_Babel.GetWord("PoiType")+": "+g_Babel.GetWord("poi"+result.arrRecords[0].nTypeID),me.divDetails);NewTag("br",me.divDetails);var j;for(j=1;j<result.arrRecords[0].arrValues.length;j++)
{if(me.pMap.GetLang()=="hu")
NewTextTag(result.arrRecords[0].arrNames[j]+": "+result.arrRecords[0].arrValues[j],me.divDetails);else
NewTextTag(result.arrRecords[0].arrValues[j],me.divDetails);NewTag("br",me.divDetails);};me.divDetails.style.display="none";me.ShowHideDetails();}
this.ShowHideDetails=function()
{if(me.divDetails==null)
{var iServerID=me.pMarker.GetProperty("get_details_from_server");if(iServerID!="???")
{me.pMap.NoSessionServer.CallFunction("SearchPoi","iID="+iServerID,0,me.DetailsDataArrived);}
return;}
if(me.aDetails!=null&&me.divDetails!=null)
{me.divDetails.onselectstart=function(){return false;};me.divDetails.ondragstart=function(){return false;};me.aDetails.onselectstart=function(){return false;};me.aDetails.ondragstart=function(){return false;};if(me.divDetails.style.display=="none")
{me.aDetails.style.display="none";me.divDetails.style.display="";me.pMarker.bDetailsMustBeVisible=true;me.divLabelBox.style.width="250px";}
else
{me.aDetails.style.display="";me.divDetails.style.display="none";me.pMarker.bDetailsMustBeVisible=false;}
me.ReArrange();}};this.SetLabelBoxSizeFields=function()
{if(me.divLabelBox2!=null)
{me.iLabW=GetLayerWidth(me.divLabelBox2);me.iLabH=GetLayerHeight(me.divLabelBox2);}}
this.GetCoords2=function()
{var newPxlY=me.iPxlY+me.iLabDY;var newPxlX=me.iPxlX+me.iLabDX;var iViewW=me.pMap.GetMapViewWidth();var iViewH=me.pMap.GetMapViewHeight();me.iLabLegD=25;me.iLabLegY=10;var iLabLegX2=15;var iLabLegY2=3;var bCollision=false;if(iViewW<me.iPxlX-me.iLabLegD+me.iLabW)
{newPxlX=iViewW+me.iLabLegD-me.iLabW+me.iLabDX;bCollision=true;}
if(iViewH<me.iPxlY-me.iLabLegY)
{newPxlY=iViewH+me.iLabLegY+me.iLabDY;bCollision=true;}
if(0>me.iPxlX-me.iLabDX-iLabLegX2)
{newPxlX=me.iLabDX+iLabLegX2;bCollision=true;}
var topMargin=me.pMap.GetMapPinLabelTopMargin();if(topMargin>me.iPxlY-me.iLabDY-iLabLegY2-me.iLabH)
{newPxlY=me.iLabDY+iLabLegY2+me.iLabH+topMargin;bCollision=true;}
var bPinInView=true;if((me.iPxlY<0)||(me.iPxlX<0)||(me.iPxlX>iViewW)||(me.iPxlY>iViewH))
bPinInView=false;return[newPxlY,newPxlX,bCollision,bPinInView];}
this.ReArrange=function()
{if(me.divLabelSign!=null)
{if(me.iImgRefX=="???")
me.iImgRefX=Math.round(me.iImgWidth/2);if(me.iImgRefY=="???")
me.iImgRefY=Math.round(me.iImgHeight/2);me.divLabelSign.style.left=(me.pMarker.iPixX-me.iImgRefX)+"px";me.divLabelSign.style.top=(me.pMarker.iPixY-me.iImgRefY)+"px";}
if(me.divLabelBox!=null)
{me.iPxlX=GetPxlX(me);me.iPxlY=GetPxlY(me);me.SetLabelBoxSizeFields();var iPxlLabY=me.iPxlY+(me.iImgHeight-me.iImgRefY+1+me.iLabDY);var iPxlLabX=me.iPxlX+(-me.iImgRefX+me.iLabDX);var dX=0;var bCollision=false;var bPinInView=true;if(me.m_bPositionCorrection==true)
{var c=null;if(me.m_Position=="undersign")
{c=GetCoords(me.iPxlY+(me.iImgHeight-me.iImgRefY+1+me.iLabDY),me.iPxlX+(-me.iImgRefX+me.iLabDX),-(-me.iImgRefX+me.iLabDX),-(me.iImgHeight-me.iImgRefY+1+me.iLabDY),0,0,me.pMap.GetMapViewWidth(),me.pMap.GetMapViewHeight(),boxwidth,boxheight);}
else
{c=me.GetCoords2();}
iPxlLabY=c[0];iPxlLabX=c[1];bCollision=c[2];bPinInView=c[3];if(me.divLabelLeg!=null)
{me.divLabelLeg.style.visibility=(bCollision)?"hidden":"visible";}}
me.divLabelBox.style.left=(iPxlLabX+me.pMap.pGridMain.GetMapViewVectorX())+"px";me.divLabelBox.style.top=(iPxlLabY+me.pMap.pGridMain.GetMapViewVectorY())+"px";if(bPinInView)
me.Show();else
me.Hide();}}
this.Delete=function()
{me.RemoveSign();me.RemoveBox();};this.Show=function()
{if(me.divLabelSign)me.divLabelSign.style.visibility="visible";if(me.divLabelBox)me.divLabelBox.style.visibility="visible";if(me.OnShow){try{me.OnShow(me);}
catch(exp){if(me.pMap.OnError)
me.pMap.OnError(exp,'Show.OnShow');}}}
this.Hide=function()
{if(me.divLabelSign)me.divLabelSign.style.visibility="hidden";if(me.divLabelBox)me.divLabelBox.style.visibility="hidden";}
PreLabelCreateG(me);}

function CTreeItem(strID,strName,iLevel,bChecked,bOpened,bShowInTree)
{this.strID=(strID!=undefined&&strID!=null?strID:"");this.strName=(strName!=undefined&&strName!=null?strName:"");this.iLevel=(iLevel!=undefined&&iLevel!=null?iLevel:0);this.bChecked=(bChecked?true:false);this.bOpened=(bOpened?true:false);this.bShowInTree=(bShowInTree!=undefined?bShowInTree:true);this.pParent=null;this.pBrother=null;this.pChild=null;this.tr=null;this.checkbox=null;this.OnOpen=null;this.OnClose=null;this.OnCheckChanged=null;this.OnCheckChangeEnded=null;var me=this;this.SetRelations=function(pParent,pStepBrother)
{me.pParent=pParent;if(pParent&&(pParent.pChild==null))
{pParent.pChild=me;}
else
{var pBrother=null;if(pParent)
{pBrother=pParent.pChild;while(pBrother.pBrother!=null)
pBrother=pBrother.pBrother;}
else
pBrother=pStepBrother;if(pBrother)
pBrother.pBrother=me;}}
this.GetID=function()
{return me.strID;}
this.GetName=function()
{return me.strName;}
this.GetLevel=function()
{return me.iLevel;}
this.IsChecked=function()
{return me.bChecked;}
this.SetChecked=function(bChecked)
{me.bChecked=bChecked;var arrChildren=me.GetAllChildren();for(var i=0;i<arrChildren.length;i++)
{if(!arrChildren[i].bShowInTree)
continue;if(arrChildren[i].bChecked!=bChecked)
{arrChildren[i].bChecked=bChecked;if(arrChildren[i].OnCheckChanged)
arrChildren[i].OnCheckChanged(arrChildren[i]);}}
for(var pParent=me.pParent;pParent;pParent=pParent.pParent)
{var bParentCheck=false;for(var pBrother=pParent.pChild;pBrother;pBrother=pBrother.pBrother)
{if(pBrother.bChecked)
bParentCheck=true;else
{bParentCheck=false;break;}}
if(pParent.bChecked!=bParentCheck)
{pParent.bChecked=bParentCheck;if(pParent.OnCheckChanged)
pParent.OnCheckChanged(pParent);}}
if(me.OnCheckChanged)
me.OnCheckChanged(me);if(me.OnCheckChangeEnded)
me.OnCheckChangeEnded();}
this.ChangeCheck=function()
{me.SetChecked(!me.bChecked)}
this.IsOpened=function()
{return me.bOpened;}
this.Open=function()
{me.bOpened=true;if(me.OnOpen)
me.OnOpen(me);}
this.Close=function()
{me.bOpened=false;var arrChildren=me.GetAllChildren();for(var i=0;i<arrChildren.length;i++)
{arrChildren[i].m_bOpened=false;}
if(me.OnClose)
me.OnClose(me);}
this.Switch=function()
{if(me.bOpened)
me.Close();else
me.Open();}
this.GetTR=function()
{return me.tr;}
this.SetTR=function(tr)
{me.tr=tr;me.checkbox=null;}
this.GetCheckBox=function()
{return me.checkbox;}
this.SetCheckBox=function(checkbox)
{me.checkbox=checkbox;}
this.GetParent=function(iLevel)
{var pParent=null;if(iLevel<me.GetLevel())
{pParent=me.pParent;while(pParent&&pParent.GetLevel()!=iLevel)
pParent=pParent.pParent;}
return pParent;}
this.GetRealBrother=function()
{if(me.pBrother)
{if(me.pBrother.bShowInTree)
return me.pBrother;else
return me.pBrother.GetRealBrother();}
return null;}
this.GetAllChildren=function()
{var arrChildren=new Array();var pChild=me.pChild;while(pChild)
{arrChildren[arrChildren.length]=pChild;if(pChild.pChild)
pChild=pChild.pChild;else if(pChild.pBrother)
pChild=pChild.pBrother;else{var pParent=pChild.pParent;while(pParent&&!pParent.pBrother&&(pParent!=me))
{pParent=pParent.pParent;}
if(pParent)
pChild=pParent.pBrother;else
pChild=null;if(pParent==me)
break;}}
return arrChildren;}
TREE_NULL=0;TREE_T=1;TREE_L=2;TREE_I=3;this.GetTreeType=function(iLevel)
{if(iLevel==me.GetLevel())
{if(me.GetRealBrother())
return TREE_T;else
return TREE_L;}
else if(iLevel<me.GetLevel())
{if(me.GetParent(iLevel).GetRealBrother())
return TREE_I;}
return TREE_NULL;}
this.GetTreeClass=function(iLevel)
{var strClass="";switch(me.GetTreeType(iLevel))
{case TREE_L:strClass="treeL";break;case TREE_T:strClass="treeT";break;case TREE_I:strClass="treeI";break;case TREE_NULL:strClass="tree0";break;}
return strClass;}
this.GetTreeIcon=function(iLevel)
{var strUrl="transparent.gif";if(!me.pChild)
strUrl="line";else if(me.IsOpened())
strUrl="minus";else
strUrl="plus";switch(me.GetTreeType(iLevel))
{case TREE_L:strUrl+="_l.gif";break;case TREE_T:strUrl+="_t.gif";break;case TREE_I:strUrl="line_i.gif";break;case TREE_NULL:strUrl="transparent.gif";break;}
return strUrl;}}
function CTree(div,arrItems)
{this.div=div;this.table=null;this.arrItems=arrItems;this.iMaxLevel=0;this.iColCount=0;this.OnCheckChecked=null;this.bEnabled=true;var me=this;this.Init=function()
{me.SetItems(arrItems);me.bEnabled=true;}
this.Reset=function()
{me.UncheckAll();me.arrItems[0].Close();var i=0;for(i=0;i<me.arrItems.length;i++)
{try
{me.arrItems[i].checkbox.checked=false;me.arrItems[i].Close();}
catch(x)
{}}
me.Enable();}
this.GetItems=function()
{return me.arrItems;}
this.SetItems=function(arrItems)
{me.arrItems=arrItems
me.iMaxLevel=0;var pLastOrphan=null;if(arrItems)
{var pParent=null;var iLevel=0;var pPrevItem=null;for(var i=0;i<arrItems.length;i++)
{var pItem=arrItems[i];if(pPrevItem!=null)
{if(pPrevItem.GetLevel()<pItem.GetLevel())
pParent=pPrevItem;else if(pPrevItem.GetLevel()>pItem.GetLevel())
{pParent=pPrevItem.GetParent(pItem.GetLevel()-1);}}
pItem.SetRelations(pParent,pLastOrphan);if(pParent==null)
pLastOrphan=pItem;pItem.OnOpen=me.OnOpenNode;pItem.OnClose=me.OnCloseNode;pItem.OnCheckChanged=me.OnCheckNodeChangedInternal;pItem.OnCheckChangeEnded=me.OnCheckChangedInternal;if(me.iMaxLevel<pItem.GetLevel())
me.iMaxLevel=pItem.GetLevel();pPrevItem=pItem;}}
me.iColCount=me.iMaxLevel+3;}
this.Show=function()
{if(me.div)
{while(me.div.firstChild)
me.div.removeChild(me.div.firstChild);var table=NewTag("table");table.cellPadding=0;table.cellSpacing=0;table.setAttribute("border","0");me.table=NewTag("tbody",table);AddTag(table,me.div);var bRowVisible=true;var iSkipLevel=0;for(var i=0;i<me.arrItems.length;i++)
{if(!me.arrItems[i].bShowInTree)
continue;if(!bRowVisible)
{if(me.arrItems[i].GetLevel()>iSkipLevel)
continue;bRowVisible=true;}
if(bRowVisible)
{me.ShowNode(me.arrItems[i],null);if(me.arrItems[i].pChild&&!me.arrItems[i].IsOpened())
{iSkipLevel=me.arrItems[i].GetLevel();bRowVisible=false;}}}}}
this.ShowNode=function(pItem,trBefore)
{var tr=NewTag('tr',me.table,trBefore);pItem.SetTR(tr);for(var iTreeLevel=0;iTreeLevel<=pItem.GetLevel();iTreeLevel++)
{td=NewTag('td',tr);td.className=pItem.GetTreeClass(iTreeLevel);img=NewTag('img');SetImage(img,'images/tree/'+pItem.GetTreeIcon(iTreeLevel),19,16);if(pItem.pChild&&(iTreeLevel==pItem.GetLevel()))
{a=NewTag('a',td);a.setAttribute('href','javascript:void(0)');a.onclick=pItem.Switch;AddTag(img,a);}
else
AddTag(img,td);}
td=NewTag('td',tr);td.setAttribute('width',16);td.className="treeCheckbox";var input=NewTag('input');input.className="treeCheckbox";input.setAttribute('type','checkbox');AddTag(input,td);input.checked=pItem.IsChecked();input.onclick=pItem.ChangeCheck;pItem.SetCheckBox(input);var iColSpan=me.iColCount-(pItem.GetLevel()+2);td=NewTag('td',tr);td.className='treeText';td.colSpan=iColSpan;td.width='99%';a=NewTag('a',td);a.className='treeText';NewTextTag(pItem.GetName(),a);a.onclick=pItem.ChangeCheck;if(pItem.pChild)
a.ondblclick=pItem.Switch;}
this.OnOpenNode=function(pItem)
{var pSister=pItem;while(pSister&&!pSister.GetRealBrother())
pSister=pSister.pParent;var trBefore=(pSister?pSister.GetRealBrother().GetTR():null);for(var pChild=pItem.pChild;pChild!=null;pChild=pChild.pBrother)
{if(pChild.bShowInTree)
me.ShowNode(pChild,trBefore);}}
this.OnCloseNode=function(pItem)
{var arrChildren=pItem.GetAllChildren();for(var i=0;i<arrChildren.length;i++)
{var tr=arrChildren[i].GetTR();if(tr&&tr.parentNode)
tr.parentNode.removeChild(tr);arrChildren[i].SetTR(null);}}
this.OnCheckNodeChangedInternal=function(pItem)
{var input=pItem.GetCheckBox();if(input)
input.checked=pItem.IsChecked();}
this.OnCheckChangedInternal=function(pItem)
{if(me.OnCheckChanged)
me.OnCheckChanged()}
this.GetCheckedIDsInStr=function()
{return me.GetCheckedIDsInStrINNER(me.arrItems[0]);}
this.GetCheckedIDsInStrINNER=function(item)
{var retval="";while(item!=null)
{if(item.IsChecked())
{retval=retval+"|"+item.GetID();item=item.pBrother;}
else
{var temp=me.GetCheckedIDsInStrINNER(item.pChild);if(temp!="")
retval=retval+"|"+temp;item=item.pBrother;}}
retval=retval.substring(1);return retval;}
this.UncheckAll=function()
{var i;for(i=0;i<me.arrItems.length;i++)
{var item=me.arrItems[i];if(item!=null&&item.bShowInTree)
{item.bChecked=false;}}}
this.CheckAll=function()
{var i;for(i=0;i<me.arrItems.length;i++)
{var item=me.arrItems[i];if(item!=null&&item.bShowInTree)
{item.bChecked=true;}}}
this.Disable=function()
{var i;for(i=0;i<me.arrItems.length;i++)
{var item=me.arrItems[i];if(item!=null)
{if(item.checkbox!=null)
item.checkbox.disabled="true";}}
me.bEnabled=false;}
this.Enable=function()
{var i;for(i=0;i<me.arrItems.length;i++)
{var item=me.arrItems[i];if(item!=null)
{if(item.checkbox!=null)
item.checkbox.disabled="";}}
me.bEnabled=true;}
this.GetOpenedIDs=function()
{}
this.Init();}

function LoginBox(divDummy,pTopoliszControl)
{this.pTopoliszControl=pTopoliszControl;var me=this;this.LoginCallback=function(data)
{if(data&&data!="undefined"&&data!="null")
{data=eval(data);me.favouritePlaces=data.favouritePlaces;me.favouriteRoutes=data.favouriteRoutes;me.name=data.userName;var div=GetBlock("idLoggedIn");while(div.firstChild)
div.removeChild(div.firstChild);PinLabel.prototype.OnShow=me.OnLabelShow;var types=["start","through","stop","findpoi"];me.pTopoliszControl.pTopoliszMap.ShowPinLabelsMulti(types);me.pTopoliszControl.SwitchFavouritePlace(true);CUtvonaltervAddressBlock.prototype.OnShowRegistered=me.OnAddressBlockShowRegistered;var execOnShow=true;if(!me.pTopoliszControl.pRouteSearch){execOnShow=false;var div=NewTag('div',me.pTopoliszControl.divContent);me.pTopoliszControl.pRouteSearch=new CUtvonaltervRouteSearch(div,me.pTopoliszControl.pTopoliszMap);me.pTopoliszControl.pRouteResult=new CUtvonaltervRouteResult(me.pTopoliszControl.divRouteResult,me.pTopoliszControl.pTopoliszMap);me.pTopoliszControl.pRouteSearch.SetResultHandler(me.pTopoliszControl.pRouteResult);me.pTopoliszControl.pRouteSearch.Hide();}
me.pTopoliszControl.pRouteSearch.OnShow=me.OnRouteShow;me.pTopoliszControl.pRouteSearch.Show();}}
this.CloseAddFav=function(bRedraw,id,x,y,name){g_PopUpHandler.HidePopup();if(bRedraw){var length=GetArrayLength(me.favouritePlaces);me.favouritePlaces[length]=new CFavouritePlace();me.favouritePlaces[length].id=id;me.favouritePlaces[length].x=x;me.favouritePlaces[length].y=y;me.favouritePlaces[length].name=name;g_TopoliszControls.SwitchFavouritePlace(true);}}
this.OnLabelShow=function(label)
{var listFavouritablePinTypes=["start","stop","through","findpoi","pick"];var iFound=listFavouritablePinTypes.indexOf(label.pMarker.mainType);if(label.registeredButtons!=null)
{if(!label.registeredButtons.hasChildNodes()&&(iFound!=-1)){label.registeredA=NewTag("a",label.registeredButtons);label.registeredA.onclick=function()
{var iframe=NewIframe("AddFavPlace.aspx?x="+label.pMarker.dX+"&y="+label.pMarker.dY+"&langid="+g_Babel.GetLang()+"&caption="+label.pMarker.GetLabelCaption(),510,100);g_PopUpHandler.SetContent(g_Babel.GetWord('capAddFavouritePlace'),iframe);g_PopUpHandler.SetSize(520,150);g_PopUpHandler.CenterPopup();g_PopUpHandler.ShowPopup();};if(g_TopoliszMap.iLabelDesignVersion!=2)
{var img=NewTag("img",label.registeredA);img.paddingRight="2px";SetImage(img,"design/BUTTON_favourites_small.gif",12,12,"");img.onmouseover=function(pEvent){g_TopoliszMap.ShowToolTip(pEvent,"Kedvencekhez")};img.onmouseout=function(){g_TopoliszMap.HideToolTip()};}
else
{var a5=label.registeredA;NewTextTag(g_Babel.GetWord("capLabHeaderBtnFavourite"),a5);a5.onmousedown=function(e){StopEventPropagation(e);return false;};a5.onmouseover=function(pEvent){g_TopoliszMap.ShowToolTip(pEvent,"Kedvencekhez")};a5.onmouseout=function(){g_TopoliszMap.HideToolTip()};a5.ondragstart=function(){return false;};a5.onselectstart=function(){return false;};}}}}
this.OnFindPoiLabelShow=function(label)
{if(!label.registeredButtons.hasChildNodes()){label.registeredA=NewTag("a",label.registeredButtons);label.registeredA.onclick=function()
{var iframe=NewIframe("AddFavPlace.aspx?x="+label.pMarker.dX+"&y="+label.pMarker.dY+"&langid="+g_Babel.GetLang()+"&caption="+label.pMarker.GetLabelCaption(),510,100);g_PopUpHandler.SetContent(g_Babel.GetWord('capAddFavouritePlace'),iframe);g_PopUpHandler.SetSize(520,150);g_PopUpHandler.CenterPopup();g_PopUpHandler.ShowPopup();};var img=NewTag("img",label.registeredA);img.paddingRight="2px";SetImage(img,"design/ICON_favourites_on.gif",12,12,"Kedvencekhez");}}
this.CloseAddFavRoute=function(bRedraw,name,data){g_PopUpHandler.HidePopup();if(bRedraw){var length=GetArrayLength(me.favouriteRoutes);me.favouriteRoutes[length]=new CFavouriteRoute();me.favouriteRoutes[length].id=-1;me.favouriteRoutes[length].name=name;me.favouriteRoutes[length].data=data;var option=NewTag("option",me.routeSelect);option.text=me.favouriteRoutes[length].name;option.value=length;}}
this.OnRouteShow=function()
{var div=NewTag('div',me.pTopoliszControl.pRouteSearch.divRegistered);div.style.padding="3px";var panel=new Panel(div);var td=NewTag('td',panel.tr);var txtBtn=new TextButton(td);txtBtn.CreateImage(15,15,"design/ICON_addfavourites_off.gif","design/ICON_addfavourites_on.gif",null,null,false);var a=txtBtn.CreateText(g_Babel.GetWord('regAddFavRoute'));txtBtn.OnClick=function(){var iframe=NewIframe("AddFavRoute.aspx?data="+g_TopoliszMap.SaveState()+"&langid="+g_Babel.GetLang(),510,100);g_PopUpHandler.SetContent(g_Babel.GetWord('capNewFavRoute'),iframe);g_PopUpHandler.SetSize(520,150);g_PopUpHandler.CenterPopup();g_PopUpHandler.ShowPopup();};this.aRegAddFavRoute=a;var space=NewTag("h3",div);var tt=NewTextTag(g_Babel.GetWord("capFavouriteRoutes"),space);space.style.fontSize="11px";space.style.marginTop="10px";me.routeSelect=NewTag("select",div);me.routeSelect.style.width="100%"
var option=NewTag("option",me.routeSelect);option.text="---- "+g_Babel.GetWord('regSelect')+" ----";option.value=i;this.optionRegSelect=option;for(var i=0;i<me.favouriteRoutes.length;i++){option=NewTag("option",me.routeSelect);option.text=me.favouriteRoutes[i].name;option.value=i;}
me.routeSelect.onchange=function(){if(this.selectedIndex>0){g_TopoliszMap.LoadState(me.favouriteRoutes[this.options[this.selectedIndex].value].data);}}
space=NewTag("div",div);space.style.height="6px";cancelSendMail=function(){GetBlock("idModalDialogHolder").style.display="none";}}
this.ShowFavPlacesList=function(addrBlock)
{var addrList=new Array();for(var i=0;i<GetArrayLength(me.favouritePlaces);i++){addrList[i]=new Object();addrList[i].dX=me.favouritePlaces[i].x;addrList[i].dY=me.favouritePlaces[i].y;addrList[i].strAddress=me.favouritePlaces[i].name;}
var obj=new CAddressSearchUserState();obj.strInputText="";obj.arrAddressList=addrList;addrBlock.pSearch.SetUserState(obj);addrBlock.pSearch.Show();}
this.OnAddressBlockShowRegistered=function(addrBlock)
{var td=addrBlock.inputbox.AppendIconTd();var a=NewTag('a',td);new ImgLink(a,22,22,"design/BUTTON_favourites_off.gif","design/BUTTON_favourites_on.gif",null,null,g_Babel.GetWord("cFavouritePlace"),false);AddEvent(a,"click",function(){me.ShowFavPlacesList(addrBlock)});}}

function CBannerManipulator()
{var me=this;this.SetMapBanner=function(div,pTopoliszMap)
{pTopoliszMap.OnMapStateChanged=function()
{me.ShowMapBanner(div,pTopoliszMap.GetMapData());}}
this.SetAddressBanner=function(div,pRouteSearch)
{var func=function(pDummy,pAddress)
{me.ShowAddressBanner(div,pAddress);}
CUtvonaltervAddressBlock.prototype.OnShow=func;}
this.SetTrafficBanner=function(div,pRouteResult)
{pRouteResult.OnRouteChanged=function(pRoute)
{me.ShowTrafficBanner(div,pRoute);}}
this.ShowMapBanner=function(div,mapdata)
{var strCity=mapdata.strCaption;if(strCity!="")
{while(div.firstChild){div.removeChild(div.firstChild);}
var iPos=strCity.indexOf('(');if(iPos>=0)
strCity=strCity.substr(0,iPos);var div=NewTag('div',div);div.className='banner';var iWidth=GetLayerWidth(div);var iCount=Math.floor(iWidth/102);iWidth=iCount*102;}}
this.ShowAddressBanner=function(div,address)
{if(address!=null)
{var strCity=address.strAddress.split(" ")[0];if(strCity.indexOf("megye")>=0)
strCity="";if(strCity!="")
{while(div.firstChild)
{div.removeChild(div.firstChild);}
if(strCity=="Bp")
strCity=="Budapest";var div=NewTag('div',div);div.className='banner';var iWidth=GetLayerWidth(div);var iCount=Math.floor(iWidth/102);iWidth=iCount*102;var iframe=NewIframe("http://www.hungaryrooms.com/affiliate/listView.php?braffcode=1043972374374646&limit="+iCount+"&city="+strCity,iWidth,137,div);iframe.className="mapbanner";AddEvent(iframe,'load',function(){me.CheckIframe(iframe,div)});}}}
this.CheckIframe=function(iframe,divToDelete)
{}
this.ShowTrafficBanner=function(divParent,pRoute)
{while(divParent.firstChild)
divParent.removeChild(divParent.firstChild);divParent.style.display="none";if(pRoute!=null)
{var div=NewTag('div',divParent);div.className="routeBanner";if(g_Babel.GetLang()=="en")
{var xmlIc=document.createElement('object');xmlIc.setAttribute('type','application/x-shockwave-flash');xmlIc.setAttribute('data','');xmlIc.data="images/topolisz_bch_en.swf";xmlIc.setAttribute('width','');xmlIc.width="315";xmlIc.setAttribute('height','');xmlIc.height="240";var paramIc=document.createElement('param');paramIc.setAttribute('name','');paramIc.name="movie";paramIc.setAttribute('value','');paramIc.value="images/topolisz_bch_en.swf";xmlIc.appendChild(paramIc);div.appendChild(xmlIc);try
{xmlIc.LoadMovie(0,"images/topolisz_bch_en.swf");}
catch(e)
{}}
else
{var xmlIc=document.createElement('object');xmlIc.setAttribute('type','application/x-shockwave-flash');xmlIc.setAttribute('data','');xmlIc.data="images/barat_taxi_468_60.swf";xmlIc.setAttribute('width','');xmlIc.width="468";xmlIc.setAttribute('height','');xmlIc.height="60";var paramIc=document.createElement('param');paramIc.setAttribute('name','');paramIc.name="movie";paramIc.setAttribute('value','');paramIc.value="images/barat_taxi_468_60.swf";xmlIc.appendChild(paramIc);div.appendChild(xmlIc);try
{xmlIc.LoadMovie(0,"images/barat_taxi_468_60.swf");}
catch(e)
{}}
var div=NewTag('div',divParent);div.className="routeBanner";if(g_Babel.GetLang()!=""&&g_Babel.GetLang()!="hu")
{var xmlIc=document.createElement('object');xmlIc.setAttribute('type','application/x-shockwave-flash');xmlIc.setAttribute('data','');xmlIc.data="images/topolisz_bch_hu.swf";xmlIc.setAttribute('width','');xmlIc.width="315";xmlIc.setAttribute('height','');xmlIc.height="240";var paramIc=document.createElement('param');paramIc.setAttribute('name','');paramIc.name="movie";paramIc.setAttribute('value','');paramIc.value="images/topolisz_bch_hu.swf";xmlIc.appendChild(paramIc);div.appendChild(xmlIc);try
{xmlIc.LoadMovie(0,"images/topolisz_bch_hu.swf");}
catch(e)
{}}
else{iframe=NewIframe("http://www.logostudio.hu/box.php?partner=utvonalterv&template=1&service=25",120,120);AddTag(iframe,div);}
var div=NewTag('div',divParent);div.className="routeBanner";a=NewTag("a",div);a.setAttribute("target","_blank");a.setAttribute("href","http://www.domainrendeles.hu/");img=NewTag("img",a);SetImage(img,"http://www.domainrendeles.hu/banner/utvonalterv/domainrendeles.gif",120,120,"DomainRendelés");var div=NewTag('div',divParent);div.className="routeBanner";iframe=NewIframe("http://www.dint.hu/partnerek/boxok/utvonalterv_nyelvipercek.php",120,120);AddTag(iframe,div);var div=NewTag('div',divParent);div.className="routeBanner";a=NewTag("a",div);a.setAttribute("target","_blank");a.setAttribute("href","http://www.airporthotel.hu/partner/usr_start.php?nyelv=hu&partner=utvonalterv");img=NewTag("img",a);SetImage(img,"./images/partners/egyuttmukodo/parkolo_120_240.gif",120,240,"Airport Hotel");var div=NewTag('div',divParent);div.className="routeBanner";var xmlIc=document.createElement('object');xmlIc.setAttribute('type','application/x-shockwave-flash');xmlIc.setAttribute('data','');xmlIc.data="images/fot_120x240-2.swf";xmlIc.setAttribute('width','');xmlIc.width="120";xmlIc.setAttribute('height','');xmlIc.height="240";var paramIc=document.createElement('param');paramIc.setAttribute('name','');paramIc.name="movie";paramIc.setAttribute('value','');paramIc.value="images/fot_120x240-2.swf";xmlIc.appendChild(paramIc);div.appendChild(xmlIc);try
{xmlIc.LoadMovie(0,"images/fot_120x240-2.swf");}
catch(e)
{}
divParent.style.display="";}}}

var TrafficNa2HintCnt=0;HideTrafficNa2Hint=function(pEvent)
{{var div=GetBlock("idTrafficNa2Hint");if((div!=null)&&(div!=undefined))
{{div.style.display="none";}}}}
HideTrafficNa2HintTO=function(pEvent)
{{TrafficNa2HintCnt--;var div=GetBlock("idTrafficNa2Hint");if((div!=null)&&(div!=undefined)&&(TrafficNa2HintCnt==0))
{{div.style.display="none";}}}}
OnMouseOut_TMC2_cbx=function(pEvent)
{{var div=GetBlock("idTrafficNa2Hint");if((div!=null)&&(div!=undefined))
{{if(div.style.display=="")
window.setTimeout(HideTrafficNa2HintTO,2700);}}}}
OnMouseOver_TMC2_cbx=function(pEvent)
{{if(g_strAppID.toLowerCase()=="trafficnav"){return;}
HideUTVHint();HideTrafficNavHint();HideDailyNewsHin();TrafficNa2HintCnt++;var div=GetBlock("idTrafficNa2Hint");if((div!=null)&&(div!=undefined))
{{div.style.display="";return;}}
var div=NewTag("div",document.body);div.id="idTrafficNa2Hint";div.style.position="absolute";div.style.left=(GetAbsLayerLeft(GetBlock("idButtonPaletteTMC"))+157)+"px";div.style.top=GetAbsLayerTop(GetBlock("idButtonPaletteTMC"))+"px";div.style.padding="2px";div.style.border="1px solid black";div.style.backgroundColor="white";div.style.zIndex="200";var div1=NewTag("div",div);var a1=NewTag("a",div1);a1.setAttribute("href","http://TrafficNav.hu");a1.setAttribute("target","_blank");var img=NewTag("img",a1);SetImage(img,"images/buttonpalette/logo_TrafficNav.png",58,43,"TrafficNav");var div2=NewTag("div",div);div2.style.fontSize="10px";var a2=NewTag("a",div2);a2.setAttribute("href","http://TrafficNav.hu");a2.setAttribute("target","_blank");NewTextTag("TrafficNav.hu",a2);}}
var TrafficNavHintCnt=0;HideTrafficNavHint=function(pEvent)
{{var div=GetBlock("idTrafficNavHint");if((div!=null)&&(div!=undefined))
{{div.style.display="none";}}}}
HideTrafficNavHintTO=function(pEvent)
{{TrafficNavHintCnt--;var div=GetBlock("idTrafficNavHint");if((div!=null)&&(div!=undefined)&&(TrafficNavHintCnt==0))
{{div.style.display="none";}}}}
OnMouseOut_TMC_cbx=function(pEvent)
{{var div=GetBlock("idTrafficNavHint");if((div!=null)&&(div!=undefined))
{{if(div.style.display=="")
window.setTimeout(HideTrafficNavHintTO,2700);}}}}
OnMouseOver_TMC_cbx=function(pEvent)
{{if(g_strAppID.toLowerCase()=="trafficnav"){return;}
HideUTVHint();HideTrafficNa2Hint();HideDailyNewsHint();TrafficNavHintCnt++;var div=GetBlock("idTrafficNavHint");if((div!=null)&&(div!=undefined))
{{div.style.display="";return;}}
var div=NewTag("div",document.body);div.id="idTrafficNavHint";div.style.position="absolute";div.style.left=(GetAbsLayerLeft(GetBlock("idButtonPaletteTMC"))+157)+"px";div.style.top=GetAbsLayerTop(GetBlock("idButtonPaletteTMC"))+"px";div.style.padding="2px";div.style.border="1px solid black";div.style.backgroundColor="white";div.style.zIndex="200";var div1=NewTag("div",div);var a1=NewTag("a",div1);a1.setAttribute("href","http://trafficnav.hu");a1.setAttribute("target","_blank");var img=NewTag("img",a1);SetImage(img,"images/buttonpalette/logo_trafficnav.png",58,43,"TrafficNav");var div2=NewTag("div",div);div2.style.fontSize="10px";var a2=NewTag("a",div2);a2.setAttribute("href","http://trafficnav.hu");a2.setAttribute("target","_blank");NewTextTag("trafficnav.hu",a2);}}
var UTVHintCnt=0;HideUTVHint=function(pEvent)
{{var div=GetBlock("idUTVHint");if((div!=null)&&(div!=undefined))
{{div.style.display="none";}}}}
HideUTVHintTO=function(pEvent)
{{UTVHintCnt--;var div=GetBlock("idUTVHint");if((div!=null)&&(div!=undefined)&&(UTVHintCnt==0))
{{div.style.display="none";}}}}
OnMouseOut_UTV_cbx=function(pEvent)
{{var div=GetBlock("idUTVHint");if((div!=null)&&(div!=undefined))
{{if(div.style.display=="")
window.setTimeout(HideUTVHintTO,2700);}}}}
OnMouseOver_UTV_cbx=function(pEvent)
{{HideTrafficNavHint();HideTrafficNa2Hint();HideDailyNewsHint();UTVHintCnt++;var div=GetBlock("idUTVHint");if((div!=null)&&(div!=undefined))
{{div.style.display="";return;}}
var div=NewTag("div",document.body);div.id="idUTVHint";div.style.position="absolute";div.style.left=(GetAbsLayerLeft(GetBlock("idButtonPaletteTMC"))+157)+"px";div.style.top=GetAbsLayerTop(GetBlock("idButtonPaletteTMC"))+"px";div.style.padding="2px";div.style.border="1px solid black";div.style.backgroundColor="white";div.style.zIndex="200";var div1=NewTag("div",div);var a1=NewTag("a",div1);a1.setAttribute("href","http://www.utv.hu");a1.setAttribute("target","_blank");var img=NewTag("img",a1);SetImage(img,"images/buttonpalette/logo_utv.png",41,74,"UTV");var div2=NewTag("div",div);div2.style.fontSize="10px";div2.style.textAlign="center";var a2=NewTag("a",div2);a2.setAttribute("href","http://www.utv.hu");a2.setAttribute("target","_blank");NewTextTag("utv.hu",a2);}}
var DailyNewsHintCnt=0;HideDailyNewsHint=function(pEvent)
{{var div=GetBlock("idDailyNewsHint");if((div!=null)&&(div!=undefined))
{{div.style.display="none";}}}}
HideDailyNewsHintTO=function(pEvent)
{{DailyNewsHintCnt--;var div=GetBlock("idDailyNewsHint");if((div!=null)&&(div!=undefined)&&(DailyNewsHintCnt==0))
{{div.style.display="none";}}}}
OnMouseOut_DailyNews_cbx=function(pEvent)
{{var div=GetBlock("idDailyNewsHint");if((div!=null)&&(div!=undefined))
{{if(div.style.display=="")
window.setTimeout(HideDailyNewsHintTO,2700);}}}}
OnMouseOver_DailyNews_cbx=function(pEvent)
{{HideTrafficNavHint();HideTrafficNa2Hint();HideUTVHint();DailyNewsHintCnt++;var div=GetBlock("idDailyNewsHint");if((div!=null)&&(div!=undefined))
{{div.style.display="";return;}}
var div=NewTag("div",document.body);div.id="idDailyNewsHint";div.style.position="absolute";div.style.left=(GetAbsLayerLeft(GetBlock("idButtonPaletteTMC"))+157)+"px";div.style.top=GetAbsLayerTop(GetBlock("idButtonPaletteTMC"))+"px";div.style.padding="2px";div.style.border="1px solid black";div.style.backgroundColor="white";div.style.zIndex="200";var div1=NewTag("div",div);div1.style.textAlign="center";var a1=NewTag("a",div1);a1.setAttribute("href","http://fovinform.hu");a1.setAttribute("target","_blank");var img=NewTag("img",a1);SetImage(img,"images/buttonpalette/logo_fovinform.png",53,69,"Fővinform");var div2=NewTag("div",div);div2.style.fontSize="10px";div2.style.textAlign="center";var a2=NewTag("a",div2);a2.setAttribute("href","http://fovinform.hu");a2.setAttribute("target","_blank");NewTextTag("fovinform.hu",a2);}}
ResetHints=function()
{{HideTrafficNavHint();HideTrafficNa2Hint();HideDailyNewsHint();HideUTVHint();}}
function ButtonPalette(idContentTable,arrInputIds,arrStates)
{this.table=GetBlock(idContentTable);this.tableMenu=GetBlock(idContentTable+"Menu");this.divMenu=GetBlock(idContentTable+"MenuDiv");this.divMenuList=GetBlock(idContentTable+"MenuListDiv");this.trButtonPaletteBottom=null;this.pTopoliszMap=null;this.inputTMC=null;this.inputUTV=null;this.inputPTStopsGlobal=null;this.inputPTStopsLocal=null;this.inputDailyNews=null;this.inputCoordsLabel=null;this.inputPOIBanner=null;this.inputTMCWeather=null;this.arrInputPOIs=new Array();this.arrInputIds=arrInputIds;var me=this;this.Init=function(pTopoliszMap)
{me.pTopoliszMap=pTopoliszMap;me.divMenuList.style.position="absolute";me.divMenuList.style.paddingTop="3px";me.divMenuList.style.display="none";var table1=me.tableMenu;if(table1!=null)
{var arrTr=table1.getElementsByTagName("tr");if(arrTr!=null)
{for(var iTr=0;iTr<arrTr.length;iTr++)
{var tr=arrTr[iTr];if(tr.className=="buttonpalette_button_row")
{var arrA=tr.getElementsByTagName("a");if(arrA!=null)
{for(var iA=0;iA<arrA.length;iA++)
{AddEvent(arrA[iA],"click",me.SwitchDetails);}}}
else
if(tr.className=="buttonpalette_bottom")
{me.trButtonPaletteBottom=tr;}}}
var i=0;for(i=0;i<me.arrInputIds.length;i++)
{if(me.arrInputIds[i]=="idButtonPaletteTMC")
{me.inputTMC=GetBlock("idButtonPaletteTMC");me.pTopoliszMap.SetDrawTMC(arrStates[i],true);me.inputTMC.checked=me.pTopoliszMap.Get_bDrawTMC();me.pTopoliszMap.AddDrawTMCChangedListener(me.RefreshDrawTMCState);AddEvent(me.inputTMC,"click",me.SwitchTMC);}
else if(me.arrInputIds[i]=="idButtonPaletteUTV")
{me.inputUTV=GetBlock("idButtonPaletteUTV");me.pTopoliszMap.SetDrawUTV(arrStates[i],true);me.inputUTV.checked=me.pTopoliszMap.IsDrawUTV();me.pTopoliszMap.AddDrawUTVChangedListener(me.RefreshDrawUTVState);AddEvent(me.inputUTV,"click",me.SwitchUTV);}
else if(me.arrInputIds[i]=="idButtonPalettePTStopsGlobal")
{me.inputPTStopsGlobal=GetBlock("idButtonPalettePTStopsGlobal");me.pTopoliszMap.SetDrawPTStopsGlobal(arrStates[i],true);me.inputPTStopsGlobal.checked=me.pTopoliszMap.IsDrawPTStopsGlobal();me.pTopoliszMap.AddDrawPTStopsGlobalChangedListener(me.RefreshDrawPTStopsState);AddEvent(me.inputPTStopsGlobal,"click",me.SwitchPTStops);}
else if(me.arrInputIds[i]=="idButtonPalettePTStopsLocal")
{me.inputPTStopsLocal=GetBlock("idButtonPalettePTStopsLocal");me.pTopoliszMap.SetDrawPTStopsLocal(arrStates[i],true);me.inputPTStopsLocal.checked=me.pTopoliszMap.IsDrawPTStopsLocal();me.pTopoliszMap.AddDrawPTStopsLocalChangedListener(me.RefreshDrawPTStopsState);AddEvent(me.inputPTStopsLocal,"click",me.SwitchPTStops);}
else if(me.arrInputIds[i]=="idButtonPaletteDailyNews")
{me.inputDailyNews=GetBlock("idButtonPaletteDailyNews");me.pTopoliszMap.SetDrawDailyNews(arrStates[i],true);me.inputDailyNews.checked=me.pTopoliszMap.IsDrawDailyNews();me.pTopoliszMap.AddDrawDailyNewsChangedListener(me.RefreshDrawDailyNewsState);AddEvent(me.inputDailyNews,"click",me.SwitchDailyNews);}
else if(me.arrInputIds[i]=="idButtonPaletteCoords")
{me.inputCoordsLabel=GetBlock("idButtonPaletteCoords");me.pTopoliszMap.SetDrawCoordsLabel(arrStates[i]);me.inputCoordsLabel.checked=me.pTopoliszMap.IsDrawCoordsLabel();me.pTopoliszMap.AddDrawCoordsLabelChangedListener(me.RefreshDrawCoordsLabelState);AddEvent(me.inputCoordsLabel,"click",me.SwitchCoordsLabel);}
else if(me.arrInputIds[i]=="idButtonPaletteReklam")
{me.inputPOIBanner=GetBlock("idButtonPaletteReklam");me.pTopoliszMap.SetDrawPOIBanner(arrStates[i],true);me.inputPOIBanner.checked=me.pTopoliszMap.IsDrawPOIBanner();me.pTopoliszMap.AddDrawCoordsLabelChangedListener(me.RefreshDrawPOIBannerState);AddEvent(me.inputPOIBanner,"click",me.SwitchPOIBanner);}
else if(me.arrInputIds[i]=="idButtonPaletteTMCWeather")
{me.inputTMCWeather=GetBlock("idButtonPaletteTMCWeather");me.pTopoliszMap.SetDrawTMCWeather(arrStates[i],true);me.inputTMCWeather.checked=me.pTopoliszMap.Get_bDrawTMCWeather();me.pTopoliszMap.AddDrawTMCWeatherChangedListener(me.RefreshDrawTMCWeatherState);AddEvent(me.inputTMCWeather,"click",me.SwitchTMCWeather);}
else if(me.arrInputIds[i].search("idButtonPalettePOI")==0)
{var sernum=me.arrInputIds[i][18];var inputPOI=GetBlock(me.arrInputIds[i]);inputPOI.poiSerNum=sernum;me.pTopoliszMap.SetDrawPOI(sernum,arrStates[i],true);inputPOI.checked=me.pTopoliszMap.IsDrawPOI(sernum);me.arrInputPOIs.push(inputPOI);AddEvent(inputPOI,"click",me.SwitchPOI);}
if(me.arrInputIds[i]=="idButtonPalettePOI1")
me.pTopoliszMap.AddDrawPOIChangedListener(me.RefreshDrawPOIState);}
me.pTopoliszMap.DrawRoute();AddEvent(document,"mousemove",me.OnMouseOut);me.HideDetails();g_Babel.AddListener(this.OnChangeLang);me.divMenu.style.display="";}}
this.OnMouseOut=function(pEvent)
{var bOnMenuTitle=false;var bOnMenuList=false;var iMouseX=GetEventXNew(pEvent);var iMouseY=GetEventYNew(pEvent);var iDelta=10;var iMinX=GetAbsLayerLeft(me.tableMenu);var iMinY=GetAbsLayerTop(me.tableMenu);var iMaxX=GetAbsLayerRight(me.tableMenu);var iMaxY=GetAbsLayerBottom(me.tableMenu);if(iMouseX<iMinX-iDelta||iMouseX>iMaxX+iDelta||iMouseY<iMinY-iDelta||iMouseY>iMaxY+iDelta)
bOnMenuTitle=false;else
bOnMenuTitle=true;if(me.divMenuList.style.display=="")
{iMinX=GetAbsLayerLeft(me.divMenuList);iMinY=GetAbsLayerTop(me.divMenuList);iMaxX=GetAbsLayerRight(me.divMenuList);iMaxY=GetAbsLayerBottom(me.divMenuList);if(iMouseX<iMinX-iDelta||iMouseX>iMaxX-iDelta||iMouseY<iMinY+iDelta||iMouseY>iMaxY+iDelta)
bOnMenuList=false;else
bOnMenuList=true;}
if(!bOnMenuList&&!bOnMenuTitle&&(me.divMenuList.style.display==""))
me.HideDetails();}
this.ShowDetails=function()
{me.divMenuList.style.display="";}
this.HideDetails=function()
{me.divMenuList.style.display="none";}
this.SwitchDetails=function(pEvent)
{if(me.divMenuList.style.display=="none")
me.ShowDetails();else
me.HideDetails();return false;}
this.SwitchTMC=function()
{me.pTopoliszMap.SetDrawTMC(!me.pTopoliszMap.Get_bDrawTMC(),false);me.RefreshDrawTMCState();}
this.RefreshDrawTMCState=function()
{if(me.inputTMC)
{me.inputTMC.checked=me.pTopoliszMap.Get_bDrawTMC();}}
this.SwitchUTV=function()
{me.pTopoliszMap.SetDrawUTV(!me.pTopoliszMap.IsDrawUTV(),false);me.RefreshDrawUTVState();}
this.RefreshDrawUTVState=function()
{if(me.inputUTV)
{me.inputUTV.checked=me.pTopoliszMap.IsDrawUTV();}}
this.SwitchPTStops=function()
{if(me.inputPTStopsGlobal)
{me.pTopoliszMap.SetDrawPTStopsGlobal(me.inputPTStopsGlobal.checked,false);}
if(me.inputPTStopsLocal)
{me.pTopoliszMap.SetDrawPTStopsLocal(me.inputPTStopsLocal.checked,false);}
me.RefreshDrawPTStopsState();}
this.RefreshDrawPTStopsState=function()
{if(me.inputPTStopsGlobal)
{me.inputPTStopsGlobal.checked=me.pTopoliszMap.IsDrawPTStopsGlobal();}
if(me.inputPTStopsLocal)
{me.inputPTStopsLocal.checked=me.pTopoliszMap.IsDrawPTStopsLocal();}}
this.SwitchDailyNews=function()
{me.pTopoliszMap.SetDrawDailyNews(!me.pTopoliszMap.IsDrawDailyNews(),false);me.RefreshDrawDailyNewsState();}
this.RefreshDrawDailyNewsState=function()
{if(me.inputDailyNews)
{me.inputDailyNews.checked=me.pTopoliszMap.IsDrawDailyNews();}}
this.SwitchCoordsLabel=function()
{me.pTopoliszMap.SetDrawCoordsLabel(!me.pTopoliszMap.IsDrawCoordsLabel());me.RefreshDrawCoordsLabelState();}
this.RefreshDrawCoordsLabelState=function()
{if(me.inputCoordsLabel)
{me.inputCoordsLabel.checked=me.pTopoliszMap.IsDrawCoordsLabel();}}
this.SwitchPOIBanner=function()
{me.pTopoliszMap.SetDrawPOIBanner(!me.pTopoliszMap.IsDrawPOIBanner());me.RefreshDrawPOIBannerState();}
this.RefreshDrawPOIBannerState=function()
{if(me.inputPOIBanner)
{me.inputPOIBanner.checked=me.pTopoliszMap.IsDrawPOIBanner();}}
this.SwitchTMCWeather=function()
{me.pTopoliszMap.SetDrawTMCWeather(!me.pTopoliszMap.Get_bDrawTMCWeather(),false);me.RefreshDrawTMCWeatherState();}
this.RefreshDrawTMCWeatherState=function()
{if(me.inputTMCWeather)
{me.inputTMCWeather.checked=me.pTopoliszMap.Get_bDrawTMCWeather();}}
this.SwitchPOI=function(event)
{var source=GetEventSourceElement(event);var poiSerNum=source.poiSerNum;me.pTopoliszMap.SetDrawPOI(poiSerNum,!me.pTopoliszMap.IsDrawPOI(poiSerNum),false);me.RefreshDrawPOIState();}
this.RefreshDrawPOIState=function()
{var i=0;var bAnySwitchedOn=false;for(i=0;i<me.arrInputPOIs.length;i++)
{var poiSerNum=me.arrInputPOIs[i].poiSerNum;me.arrInputPOIs[i].checked=me.pTopoliszMap.IsDrawPOI(poiSerNum);if(me.pTopoliszMap.IsDrawPOI(poiSerNum))bAnySwitchedOn=true;}
GetBlock("poilistblock").style.display=bAnySwitchedOn?"":"none";}
this.OnChangeLang=function()
{var arrHtmlIDs=["idButtonPaletteLabel1","idButtonPaletteLabel2","idButtonPaletteTMCLabel","idButtonPaletteUTVLabel","idButtonPalettePTStops"];var arrBabelIDs=["ButtonPaletteCaption","cbxTMC","utv","cbxPTStops"];for(var i=0;i<arrHtmlIDs.length;i++)
{var span=GetBlock(arrHtmlIDs[i]);if(span)
{while(span.firstChild)
span.removeChild(span.firstChild);NewTextTag(g_Babel.GetWord(arrBabelIDs[i]),span);}}}}

var ToolMan={events:function(){if(!ToolMan.tmEventsFactory)throw"ToolMan Events module isn't loaded";return ToolMan.tmEventsFactory},css:function(){if(!ToolMan.tmCssFactory)throw"ToolMan CSS module isn't loaded";return ToolMan.tmCssFactory},coordinates:function(){if(!ToolMan.tmCoordinatesFactory)throw"ToolMan Coordinates module isn't loaded";return ToolMan.tmCoordinatesFactory},drag:function(){if(!ToolMan.tmDragFactory)throw"ToolMan Drag module isn't loaded";return ToolMan.tmDragFactory},dragsort:function(){if(!ToolMan.tmDragsortFactory)throw"ToolMan DragSort module isn't loaded";return ToolMan.tmDragsortFactory},helpers:function(){return ToolMan.tmHelpers},cookies:function(){if(!ToolMan.tmCookieOven)throw"ToolMan Cookie module isn't loaded";return ToolMan.tmCookieOven},junkdrawer:function(){return ToolMan.tmJunkdrawer}}
ToolMan.tmHelpers={map:function(array,func){for(var i=0,n=array.length;i<n;i++)func(array[i])},nextItem:function(item,nodeName){if(item==null)return
var next=item.nextSibling
while(next!=null){if(next.nodeName==nodeName)return next
next=next.nextSibling}
return null},previousItem:function(item,nodeName){var previous=item.previousSibling
while(previous!=null){if(previous.nodeName==nodeName)return previous
previous=previous.previousSibling}
return null},moveBefore:function(item1,item2){var parent=item1.parentNode
parent.removeChild(item1)
parent.insertBefore(item1,item2)},moveAfter:function(item1,item2){var parent=item1.parentNode
parent.removeChild(item1)
parent.insertBefore(item1,item2?item2.nextSibling:null)}}
ToolMan.tmJunkdrawer={serializeList:function(list){var array=new Array()
if(list!=null)
{var items=list.getElementsByTagName("div")
for(var i=0,n=items.length;i<n;i++){var item=items[i]
array.push(ToolMan.junkdrawer().tmIdentifier(item))}}
return array.join('|')},serializeList2:function(list,objArray){var array=new Array()
if(list!=null)
{var items=list.getElementsByTagName("div")
for(var i=0,n=items.length;i<n;i++){var item=items[i]
var objArrayIdx=ToolMan.junkdrawer().getObjArrayIndex(item,objArray);if(objArrayIdx!=null)
{array.push(objArray[objArrayIdx]);}}}
return array;},inspectListOrder:function(id){alert(ToolMan.junkdrawer().serializeList(document.getElementById(id)))},inspectListOrder2:function(node,objArray){return ToolMan.junkdrawer().serializeList2(node,objArray)},getObjArrayIndex:function(item,objArray){var i;for(i=0;i<objArray.length;i++)
{if(objArray[i])
{if(objArray[i].GetDiv()==item)
return i;}}
return null;},restoreListOrder:function(listID){var list=document.getElementById(listID)
if(list==null)return
var cookie=ToolMan.cookies().get("list-"+listID)
if(!cookie)return;var IDs=cookie.split('|')
var items=ToolMan.junkdrawer().tmItemsByID(list)
for(var i=0,n=IDs.length;i<n;i++){var itemID=IDs[i]
if(itemID in items){var item=items[itemID]
list.removeChild(item)
list.insertBefore(item,null)}}},tmIdentifier:function(item){var trim=ToolMan.junkdrawer().trim
var identifier
identifier=trim(item.getAttribute("id"))
if(identifier!=null&&identifier.length>0)return identifier;identifier=trim(item.getAttribute("itemID"))
if(identifier!=null&&identifier.length>0)return identifier;return trim(item.innerHTML)},tmItemsByID:function(list){var array=new Array()
var items=list.getElementsByTagName('li')
for(var i=0,n=items.length;i<n;i++){var item=items[i]
array[ToolMan.junkdrawer().tmIdentifier(item)]=item}
return array},trim:function(text){if(text==null)return null
return text.replace(/^(\s+)?(.*\S)(\s+)?$/,'$2')}}

ToolMan.tmEventsFactory={fix:function(event){if(!event)event=window.event
if(event.target){if(event.target.nodeType==3)event.target=event.target.parentNode}else if(event.srcElement){event.target=event.srcElement}
return event},register:function(element,type,func){if(element.addEventListener){element.addEventListener(type,func,false)}else if(element.attachEvent){if(!element.tmListeners)element._listeners=new Array()
if(!element.tmListeners[type])element._listeners[type]=new Array()
var workaroundFunc=function(){func.apply(element,new Array())}
element.tmListeners[type][func]=workaroundFunc
element.attachEvent('on'+type,workaroundFunc)}},unregister:function(element,type,func){if(element.removeEventListener){element.removeEventListener(type,func,false)}else if(element.detachEvent){if(element.tmListeners&&element.tmListeners[type]&&element.tmListeners[type][func]){element.detachEvent('on'+type,element.tmListeners[type][func])}}}}

ToolMan.tmCssFactory={readStyle:function(element,property){if(element.style[property]){return element.style[property]}else if(element.currentStyle){return element.currentStyle[property]}else if(document.defaultView&&document.defaultView.getComputedStyle){var style=document.defaultView.getComputedStyle(element,null)
return style.getPropertyValue(property)}else{return null}}}

ToolMan.tmCoordinatesFactory={create:function(x,y){return new tmToolManCoordinate(this,x,y)},origin:function(){return this.create(0,0)},topLeftPosition:function(element){var left=parseInt(ToolMan.css().readStyle(element,"left"))
var left=isNaN(left)?0:left
var top=parseInt(ToolMan.css().readStyle(element,"top"))
var top=isNaN(top)?0:top
return this.create(left,top)},bottomRightPosition:function(element){return this.topLeftPosition(element).plus(this.tmSize(element))},topLeftOffset:function(element){var offset=this.tmOffset(element)
var parent=element.offsetParent
while(parent){offset=offset.plus(this.tmOffset(parent))
parent=parent.offsetParent}
return offset},bottomRightOffset:function(element){return this.topLeftOffset(element).plus(this.create(element.offsetWidth,element.offsetHeight))},scrollOffset:function(){if(window.pageXOffset){return this.create(window.pageXOffset,window.pageYOffset)}else if(document.documentElement){return this.create(document.body.scrollLeft+document.documentElement.scrollLeft,document.body.scrollTop+document.documentElement.scrollTop)}else if(document.body.scrollLeft>=0){return this.create(document.body.scrollLeft,document.body.scrollTop)}else{return this.create(0,0)}},clientSize:function(){if(window.innerHeight>=0){return this.create(window.innerWidth,window.innerHeight)}else if(document.documentElement){return this.create(document.documentElement.clientWidth,document.documentElement.clientHeight)}else if(document.body.clientHeight>=0){return this.create(document.body.clientWidth,document.body.clientHeight)}else{return this.create(0,0)}},mousePosition:function(event){event=ToolMan.events().fix(event)
return this.create(event.clientX,event.clientY)},mouseOffset:function(event){event=ToolMan.events().fix(event)
if(event.pageX>=0||event.pageX<0){return this.create(event.pageX,event.pageY)}else if(event.clientX>=0||event.clientX<0){return this.mousePosition(event).plus(this.scrollOffset())}},tmSize:function(element){return this.create(element.offsetWidth,element.offsetHeight)},tmOffset:function(element){return this.create(element.offsetLeft,element.offsetTop)}}
function tmToolManCoordinate(factory,x,y){this.factory=factory
this.x=isNaN(x)?0:x
this.y=isNaN(y)?0:y}
tmToolManCoordinate.prototype={toString:function(){return"("+this.x+","+this.y+")"},plus:function(that){return this.factory.create(this.x+that.x,this.y+that.y)},minus:function(that){return this.factory.create(this.x-that.x,this.y-that.y)},min:function(that){return this.factory.create(Math.min(this.x,that.x),Math.min(this.y,that.y))},max:function(that){return this.factory.create(Math.max(this.x,that.x),Math.max(this.y,that.y))},constrainTo:function(one,two){var min=one.min(two)
var max=one.max(two)
return this.max(min).min(max)},distance:function(that){return Math.sqrt(Math.pow(this.x-that.x,2)+Math.pow(this.y-that.y,2))},reposition:function(element){element.style["top"]=this.y+"px"
element.style["left"]=this.x+"px"}}

ToolMan.tmDragFactory={createSimpleGroup:function(element,handle){handle=handle?handle:element
var group=this.createGroup(element)
group.setHandle(handle)
group.transparentDrag()
group.onTopWhileDragging()
return group},createGroup:function(element){var group=new tmToolManDragGroup(this,element)
var position=ToolMan.css().readStyle(element,'position')
if(position=='static'){element.style["position"]='relative'}else if(position=='absolute'){ToolMan.coordinates().topLeftOffset(element).reposition(element)}
group.register('draginit',this.tmShowDragEventStatus)
group.register('dragmove',this.tmShowDragEventStatus)
group.register('dragend',this.tmShowDragEventStatus)
return group},tmShowDragEventStatus:function(dragEvent){},constraints:function(){return this.tmConstraintFactory},tmCreateEvent:function(type,event,group){return new tmToolManDragEvent(type,event,group)}}
function tmToolManDragGroup(factory,element){this.factory=factory
this.element=element
this.tmHandle=null
this.tmThresholdDistance=0
this.tmTransforms=new Array()
this.tmListeners=new Array()
this.tmListeners['draginit']=new Array()
this.tmListeners['dragstart']=new Array()
this.tmListeners['dragmove']=new Array()
this.tmListeners['dragend']=new Array()}
tmToolManDragGroup.prototype={setHandle:function(handle){var events=ToolMan.events()
handle.toolManDragGroup=this
events.register(handle,'mousedown',this.tmDragInit)
handle.onmousedown=function(){return false}
if(this.element!=handle)
events.unregister(this.element,'mousedown',this.tmDragInit)},register:function(type,func){this.tmListeners[type].push(func)},addTransform:function(transformFunc){this.tmTransforms.push(transformFunc)},verticalOnly:function(){this.addTransform(this.factory.constraints().vertical())},horizontalOnly:function(){this.addTransform(this.factory.constraints().horizontal())},setThreshold:function(thresholdDistance){this.tmThresholdDistance=thresholdDistance},transparentDrag:function(opacity){var opacity=typeof(opacity)!="undefined"?opacity:0.75;var originalOpacity=ToolMan.css().readStyle(this.element,"opacity")
var originalBackgroundColor=ToolMan.css().readStyle(this.element,"background-color")
this.register('dragstart',function(dragEvent){var element=dragEvent.group.element
element.style.opacity=opacity
element.style.filter='alpha(opacity='+(opacity*100)+')'
element.style.backgroundColor="#e4cfd9"})
this.register('dragend',function(dragEvent){var element=dragEvent.group.element
element.style.opacity=originalOpacity
element.style.filter='alpha(opacity=100)'
element.style.backgroundColor=originalBackgroundColor;})},onTopWhileDragging:function(zIndex){var zIndex=typeof(zIndex)!="undefined"?zIndex:100000;var originalZIndex=ToolMan.css().readStyle(this.element,"z-index")
this.register('dragstart',function(dragEvent){dragEvent.group.element.style.zIndex=zIndex})
this.register('dragend',function(dragEvent){dragEvent.group.element.style.zIndex=originalZIndex})},tmDragInit:function(event){event=ToolMan.events().fix(event)
var group=document.toolManDragGroup=this.toolManDragGroup
var dragEvent=group.factory.tmCreateEvent('draginit',event,group)
group.tmIsThresholdExceeded=false
group.tmInitialMouseOffset=dragEvent.mouseOffset
group.tmGrabOffset=dragEvent.mouseOffset.minus(dragEvent.topLeftOffset)
ToolMan.events().register(document,'mousemove',group.tmDrag)
document.onmousemove=function(){return false}
ToolMan.events().register(document,'mouseup',group.tmDragEnd)
group.tmNotifyListeners(dragEvent)},tmDrag:function(event){event=ToolMan.events().fix(event)
var coordinates=ToolMan.coordinates()
var group=this.toolManDragGroup
if(!group)return
var dragEvent=group.factory.tmCreateEvent('dragmove',event,group)
var newTopLeftOffset=dragEvent.mouseOffset.minus(group.tmGrabOffset)
if(!group.tmIsThresholdExceeded){var distance=dragEvent.mouseOffset.distance(group.tmInitialMouseOffset)
if(distance<group.tmThresholdDistance)return
group.tmIsThresholdExceeded=true
group.tmNotifyListeners(group.factory.tmCreateEvent('dragstart',event,group))}
for(var i=0;i<group.tmTransforms.length;i++){var myTransform=group.tmTransforms[i];if(myTransform)
newTopLeftOffset=myTransform(newTopLeftOffset,dragEvent);}
var dragDelta=newTopLeftOffset.minus(dragEvent.topLeftOffset)
var newTopLeftPosition=dragEvent.topLeftPosition.plus(dragDelta)
newTopLeftPosition.reposition(group.element)
dragEvent.transformedMouseOffset=newTopLeftOffset.plus(group.tmGrabOffset)
group.tmNotifyListeners(dragEvent)
var errorDelta=newTopLeftOffset.minus(coordinates.topLeftOffset(group.element))
if(errorDelta.x!=0||errorDelta.y!=0){coordinates.topLeftPosition(group.element).plus(errorDelta).reposition(group.element)}},tmDragEnd:function(event){event=ToolMan.events().fix(event)
var group=this.toolManDragGroup
if(group!=null)
{var dragEvent=group.factory.tmCreateEvent('dragend',event,group)
group.tmNotifyListeners(dragEvent)
this.toolManDragGroup=null
ToolMan.events().unregister(document,'mousemove',group.tmDrag)
document.onmousemove=null
ToolMan.events().unregister(document,'mouseup',group.tmDragEnd)}},tmNotifyListeners:function(dragEvent){var listeners=this.tmListeners[dragEvent.type]
for(var i=0;i<listeners.length;i++){if(listeners[i])
listeners[i](dragEvent);}}}
function tmToolManDragEvent(type,event,group){this.type=type
this.group=group
this.mousePosition=ToolMan.coordinates().mousePosition(event)
this.mouseOffset=ToolMan.coordinates().mouseOffset(event)
this.transformedMouseOffset=this.mouseOffset
this.topLeftPosition=ToolMan.coordinates().topLeftPosition(group.element)
this.topLeftOffset=ToolMan.coordinates().topLeftOffset(group.element)}
tmToolManDragEvent.prototype={toString:function(){return"mouse: "+this.mousePosition+this.mouseOffset+"    "+"xmouse: "+this.transformedMouseOffset+"    "+"left,top: "+this.topLeftPosition+this.topLeftOffset}}
ToolMan.tmDragFactory.tmConstraintFactory={vertical:function(){return function(coordinate,dragEvent){var x=dragEvent.topLeftOffset.x
return coordinate.x!=x?coordinate.factory.create(x,coordinate.y):coordinate}},horizontal:function(){return function(coordinate,dragEvent){var y=dragEvent.topLeftOffset.y
return coordinate.y!=y?coordinate.factory.create(coordinate.x,y):coordinate}}}

ToolMan.tmDragsortFactory={makeSortable:function(item){var group=ToolMan.drag().createSimpleGroup(item)
group.register('dragstart',this.tmOnDragStart)
group.register('dragmove',this.tmOnDragMove)
group.register('dragend',this.tmOnDragEnd)
return group},makeListSortable:function(list){var helpers=ToolMan.helpers()
var coordinates=ToolMan.coordinates()
var items=list;helpers.map(items,function(item){var dragGroup=dragsort.makeSortable(item)
dragGroup.setThreshold(4)
var min,max
dragGroup.addTransform(function(coordinate,dragEvent){return coordinate.constrainTo(min,max)})
dragGroup.register('dragstart',function(){var items=list;min=max=coordinates.topLeftOffset(items[0])
for(var i=1,n=items.length;i<n;i++){var offset=coordinates.topLeftOffset(items[i])
min=min.min(offset)
max=max.max(offset)}})})
for(var i=1,n=arguments.length;i<n;i++)
helpers.map(items,arguments[i])},tmOnDragStart:function(dragEvent){},tmOnDragMove:function(dragEvent){var helpers=ToolMan.helpers()
var coordinates=ToolMan.coordinates()
var item=dragEvent.group.element
var xmouse=dragEvent.transformedMouseOffset
var moveTo=null
var previous=helpers.previousItem(item,item.nodeName)
while(previous!=null){var bottomRight=coordinates.bottomRightOffset(previous)
if(xmouse.y<=bottomRight.y&&xmouse.x<=bottomRight.x){moveTo=previous}
previous=helpers.previousItem(previous,item.nodeName)}
if(moveTo!=null){helpers.moveBefore(item,moveTo)
return}
var next=helpers.nextItem(item,item.nodeName)
while(next!=null){var topLeft=coordinates.topLeftOffset(next)
if(topLeft.y<=xmouse.y&&topLeft.x<=xmouse.x){moveTo=next}
next=helpers.nextItem(next,item.nodeName)}
if(moveTo!=null){helpers.moveBefore(item,helpers.nextItem(moveTo,item.nodeName))
return}},tmOnDragEnd:function(dragEvent){ToolMan.coordinates().create(0,0).reposition(dragEvent.group.element)}}

ToolMan.tmCookieOven={set:function(name,value,expirationInDays){if(expirationInDays){var date=new Date()
date.setTime(date.getTime()+(expirationInDays*24*60*60*1000))
var expires="; expires="+date.toGMTString()}else{var expires=""}
document.cookie=name+"="+value+expires+"; path=/"},get:function(name){var namePattern=name+"="
var cookies=document.cookie.split(';')
for(var i=0,n=cookies.length;i<n;i++){var c=cookies[i]
while(c.charAt(0)==' ')c=c.substring(1,c.length)
if(c.indexOf(namePattern)==0)
return c.substring(namePattern.length,c.length)}
return null},eraseCookie:function(name){createCookie(name,"",-1)}}

function CDragAndDrop()
{this.objArray=null;this.parentDiv=null;var me=this;this.OnError=function(exp,strSource){};dragsort=ToolMan.dragsort()
junkdrawer=ToolMan.junkdrawer()
this.SetArray=function(objArray)
{me.objArray=objArray;if(objArray.length>0)
{var i=0;while((objArray[i]==null)&&(i<objArray.length))
{i++;}
if(i<objArray.length)
{me.parentDiv=objArray[i].GetDiv().parentNode;var inputArray=new Array();var j;for(j=i;j<objArray.length;j++)
{if(objArray[j]!=null)
{var actDiv=objArray[j].GetDiv();inputArray.push(actDiv);}}
dragsort.makeListSortable(inputArray,verticalOnly,saveOrder,myOnDragEnd,myOnDragStart);}}}
this.OnDragStart=function()
{}
this.OnArrayChanged=function()
{}
this.GetArray=function()
{var array=junkdrawer.inspectListOrder2(me.parentDiv,me.objArray);return array;}
function verticalOnly(item){item.toolManDragGroup.verticalOnly()}
function saveOrder(item){var group=item.toolManDragGroup
var list=group.element.parentNode
var id=list.getAttribute("id")
if(id==null)return
group.register('dragend',function(){ToolMan.cookies().set("list-"+id,junkdrawer.serializeList(list),365)})}
function myOnDragStart(item){var group=item.toolManDragGroup;group.register('dragstart',function(){if(me.OnDragStart)
{try{me.OnDragStart();}
catch(exp){if(me.OnError)
me.OnError(exp,'CDragAndDrop.OnDragStart');}}});}
function myOnDragEnd(item){var group=item.toolManDragGroup
group.register('dragend',function(){var i;var newArray=me.GetArray();for(i=0;i<newArray.length;i++)
me.objArray[i]=newArray[i];me.OnArrayChanged();})}}

function StatusAnimator()
{this.iState=0;this.iOpac=100;this.bFading=true;this.hTimer=null;this.div=null;var me=this;this.GetDiv=function()
{return me.div;}
this.SetDiv=function(div)
{me.div=div;}
this.ClearDiv=function()
{if(me.div)
{while(me.div.firstChild)
me.div.removeChild(me.div.firstChild);}}
this.ShowReady=function(iCommandID)
{if(!me.div)
return;me.ClearDiv();NewTextTag("Kész.",me.div);me.StartAnimate();}
this.ShowError=function(exp,iCommandID)
{if(!me.div)
return;me.ClearDiv();NewTextTag("Kommunikációs hiba!",me.div);me.StartAnimate();}
this.ShowState=function(iState)
{if(iState!=null)
me.iState=iState;if(me.div)
{me.ClearDiv();if(me.iState!=4||iState!=null)
{if(me.iState>0&&me.iState<4)
NewTextTag("Letöltés...",me.div);else
NewTextTag("Kész",me.div);me.StartAnimate();}
else
{if(me.hTimer)
clearInterval(me.hTimer);}}}
this.StartAnimate=function()
{me.iOpac=100;me.bFading=true;if(me.hTimer)
clearInterval(me.hTimer);me.hTimer=setInterval(me.Animate,80);}
this.Animate=function()
{if(me.bFading)
me.iOpac-=5;else
me.iOpac+=5;if(me.iOpac<=0)
{me.bFading=false;me.ShowState(null);}
if(me.iOpac>=100)
{me.bFading=true;}
SetOpac(me.div,Math.max(0,Math.min(me.iOpac,100)));}}

function PopUpHandler(){this.popupStatus=0;this.bgColor="";var me=this;this.SetBackgroundColor=function(bgColor)
{me.bgColor=bgColor;}
this.SetContent=function(p_title,p_content){GetBlock("popupTitle").innerHTML=p_title;var content=GetBlock("popupContent");while(content.hasChildNodes()){content.removeChild(content.firstChild);}
AddTag(p_content,content);GetBlock("popupHolder").style.backgroundColor=me.bgColor;me.bgColor="";}
this.SetSize=function(p_width,p_height){GetBlock("popupHolder").style.width=p_width+"px";GetBlock("popupHolder").style.height=p_height+"px";}
this.ShowPopup=function(){if(me.popupStatus==0){var arrIDsToHide=["idBannerBottom","idBannerSuperTop","idBannerTop","idBannerRight"];for(var i=0;i<arrIDsToHide.length;i++)
{var div=GetBlock(arrIDsToHide[i]);if(div&&div.style)
div.style.visibility='hidden';}
$("#backgroundPopup").css({"opacity":"0.5"});$("#backgroundPopup").fadeIn("fast");$("#popupHolder").fadeIn("fast");me.popupStatus=1;}}
this.HidePopup=function(){if(me.popupStatus==1){$("#backgroundPopup").fadeOut("fast");$("#popupHolder").fadeOut("fast");me.popupStatus=0;var arrIDsToShow=["idBannerBottom","idBannerSuperTop","idBannerTop","idBannerRight"];for(var i=0;i<arrIDsToShow.length;i++)
{var div=GetBlock(arrIDsToShow[i]);if(div&&div.style)
div.style.visibility='visible';}}}
this.CenterPopup=function(){var windowWidth=document.documentElement.clientWidth;var windowHeight=document.documentElement.clientHeight;var popupHeight=$("#popupHolder").height();var popupWidth=$("#popupHolder").width();$("#popupHolder").css({"position":"absolute","top":windowHeight/2-popupHeight/2+$(window).scrollTop(),"left":windowWidth/2-popupWidth/2+$(window).scrollLeft()});$("#backgroundPopup").css({"height":windowHeight});}
this.Init=function(){$("#popupHolderClose").click(function(){me.HidePopup();});$(document).keypress(function(e){if(e.keyCode==27&&me.popupStatus==1){me.HidePopup();}});}
me.Init();}

function WaRandom()
{WEBAUDIT=function()
{this.WACID=null;this.WACIDName="WACID";this.getCookie=function(name)
{var nameEQ=name+"=";var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++)
{var c=ca[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(nameEQ)==0)return c.substring(nameEQ.length,c.length);}
return null;}
this.setCookie=function(name,value,topDomain)
{var date=new Date(2020,12,31,23,59,59);var expires="; expires="+date.toGMTString();document.cookie=name+"="+value+expires+"; path=/; domain="+topDomain;}
this.generateID=function(splitter)
{var sp=(splitter)?splitter:'A';var now=new Date();return Date.parse(now.toGMTString())+sp+Math.floor(Math.random()*1000000);}
this.getTopDomain=function(fullDomain)
{var darabok=fullDomain.split('.');return darabok[(darabok.length-2)]+'.'+darabok[(darabok.length-1)];}
this.getDomain=function(url)
{var urlDarabok=url.split('/');return urlDarabok[2];}
this.WACID=null}
var wa=new WEBAUDIT();var felbontas="";same=Math.floor(Math.random()*1000000);if(wa.WACID==null)
{wa.WACID=wa.generateID('A');wa.setCookie(wa.WACIDName,wa.WACID,wa.getTopDomain(wa.getDomain(document.URL)));}
same=same+"@welid="+wa.WACID;if(screen)felbontas='@felbontas='+screen.width+'x'+screen.height;same=same+felbontas;}
var g_WaType="";function SetWaType(strType)
{g_WaType=strType;}
function WaCount()
{if((typeof(g_InitSettings)!='undefined')&&g_InitSettings.strCountryName.substr(0,3)=="Rom")
{WaRomania();}
else
{switch(g_WaType)
{case"car":WaCarTraffic();break;case"bkv":WaBkvTraffic();break;case"train":WaTrainTraffic();break;case"pt":WaPTTraffic();break;default:WaMapDraw();break;}
g_WaType="";}}
function WaMapDraw()
{WaRandom();var div=GetBlock('divWa');if(div)
{while(div.firstChild)
div.removeChild(div.firstChild);var img=NewTag('img',div);SetImage(img,"http://audit.median.hu/cgi-bin/track.cgi?uc=11279165406728&dc=1&ui="+same,1,1);}}
function WaCarTraffic()
{WaRandom();var div=GetBlock('divWa');if(div)
{while(div.firstChild)
div.removeChild(div.firstChild);var img=NewTag('img',div);SetImage(img,"http://audit.median.hu/cgi-bin/track.cgi?uc=11279166015104&dc=1&ui="+same,1,1);}}
function WaBkvTraffic()
{WaRandom();var div=GetBlock('divWa');if(div)
{while(div.firstChild)
div.removeChild(div.firstChild);var img=NewTag('img',div);SetImage(img,"http://audit.median.hu/cgi-bin/track.cgi?uc=11279165816938&dc=1&ui="+same,1,1);}}
function WaTrainTraffic()
{WaRandom();var div=GetBlock('divWa');if(div)
{while(div.firstChild)
div.removeChild(div.firstChild);var img=NewTag('img',div);SetImage(img,"http://audit.median.hu/cgi-bin/track.cgi?uc=11279166225792&dc=1&ui="+same,1,1);}}
function WaPTTraffic()
{WaRandom();var div=GetBlock('divWa');if(div)
{while(div.firstChild)
div.removeChild(div.firstChild);var img=NewTag('img',div);SetImage(img,"http://audit.median.hu/cgi-bin/track.cgi?uc=11279166414294&dc=1&ui="+same,1,1);}}
function WaRomania()
{WaRandom();var div=GetBlock('divWa');if(div)
{while(div.firstChild)
div.removeChild(div.firstChild);var img=NewTag('img',div);SetImage(img,"http://audit.median.hu/cgi-bin/track.cgi?uc=11279169683068&dc=1&ui="+same,1,1);}}
