﻿/// <reference path="/Scripts/VeJavaScriptIntellisenseHelper.js" />
var LYTColors = null; 
var lastRightClicedPointInMap = null; 

function InitializeGlobalVariables()
{
     LYTColors = Array( new VEColor(255,255,255,0.5),
                        new VEColor(0,255,0,0.7),
                        new VEColor(255,0,0,0.7),
                        new VEColor(0,0,255,0.7),
                        new VEColor(255,255,0,0.7),
                        new VEColor(0,255,255,0.7)
                      );
     lastRightClicedPointInMap = new VEPixel(0, 0);
}
function SetUserIcon(type, size, mapmode, userid)
{
    var icon = new VECustomIconSpecification();
    switch (type)
    {
         case "highlight":
            if (size == "gr")
                icon.Image = "/App_Themes/CWDefault/MapIcons/Pin_highlight.png";
            else
                icon.Image = "/App_Themes/CWDefault/MapIcons/Pin_highlight.png";
            break;  
    }
    switch (mapmode)
    {
        case "2D":
            if (size == "gr")
            {
                if ((type == "start") || (type == "end") || (type == "startend") || (type == "highlight"))
                    icon.ImageOffset = new VEPixel(-10, -37);
                if ((type == "comment") || (type == "picture") || (type == "poi"))
                    icon.ImageOffset = new VEPixel(-9, -25); 
            }
            else
                icon.ImageOffset = new VEPixel(10, -12);
            break;
        case "3D":
            if (size == "gr")
            {
                if ((type == "start") || (type == "end") || (type == "startend") || (type == "highlight"))
                    icon.ImageOffset = new VEPixel(0, 8);
                if ((type == "comment") || (type == "picture") || (type == "poi"))
                    icon.ImageOffset = new VEPixel(-9, 0); 
            }
            else
                icon.ImageOffset = new VEPixel(10, -12);
            break;    
        case "BIRD":
            if (size == "gr")
            {
                if ((type == "start") || (type == "end") || (type == "startend") || (type == "highlight"))
                    icon.ImageOffset = new VEPixel(-10, -37);
                if ((type == "comment") || (type == "picture") || (type == "poi"))
                    icon.ImageOffset = new VEPixel(-9, -25); 
            }
            else
                icon.ImageOffset = new VEPixel(10, -12);
            break;      
        default:
            if (size == "gr")
            {
                if ((type == "start") || (type == "end") || (type == "startend") || (type == "highlight"))
                    icon.ImageOffset = new VEPixel(-12, -39);
                if ((type == "comment") || (type == "picture") || (type == "poi"))
                    icon.ImageOffset = new VEPixel(-9, -25); 
            }
            else
                icon.ImageOffset = new VEPixel(10, -12);
            break;              
    }
    icon.TextContent=" ";
    return icon;
}
function SetPOIIcon(type, size, mapmode)
{
    var icon = new VECustomIconSpecification();
    // 17.09.08 .. bei size=gr kommt auch das big icon und nicht genau umgekehrt ;)
    if (size == "gr")
        icon.Image = String.format("/App_Themes/CWDefault/PoiIcons/POIPin-{0}_big.png", type); 
    else
        icon.Image = String.format("/App_Themes/CWDefault/PoiIcons/POIPin-{0}_small.png", type);
    switch (mapmode)
    {
        case "2D":
            if (size == "gr")
                icon.ImageOffset = new VEPixel(-32, -40); 
            else
                icon.ImageOffset = new VEPixel(-0, -28);
            break;
        case "3D":
            if (size == "gr")
                icon.ImageOffset = new VEPixel(-32, -40); 
            else
                icon.ImageOffset = new VEPixel(-0, 2);
            break;    
        case "BIRD":
            if (size == "gr")
                icon.ImageOffset = new VEPixel(-32, -40); 
            else
                icon.ImageOffset = new VEPixel(-0, -28);
            break;      
        default:
            if (size == "gr")
                icon.ImageOffset = new VEPixel(-32, -40); 
            else
                icon.ImageOffset = new VEPixel(-0, -28);
            break;              
    }
    icon.TextContent=" ";
    return icon;
}

function SetPinIcon(type, size, mapmode)
{
    var icon = new VECustomIconSpecification();
    switch (type)
    {
        case "start":
            if (size == "gr")
                icon.Image = "/App_Themes/CWDefault/MapIcons/Pin_Start.png";
            else
                icon.Image = "/images/Pins/TrackStart_kl.png";
            break;
        case "end":
            if (size == "gr")
                icon.Image = "/App_Themes/CWDefault/MapIcons/Pin_End.png";
            else
                icon.Image = "/images/Pins/TrackEnd_kl.png";
            break;
        case "startend":
            if (size == "gr")
                icon.Image = "/App_Themes/CWDefault/MapIcons/Pin_Loop.png";
            else
                icon.Image = "/images/Pins/TrackStartEnd_kl.png";
            break;
        case "picture":
            if (size == "gr")
                icon.Image = "/App_Themes/CWDefault/MapIcons/Pin_Photo.png";
            else
                icon.Image = "/images/Pins/TrackMargenta_kl.png";
            break;
        case "pictureWithComment":
            if (size == "gr")
                icon.Image = "/App_Themes/CWDefault/MapIcons/Pin_PhotoComment.png";
            else
                icon.Image = "/images/Pins/TrackMargenta_kl.png";
            break;
        case "maxheight":
            if (size == "gr")
                icon.Image = "/images/Pins/TrackMaxHeight_gr.png";
            else
                icon.Image = "/images/Pins/TrackMaxHeight_kl.png";
            break;
        case "maxspeed":
            if (size == "gr")
                icon.Image = "/images/Pins/TrackMaxSpeed_gr.png";
            else
                icon.Image = "/images/Pins/TrackMaxSpeed_kl.png";
            break;
        case "comment":
            if (size == "gr")
                icon.Image = "/App_Themes/CWDefault/MapIcons/Comment.png";
            else
                icon.Image = "/images/Pins/TrackCyan_kl.png";
            break;
        case "highlight":
            if (size == "gr")
                icon.Image = "/App_Themes/CWDefault/MapIcons/Pin_Highlight.png";
            else
                icon.Image = "/App_Themes/CWDefault/MapIcons/Highlight_kl.png";
            break;            
         case "poi":
            if (size == "gr")
                icon.Image = "/App_Themes/CWDefault/MapIcons/Poi.png";
            else
                icon.Image = "/images/Pins/TrackOrange_kl.png";
            break;
         case "poi_highlight":
            if (size == "gr")
                icon.Image = "/App_Themes/CWDefault/MapIcons/Poi_highlighted.png";
            else
                icon.Image = "/App_Themes/CWDefault/MapIcons/Poi_highlighted.png";
            break;
        case "edit_point":
            if (size == "gr")
                icon.Image = "/App_Themes/CWDefault/MapIcons/red_point_kl.png";
            break;
    }
    switch (mapmode)
    {
        case "2D":
            if (size == "gr") {
                if ((type == "start") || (type == "end") || (type == "startend") || (type == "highlight"))
                    icon.ImageOffset = new VEPixel(-10, -37);
                if ((type == "comment") || (type == "picture"))
                    icon.ImageOffset = new VEPixel(-5, -20);
                if ((type == "poi"))
                    icon.ImageOffset = new VEPixel(-3, -18);
                if ((type == "pictureWithComment"))
                    icon.ImageOffset = new VEPixel(-9, -25);
                if (type == "edit_point")
                    icon.ImageOffset = new VEPixel(7, 7);
            }
            else
                icon.ImageOffset = new VEPixel(10, -12);
            break;
        case "3D":
            if (size == "gr")
            {
                if ((type == "start") || (type == "end") || (type == "startend") || (type == "highlight"))
                    icon.ImageOffset = new VEPixel(0, 8);
                if ((type == "comment") || (type == "picture") || (type == "poi") || (type == "pictureWithComment"))
                    icon.ImageOffset = new VEPixel(0, 8); 
            }
            else
                icon.ImageOffset = new VEPixel(10, -12);
            break;    
        case "BIRD":
            if (size == "gr")
            {
                if ((type == "start") || (type == "end") || (type == "startend") || (type == "highlight"))
                    icon.ImageOffset = new VEPixel(-12, -39);
                if ((type == "comment") || (type == "picture") || (type == "poi") || (type == "pictureWithComment"))
                    icon.ImageOffset = new VEPixel(-9, -25); 
            }
            else
                icon.ImageOffset = new VEPixel(10, -12);
            break;      
        default:
            if (size == "gr")
            {
                if ((type == "start") || (type == "end") || (type == "startend") || (type == "highlight"))
                    icon.ImageOffset = new VEPixel(-12, -39);
                if ((type == "comment") || (type == "picture") || (type == "poi") || (type == "pictureWithComment"))
                    icon.ImageOffset = new VEPixel(-9, -25); 
            }
            else
                icon.ImageOffset = new VEPixel(10, -12);
            break;              
    }
    icon.TextContent=" ";
    return icon;
}



function hidePopupMenu()
{
  var menu = document.getElementById('popupmenu').style.display='none';
}

function prepMenu()
{
    navRoot = document.getElementById("popupmenu");
    var items = navRoot.getElementsByTagName('li');
    for (i=0; i<items.length; i++)
    {
        node = items[i];
        if (node.nodeName=="LI")
        {
            node.onmouseover = function()
            {
                this.className+=" over"; //Show the submenu
            }
            node.onmouseout=function()
            {
                if (this.className.indexOf('pmenu') > 0)
                {
                    this.className="pmenu";
                } else {
                    this.className = "";
                }
            }
        }
    }
}


function showPopupMenu(e)
{
    hidePopupMenu();
    if (e.rightMouseButton) {       
        lastRightClicedPointInMap = new VEPixel(e.mapX, e.mapY);
        var x = map.GetLeft();
        var y = map.GetTop();
        var menu = document.getElementById('popupmenu');
        menu.style.display='block'; //Showing the menu
        menu.style.left = e.mapX + x; //Positioning the menu
        menu.style.top = e.mapY + y;
    }
}  

function CreateRoutePopup()
{
    var htmlstring = "";
    htmlstring += "<div style='width: 415px; float:left; font-family: Arial, Helvetica, sans-serif; color: #999999;'>";
	htmlstring += "<span style='width: 415px; float:left; font-size: 18px; color: #99cc33;'><a style='font-size: 18px;' href='/RouteDetails.aspx?RouteID={12}'>{0}</a></span>"; // RouteName
	htmlstring +=   "<span style='width: 415px; float:left; font-size: 14px; margin-bottom:15px;'>{1}</span>"; // Location
	htmlstring +=    "<div style='width: 230px; float:left; margin-right:5px;'>";
    htmlstring +=        "<img src='{2}'/></div>"; // RouteImage
	htmlstring +=    "<div class='routeDetailsDescriptionInfoBox'>";
	htmlstring +=        "<table cellpadding='1' cellspacing='1' style='width: 55px;'>";
	htmlstring +=         "<tr align='center' style='font-size:10px; color:#999999; width: 55px;'>";
	htmlstring +=          "<td>Dist.</td>";
	htmlstring +=        "</tr>";
	htmlstring +=        "<tr align='center' style='font-size:12px;'>";
	htmlstring +=         "<td>";
	htmlstring +=         "<span style='font-size: 13px;'>{4}</span>"; // Distance
	htmlstring +=         "</td>";
	htmlstring +=        "</tr>";
	htmlstring +=       "</table>";
	htmlstring +=   "</div>";
	htmlstring +=   "<div class='routeDetailsDescriptionInfoBox'>";
	htmlstring +=       "<table cellpadding='1' cellspacing='1' style='width: 55px;'>";
	htmlstring +=        "<tr align='center' style='font-size:10px; color:#999999; width: 55px;'>";
	htmlstring +=         "<td>Alt.</td>";
	htmlstring +=        "</tr>";
	htmlstring +=        "<tr align='center' style='font-size:12px;'>";
	htmlstring +=         "<td>";
	htmlstring +=         "<span style='font-size: 13px;'>{5}</span>"; // Elevation
	htmlstring +=         "</td>";
	htmlstring +=        "</tr>";
	htmlstring +=       "</table>";
	htmlstring +=   "</div>";
	htmlstring +=   "<div class='routeDetailsDescriptionInfoBox'>";
	htmlstring +=       "<table cellpadding='1' cellspacing='1' style='width: 55px;'>";
	htmlstring +=        "<tr align='center' style='font-size:10px; color:#999999; width: 55px;'>";
	htmlstring +=         "<td>Dur.</td>";
	htmlstring +=        "</tr>";
	htmlstring +=        "<tr align='center' style='font-size:12px;'>";
	htmlstring +=         "<td>";
	htmlstring +=         "<span style='font-size: 13px;'>{6}</span>"; // Duration
	htmlstring +=         "</td>";
	htmlstring +=        "</tr>";
	htmlstring +=       "</table>";
	htmlstring +=   "</div>";
	htmlstring +=    "<div style='width: 38px; height: 35px; padding-left:3px; margin-top:5px;float:left;'>"; // 
    htmlstring +=        "<img src='/App_Themes/CWDefault/ActivityIcons/Activity-{3}.png' alt='Activity'/></div>"; // ActivityImage
    htmlstring += "<div style='width: 180px; height: 50px;float:left;margin-top: 23px;'>";
    htmlstring +=   "<div style='width: 50px; height: 50px;float:left;'>";
    htmlstring +=       "<img src='{7}' alt='User'/>"; // UserAvatar
    htmlstring +=   "</div>";
    htmlstring +=   "<div style='width: 125px; height: 19px;float:left;padding-left: 5px; margin-top:14px;'>";
    htmlstring +=        "<span style='font-size: 11px;'>by</span> <a style='font-size: 16px;' href='/UserDetails.aspx?UserID={8}'>{9}</a>"; // UserID UserName
    htmlstring +=   "</div>";
    htmlstring +=   "<div style='width: 125px; height: 17px;float:left;padding-left: 5px;'>";
    htmlstring +=       "<span style='font-size: 11px;'>erstellt am {10}</span>"; // DateCreated
    htmlstring +=   "</div>";
    htmlstring += "</div>";
    htmlstring +=  "<div style='width: 415px; float:left;margin-top: 5px;font-size: 11px;'>{11}</div>"; //Summary
    htmlstring += "<div style='width: 400px; float:left;padding-left:10px; margin-top: 5px; font-size: 11px; text-align:right;'><a style='font-size: 16px;' href='/RouteDetails.aspx?RouteID={12}'>Details</a></div>"; // RouteID	
    htmlstring += "</div>";
    return htmlstring;
}

// Updated 17.01.2010
function CreateRoutePopup2() {
    // 0 Link to route
    // 1 Caption of the route
    // 2 Url of the mainpicture
    // 3 location string
    // 4 Description text
    // 5 Link to the user
    // 6 Url of the user avatar
    // 7 User name
    // 8 "by" text
    // 9 date string
    // 10 "Details" text
    // 11 RouteActivity ID
    // 12 Distance
    // 13 Elevation
    // 14 Duration
    // Edit link is missing!!!
    var htmlstring = "";
    htmlstring += "<div style=\"width:415px; float:left; font-family:Arial, Helvetica, sans-serif; color:#999999;\">";
    htmlstring += "    <img src=\"/App_Themes/CWDefault/ActivityIcons/Activity-{11}.png\" title=\"\" alt=\"\" style=\"float:left; margin-right:5px;\" />";
    htmlstring += "    <span style=\"width:370px; float:left; font-size:18px; color:#99CC33; margin-bottom:2px;\"><a style=\"font-size:18px;\" href=\"{0}\">{1}</a></span><br />";
    htmlstring += "    <span style=\"width:370px; float:left; font-size:12px; color:#999999; margin-bottom:5px;\">{3}</span>";
    htmlstring += "    <div style=\"width:230px; float:left; margin-right:5px;\">";
    htmlstring += "        <a href=\"{0}\" title=\"{1}\" style=\"float:left; width:230px; height:152px; background-image:url('{2}'); background-repeat:no-repeat; background-position:center center; overflow:hidden;\"></a>";
    htmlstring += "    </div>";
    htmlstring += "    <div class='routeDetailsDescriptionInfoBox'>";
    htmlstring += "        <table cellpadding='1' cellspacing='1' style='width: 55px;'>";
    htmlstring += "        <tr align='center' style='font-size:10px; color:#999999; width: 55px;'>";
    htmlstring += "        <td>Dist.</td>";
    htmlstring += "        </tr>";
    htmlstring += "        <tr align='center' style='font-size:12px;'>";
    htmlstring += "        <td>";
    htmlstring += "        <span style='font-size: 13px;'>{12}</span>"; // Distance
    htmlstring += "        </td>";
    htmlstring += "        </tr>";
    htmlstring += "      </table>";
    htmlstring += "    </div>";
    htmlstring += "    <div class='routeDetailsDescriptionInfoBox'>";
    htmlstring += "      <table cellpadding='1' cellspacing='1' style='width: 55px;'>";
    htmlstring += "        <tr align='center' style='font-size:10px; color:#999999; width: 55px;'>";
    htmlstring += "        <td>Alt.</td>";
    htmlstring += "        </tr>";
    htmlstring += "        <tr align='center' style='font-size:12px;'>";
    htmlstring += "        <td>";
    htmlstring += "        <span style='font-size: 13px;'>{13}</span>"; // Elevation
    htmlstring += "        </td>";
    htmlstring += "        </tr>";
    htmlstring += "      </table>";
    htmlstring += "    </div>";
    htmlstring += "    <div class='routeDetailsDescriptionInfoBox'>";
    htmlstring += "      <table cellpadding='1' cellspacing='1' style='width: 55px;'>";
    htmlstring += "        <tr align='center' style='font-size:10px; color:#999999; width: 55px;'>";
    htmlstring += "        <td>Dur.</td>";
    htmlstring += "        </tr>";
    htmlstring += "        <tr align='center' style='font-size:12px;'>";
    htmlstring += "        <td>";
    htmlstring += "        <span style='font-size: 13px;'>{14}</span>"; // Duration
    htmlstring += "        </td>";
    htmlstring += "        </tr>";
    htmlstring += "      </table>";
    htmlstring += "    </div>";
    htmlstring += "    <div style=\"width:180px; float:left; min-height:53px; font-size:11px; margin:0px;\">{4}</div>";
    htmlstring += "    <div style=\"width:180px; height:50px; float:left; margin-top:10px;\">";
    htmlstring += "        <div style=\"width:50px; height:50px; float: left;\">";
    htmlstring += "            <a href=\"{5}\"><img style=\"border:0px;\" src=\"{6}\" alt=\"{7}\" title=\"{7}\" /></a>";
    htmlstring += "        </div>";
    htmlstring += "        <div style=\"width:125px; height:19px; float:left; padding-left:5px; margin-top:18px;\">";
    htmlstring += "            <span style=\"font-size:11px;\">{8} </span><a style=\"font-size:14px; border:0px;\" href=\"{5}\">{7}</a>";
    htmlstring += "            <br />";
    htmlstring += "            <span style=\"font-size:11px;\">{9}</span>";
    htmlstring += "        </div>";
    htmlstring += "    </div>";
    htmlstring += "    <div style=\"width:400px; float:left; padding-left:10px; margin-top:15px; font-size:11px; text-align:right;\"><a style=\"font-size:16px;\" href=\"{0}\">{10}</a></div>";
    htmlstring += "</div>";
    return htmlstring;
}

function CreateRouteResultListItem()
{
    var htmlstring = "";
    htmlstring += "<div class='RouteResultListItem' onmouseover='HighlightRoute({7},{5},{6})' onmouseout='RemoveHighlightRoute({7})' onclick='RouteDetailsClick({7})' >";
    htmlstring += "<span style='width: 232px; float:left; font-size: 16px; color: #99cc33;'>{0}</span>"; // RouteName
    htmlstring += "<div class='routeDetailsDescriptionInfoBox'>";
	htmlstring += "    <table cellpadding='1' cellspacing='1' style='width: 55px;'>";
	htmlstring += "     <tr align='center' style='font-size:10px; color:#999999; width: 55px;'>";
	htmlstring += "      <td>Dist.</td>";
	htmlstring += "     </tr>";
	htmlstring += "     <tr align='center' style='font-size:12px;'>";
	htmlstring += "      <td>";
	htmlstring += "      <span style='font-size: 13px;'>{1}</span>"; // Distance
	htmlstring += "      </td>";
	htmlstring += "     </tr>";
	htmlstring += "    </table>";
	htmlstring += "</div>";
	htmlstring += "<div class='routeDetailsDescriptionInfoBox'>";
	htmlstring += "    <table cellpadding='1' cellspacing='1' style='width: 55px;'>";
	htmlstring += "     <tr align='center' style='font-size:10px; color:#999999; width: 55px;'>";
	htmlstring += "      <td>Alt.</td>";
	htmlstring += "     </tr>";
	htmlstring += "     <tr align='center' style='font-size:12px;'>";
	htmlstring += "      <td>";
	htmlstring += "      <span style='font-size: 13px;'>{2}</span>"; // Altitude
	htmlstring += "      </td>";
	htmlstring += "     </tr>";
	htmlstring += "    </table>";
	htmlstring += "</div>";
	htmlstring += "<div class='routeDetailsDescriptionInfoBox'>";
	htmlstring += "    <table cellpadding='1' cellspacing='1' style='width: 55px;'>";
	htmlstring += "     <tr align='center' style='font-size:10px; color:#999999; width: 55px;'>";
	htmlstring += "      <td>Dur.</td>";
	htmlstring += "     </tr>";
	htmlstring += "     <tr align='center' style='font-size:12px;'>";
	htmlstring += "      <td>";
	htmlstring += "      <span style='font-size: 13px;'>{3}</span>"; //Duration
	htmlstring += "      </td>";
	htmlstring += "     </tr>";
	htmlstring += "    </table>";
	htmlstring += "</div>";
	htmlstring += "<div style='width: 35px; height: 35px; margin-left:197px; padding-top:4px; float:none;'>";
    htmlstring += "    <img src='../App_Themes/CWDefault/ActivityIcons/Activity-{4}.png' alt='Activity'/></div>   "; // Activity 
    htmlstring += "</div>";
    return htmlstring;
}

// Updated 05.11.09
function CreatePicturePopup() {
    // 0 Link to Picture
    // 1 Caption of the Picture
    // 2 Url of the picture
    // 3 Comment string
    // 4 Description text
    // 5 Link to the user
    // 6 Url of the user avatar
    // 7 User name
    // 8 "by" text
    // 9 date string
    // 10 "Details" text
    // Edit link is missing!!!
    var htmlstring = "";
    htmlstring += "<div style=\"width:415px; float:left; font-family:Arial, Helvetica, sans-serif; color:#999999;\">";
    htmlstring += "    <span style=\"width:415px; float:left; font-size:18px; color:#99CC33; margin-bottom:5px;\"><a style=\"font-size:18px;\" href=\"{0}\">{1}</a></span>";
    htmlstring += "    <div style=\"width:230px; float:left; margin-right:5px;\">";
    htmlstring += "        <a href=\"{0}\" title=\"{1}\" style=\"float:left; width:230px; height:152px; background-image:url('{2}'); background-repeat:no-repeat; background-position:center center; overflow:hidden;\"></a>";
    htmlstring += "        <div style=\"font-size:12px; margin-top:5px; float:left;\">";
    htmlstring += "            <img src=\"/App_Themes/CWDefault/Grafix/comments_bubble_kl.png\" alt=\"\" style=\"margin-right:10px; border:0px;\" /> <a href=\"{0}#comments\">{3}</a>";
    htmlstring += "        </div>";
    htmlstring += "    </div>";
    htmlstring += "    <div style=\"width:180px; float:left; min-height:92px; font-size:11px; margin:0px;\">{4}</div>";
    htmlstring += "    <div style=\"width:180px; height:50px; float:left; margin-top:10px;\">";
    htmlstring += "        <div style=\"width:50px; height:50px; float: left;\">";
    htmlstring += "            <a href=\"{5}\"><img style=\"border:0px;\" src=\"{6}\" alt=\"{7}\" title=\"{7}\" /></a>";
    htmlstring += "        </div>";
    htmlstring += "        <div style=\"width:125px; height:19px; float:left; padding-left:5px; margin-top:18px;\">";
    htmlstring += "            <span style=\"font-size:11px;\">{8} </span><a style=\"font-size:14px; border:0px;\" href=\"{5}\">{7}</a>";
    htmlstring += "            <br />";
    htmlstring += "            <span style=\"font-size:11px;\">{9}</span>";
    htmlstring += "        </div>";
    htmlstring += "    </div>";
    htmlstring += "    <div style=\"width:400px; float:left; padding-left:10px; margin-top:5px; font-size:11px; text-align:right;\"><a style=\"font-size:16px;\" href=\"{0}\">{10}</a></div>";
    htmlstring += "</div>";
    return htmlstring;
    
    // Old one...
    htmlstring += "<div style=\"width:415px; float:left; font-family:Arial, Helvetica, sans-serif; color:#999999;\">";
    htmlstring += "    <span style='width:415px; float:left; font-size:18px; color:#99CC33; margin-bottom:5px;'>";
    htmlstring += "        <a style='font-size:18px;' href='{0}'>{1}</a></span>"; // ID, Caption
    htmlstring += "    <div style='width:230px; float:left; margin-right:5px;'>";
    htmlstring += "        <a href='/GalleryDetails.aspx?PictureID={0}' style=\"width:230px; height:152px; background-image:url('{2}'); background-repeat:no-repeat; background-position:center center;\"></a>";
    htmlstring += "        <div style='font-size:12px; margin-top:5px;'><a href='/GalleryDetails.aspx?PictureID={0}#comments'><img src='/App_Themes/CWDefault/Grafix/comments_bubble_kl.png' alt='Kommentare' style='margin-right:10px; border: 0px;' /></a>";
    htmlstring += "        {8}</div>";
    htmlstring += "    </div>"; // URL
    htmlstring += "    <div style='width: 180px; float: left; height: 90px; font-size: 11px;'>{3}</div>"; // Description
    htmlstring += "    <div style='width: 180px; height: 50px; float: left; margin-top: 12px;'>";
    htmlstring += "        <div style='width: 50px; height: 50px; float: left;'>";
    htmlstring += "            <a href='/UserDetails.aspx?UserID={5}'><img style='border: 0px;' src='{4}' alt='User' /></a>"; // UserAvatar
    htmlstring += "        </div>";
    htmlstring += "        <div style='width: 125px; height: 19px; float: left; padding-left: 5px; margin-top: 14px;'>";
    htmlstring += "            <span style='font-size: 11px;'>by</span> <a style='font-size: 14px; border: 0px;' href='/UserDetails.aspx?UserID={5}'>{6}</a>"; // UserID, Username
    htmlstring += "        <br />";
    htmlstring += "            <span style='font-size: 11px;'>taken {7}</span>"; // TimeTaken
    htmlstring += "        </div>";
    htmlstring += "    </div>";
    htmlstring += "    <div style='width: 400px; float:left;padding-left:10px; margin-top: 5px; font-size: 11px; text-align:right;'><a style='font-size: 16px;' href='/GalleryDetails.aspx?PictureID={0}'>Details</a></div>";
    htmlstring += "</div>";
    //return htmlstring;
}

function CreatePOIPopup() {
    // 0 Link to POI
    // 1 Name of the POI
    // 2 Url of the picture of the POI
    // 3 Comment string
    // 4 Description text
    // 5 Link to the user
    // 6 Url of the user avatar
    // 7 User name
    // 8 "by" text
    // 9 date string
    // 10 "Details" text
    // 11 POIType IconUrl
    // 12 POIType Name
    // Edit link is missing!!!
    var htmlstring = "";
    htmlstring += "<div style=\"width:415px; float:left; font-family:Arial, Helvetica, sans-serif; color:#999999;\">";
    htmlstring += "    <div style=\"float:left; width:33px; height:33px;\"><img src=\"{11}\" alt=\"{12}\" title=\"{12}\"></div>";
    htmlstring += "    <div style=\"float:left; width:360px; height:33px; padding:10px 0px 0px 5px;\"><span style=\"font-size:18px; color:#99CC33;\"><a style=\"font-size:18px;\" href=\"{0}\">{1}</a></span></div>";
    htmlstring += "    <div style=\"width:230px; float:left; margin-right:5px;\">";
    htmlstring += "        <a href=\"{0}\" title=\"{1}\" style=\"float:left; width:230px; height:152px; background-image:url('{2}'); background-repeat:no-repeat; background-position:center center; overflow:hidden;\"></a>";
    htmlstring += "        <div style=\"font-size:12px; margin-top:5px; float:left;\">";
    htmlstring += "            <img src=\"/App_Themes/CWDefault/Grafix/comments_bubble_kl.png\" alt=\"\" style=\"margin-right:10px; border:0px;\" /> <a href=\"{0}#comments\">{3}</a>";
    htmlstring += "        </div>";
    htmlstring += "    </div>";
    htmlstring += "    <div style=\"width:180px; float:left; min-height:92px; font-size:11px; margin:0px;\">{4}</div>";
    htmlstring += "    <div style=\"width:180px; height:50px; float:left; margin-top:10px;\">";
    htmlstring += "        <div style=\"width:50px; height:50px; float: left;\">";
    htmlstring += "            <a href=\"{5}\"><img style=\"border:0px;\" src=\"{6}\" alt=\"{7}\" title=\"{7}\" /></a>";
    htmlstring += "        </div>";
    htmlstring += "        <div style=\"width:125px; height:19px; float:left; padding-left:5px; margin-top:18px;\">";
    htmlstring += "            <span style=\"font-size:11px;\">{8} </span><a style=\"font-size:14px; border:0px;\" href=\"{5}\">{7}</a>";
    htmlstring += "            <br />";
    htmlstring += "            <span style=\"font-size:11px;\">{9}</span>";
    htmlstring += "        </div>";
    htmlstring += "    </div>";
    htmlstring += "    <div style=\"width:400px; float:left; padding-left:10px; margin-top:5px; font-size:11px; text-align:right;\"><a style=\"font-size:16px;\" href=\"{0}\">{10}</a></div>";
    htmlstring += "</div>";
    return htmlstring;
    
    // Old one...
    htmlstring += "<div style='width: 415px; float: left; font-family: Arial, Helvetica, sans-serif; color: #999999;'>";
    htmlstring += "     <div style='width:415px; margin-bottom:0px;'><div style='width: 33px; height: 33px; margin-top: 1px; margin-bottom: 1px; margin-right: 5px; float: left;'>";
    htmlstring += "        <img src='{0}' alt='POI Icon' /></div>"; // IconURL
    htmlstring += "    <div style='float:left; font-size:18px; color:#99cc33; margin-bottom:6px; margin-top: 9px;'>";
    htmlstring += "        <a style='font-size:18px;' href='/POIDetails.aspx?POIID={1}'>{2}</a></div>"; //POIID, POIName
    // new edit button
    htmlstring += "<div style='float:none; height:33px; padding-top:8px;'><a style=\"display:{9}; padding-top:4px;\" href=\"/PoiEdit.aspx?PoiID={1}\"><img style=\"margin-left:10px;\" src=\"/App_Themes/CWDefault/Grafix/edit.gif\" alt=\"POI Editieren\" /></a></div></div>"; // {9} = none oder block
    htmlstring += "    <div style='width: 230px; float: left; margin-right: 5px;'>";
    htmlstring += "        <a href='/POIDetails.aspx?POIID={1}'><img src='/pictures/{3}' alt='Picture' /></a></div>"; // POIPicture
    htmlstring += "    <div style='width: 180px; float: left; font-size: 11px;'>{4}</div>"; // Description height: 90px; 
    htmlstring += "    <div style='width: 180px; height: 50px; float: left; margin-top: 12px;'>";
    htmlstring += "        <div style='width: 50px; height: 50px; float: left;'>";
    htmlstring += "            <a href='/UserDetails.aspx?UserID={6}'><img src='{5}' alt='User' style='border:0px;' /></a></div>"; // UserAvatar
    htmlstring += "        <div style='width: 125px; height: 19px; float: left; padding-left: 5px; margin-top: 14px;'>";
    htmlstring += "            <span style='font-size: 11px;'>by</span> <a style='font-size: 16px;' href='/UserDetails.aspx?UserID={6}'>{7}</a>"; //UserID, UserName
    //htmlstring += "        </div>";
    htmlstring += "         <br />";
    //htmlstring += "         <div style='width: 125px; height: 17px; float: left; padding-left: 5px;'>";
    htmlstring += "            <span style='font-size: 11px;'>updated on {8}</span></div>"; // LastUpdate
    htmlstring += "    </div>";
    htmlstring += "    <div style='width: 400px; float:left;padding-left:10px; margin-top: 5px; font-size: 11px; text-align:right;'><a style='font-size: 16px;' href='/POIDetails.aspx?POIID={1}'>Details</a></div>";
    htmlstring += "</div>";
    
    
    return htmlstring;
}
function CreatePOIPopupGroup()
{
    var htmlstring = "";
    htmlstring += "<div style='width: 415px; float: left; font-family: Arial, Helvetica, sans-serif; color: #999999;'>";
    htmlstring += "     <div style='width:415px; margin-bottom:0px;'><div style='width: 33px; height: 33px; margin-top: 1px; margin-bottom: 1px; margin-right: 5px; float: left;'>";
    htmlstring += "        <img src='{0}' alt='POI Icon' /></div>"; // IconURL
    htmlstring += "    <div style='float:left; font-size:18px; color:#99cc33; margin-bottom:6px; margin-top: 9px;'>";
    htmlstring += "        <a style='font-size:18px;' href='/POIDetails.aspx?POIID={1}'>{2}</a></div>"; //POIID, POIName
    // new edit button
    htmlstring += "<div style='float:none; height:33px; padding-top:8px;'><a style=\"display:{9}; padding-top:4px;\" href=\"/PoiEdit.aspx?PoiID={1}\"><img style=\"margin-left:10px;\" src=\"/App_Themes/CWDefault/Grafix/edit.gif\" alt=\"POI Editieren\" /></a></div></div>"; // {9} = none oder block
    htmlstring += "    <div style='width: 230px; float: left; margin-right: 5px;'>";
    htmlstring += "        <a href='/POIDetails.aspx?POIID={1}'><img src='/pictures/{3}' alt='Picture' style='border:0px;' /></a></div>"; // POIPicture
    htmlstring += "    <div style='width: 180px; float: left; font-size: 11px;'>{4}</div>"; // Description height: 90px; 
    //htmlstring += "    <div style='margin-top:10px; margin-bottom:10px;'>{9}</div>"; // {9} = ganzer!!! POI Edit Link
    htmlstring += "    <div style='width: 180px; height: 50px; float: left; margin-top: 12px;'>";
    htmlstring += "        <div style='width: 50px; height: 50px; float: left;'>";
    htmlstring += "            <a href='/GroupDetails.aspx?GroupID={6}'><img src='{5}' alt='User' style='border:0px;' /></a></div>"; // UserAvatar
    htmlstring += "        <div style='width: 125px; height: 19px; float: left; padding-left: 5px; margin-top: 14px;'>";
    htmlstring += "            <span style='font-size: 11px;'>by</span> <a style='font-size: 16px;' href='/GroupDetails.aspx?GroupID={6}'>{7}</a>"; //UserID, UserName
    //htmlstring += "        </div>";
    htmlstring += "         <br />";
    //htmlstring += "         <div style='width: 125px; height: 17px; float: left; padding-left: 5px;'>";
    htmlstring += "            <span style='font-size: 11px;'>updated on {8}</span></div>"; // LastUpdate
    htmlstring += "    </div>";
    htmlstring += "    <div style='width: 400px; float:left;padding-left:10px; margin-top: 5px; font-size: 11px; text-align:right;'><a style='font-size: 16px;' href='/POIDetails.aspx?POIID={1}'>Details</a></div>";
    htmlstring += "</div>";   
    
    return htmlstring;
}
// 07.08.08 new Popups added
function CreateStartEndNodePopup() {
    // 0 Start-End Head text
    // 1 Name of the track
    // 2 "Information" text
    // 3 Information string
    var htmlstring = "";
    htmlstring += "<div style=\"width:100%; font-size:12px;\">{0}<br />"; // Endpunkt / Startpunkt / Start und Endpunkt der Tour
    htmlstring += "     <span style=\"color:#99CC33; font-size:20px; top-margin:10px; top-padding:0px;\">{1}</span>";
    htmlstring += "</div>";
    htmlstring += "<div style=\"top-margin:20px; font-size:12px;\">";
    htmlstring += "     <br /><strong>{2}:</strong>";
    htmlstring += "     {3}";
    htmlstring += "</div>";
    return htmlstring;
}
function CreateCommentPopup()
{
    var htmlstring = "";
    htmlstring += "<div style=\"width:415px; font-size:12px; position:relative;\">";
    htmlstring += "  <div style=\"width:245px; margin-right:10px;\">";
    htmlstring += "    <div style=\"color:#99CC33; font-size:18px; margin-bottom:5px;\">{0}</div><div style=\"margin-bottom:10px;\">{1}</div><div>{5}</div>";
    htmlstring += "  </div>";
    htmlstring += "  <div style=\"position:absolute; right:5px; bottom:0px; width:160px;\"><div style=\"position:relative; min-width:170px;\">";
    htmlstring += "    <div><a href=\"{3}\" style=\"margin-right:5px;\"><img src=\"{2}\" alt=\"{4}\" title=\"{4}\" border=\"0\" /></a><div>";
    htmlstring += "    <div style=\"position:absolute; margin-left:50px; padding-left:5px; bottom:5px; width:170px; margin-top:20px;\"><a href=\"{3}\" style=\"font-size:14px;\">{4}</a></div>";
    htmlstring += "  </div></div>";
    htmlstring += "</div>";
    //htmlstring += "<div style=\"width:415px; float:left; font-family:Arial, Helvetica, sans-serif; color:#999999;\">";
    //htmlstring += "     <span style=\"width:415px; float:left; font-size:18px; color:#99CC33; margin-bottom:5px;\">Geokodierter Kommentar</span>";
    //htmlstring += "     <div style=\"width:230px; height:50px; float:left; margin-right:5px;\">{0}</div>"; // Comment
    //htmlstring += "     <div style='width: 180px; height: 50px; float: left; margin-top: 12px;'>";
    //htmlstring += "         <div style='width: 50px; height: 50px; float: left;'>";
    //htmlstring += "             <img src='{1}' alt='User' />"; // UserAvatar
    //htmlstring += "         </div>";
    //htmlstring += "         <div style='width: 125px; height: 19px; float: left; padding-left: 5px; margin-top: 14px;'>";
    //htmlstring += "             <span style='font-size: 11px;'>by</span> <a style='font-size: 16px;' href='/UserDetails.aspx?UserID={2}'>{3}</a>"; // UserID, Username
    //htmlstring += "             <br /><span style='font-size: 11px;'>created {4}</span>"; // TimeCreated
    //htmlstring += "        </div>";
    //htmlstring += "     </div>";
    //htmlstring += "</div>";
    return htmlstring;
}

function CreateCommentPopup2(comment, userAvartar, ownerID, ownerName, timeCreated)
{
    comment = unescape(comment);
    var htmlstring = "";
    htmlstring += "<div style=\"width: 415px; float: left; font-family: Arial, Helvetica, sans-serif; color:#999999;\">";
    htmlstring += "     <span style=\"width:415px; float:left; font-size:18px; color:#99CC33; margin-bottom:5px;\">Geokodierter Kommentar</span>";
    htmlstring += "     <div style=\"width:230px; height:50px; float:left; margin-right:5px;\">"+comment+"</div>"; // Comment
    htmlstring += "     <div style='width: 180px; height: 50px; float: left; margin-top: 12px;'>";
    htmlstring += "         <div style='width: 50px; height: 50px; float: left;'>";
    htmlstring += "             <img src='"+userAvartar+"' alt='User' />"; // UserAvatar
    htmlstring += "         </div>";
    htmlstring += "         <div style='width: 125px; height: 19px; float: left; padding-left: 5px; margin-top: 14px;'>";
    htmlstring += "             <span style='font-size: 11px;'>by</span> <a style='font-size: 16px;' href='/UserDetails.aspx?UserID="+ownerID+"'>"+ownerName+"</a>"; // UserID, Username
    htmlstring += "             <br /><span style='font-size: 11px;'>created "+timeCreated+"</span>"; // TimeCreated
    htmlstring += "        </div>";
    htmlstring += "     </div>";
    htmlstring += "</div>";
    return htmlstring;
}

// OLD
function CreateStartEndNodePopup2()
{
    var htmlstring = "";
    htmlstring += "<div style='width: 415px; float: left; font-family: Arial, Helvetica, sans-serif;";
    htmlstring += "    color: #999999;'>";
    htmlstring += "    {0}<br />";
    htmlstring += "    <span style='width: 415px; float: left; font-size: 18px; color: #99cc33; margin-bottom: 5px;'>{1}</span>"; // ID, Caption
    htmlstring += "    <div style='width: 230px; float: left; margin-right: 5px;'>";
    htmlstring += "        <img src='{2}' alt='Picture' /></div>"; // URL
    htmlstring += "    <div style='width:180px; float:left; height:90px; font-size:11px;'><strong>Informationen:</strong>"; // Description
    htmlstring += "    <i>Start</i><br />Zeitpunkt: {3}<br />Region: {4}<br />Seehöhe: {5}<br />";
    htmlstring += "    </div>";
    htmlstring += "</div>";
    return htmlstring;
}
// Mountain Names ###########################################################################################################
function ShowMountainNames()
{
    var centre = map.GetCenter(); 
    LeaveYourTracks.com.WSAjax.AJAXSvc.GetMountainNames(centre.Latitude, centre.Longitude, ShowMountainNames_success, ShowMountainNames_Failed); 
    MessageBox(true, "Please wait while retrieving mountain data...", 3000); 
}

function ShowMountainNames_Failed(e) 
{ 
    MessageBox(true, "Error while connecting to the remote web service. Please try again later.", 5000); 
} 

function ShowMountainNames_success(e) 
{ 
    var MountainNames; 
    var entriesFound = 0; 
     
    for(i = 0; i < e.length; i++)
    {
        var Mountain = e[i];
        AddMountainPushpin(Mountain); 
    } 
    
    if (e.length > 0) 
    { 
        var message = String.format("{0} mountains found.", e.length); 
        MessageBox(true, message, 5000);
    } 
    else 
    { 
        MessageBox(true, "No mountains found...", 5000); 
    } 
}

function AddMountainPushpin(Mountain) 
{ 
    var icon = new VECustomIconSpecification();
    icon.Image = Mountain.PinURL;
    icon.TextContent=" ";
    var point = new VELatLong(Mountain.Latitude, Mountain.Longitude); 
    var shp = new VEShape(VEShapeType.Pushpin, point); 
    shp.SetAltitude(50.0, VEAltitudeMode.RelativeToGround);
    shp.SetTitle(""); 
    shp.SetDescription(""); 
    shp.SetCustomIcon(icon); 
    layer = map.GetShapeLayerByIndex(9);
    layer.AddShape(shp); 
}


// Wikipedia Data ###########################################################################################################

function ShowWikiEntries()
{
    var NWLatLong = null;
    var y = 0;
    while (NWLatLong == null)
    {
        pixel = new VEPixel(0, y);
        try { NWLatLong = new VELatLong(map.PixelToLatLong(pixel).Latitude, map.PixelToLatLong(pixel).Longitude); }
        catch(error) { NWLatLong = null; }
        y = y + 10;
    }
    var mapBox = Sys.UI.DomElement.getBounds($get("myMap"));
    pixel = new VEPixel(mapBox.width, mapBox.height);
    var SELatLong = new VELatLong(map.PixelToLatLong(pixel).Latitude, map.PixelToLatLong(pixel).Longitude);
    MessageBox(true, "Please wait while retrieving wikipedia data...", 3000);
    LeaveYourTracks.com.WSAjax.AJAXSvc.GetWikiByBoundingBox(NWLatLong.Latitude, SELatLong.Latitude, SELatLong.Longitude, NWLatLong.Longitude, "de", GetWiki_success, GetWiki_Failed); 
}

function GetWiki_success(e) 
{ 
    var wikiData = Sys.Serialization.JavaScriptSerializer.deserialize(e); 
    var entriesFound = 0; 
     
    if (wikiData.geonames && wikiData.geonames.length > 0) 
    { 
        Array.forEach(wikiData.geonames, AddWikiPushpin); 
        entriesFound = wikiData.geonames.length; 
    } 
     
    if (entriesFound > 0) 
    { 
        var message = String.format("{0} wikipedia entries found.", entriesFound); 
        MessageBox(true, message, 2000);
    } 
    else 
    { 
        MessageBox(true, "No Wikipedia entries found. Please try again.", 5000); 
    } 
}

function AddWikiPushpin(entry) 
{ 
    var icon; 
    var htmlImage = "<br/><b>Summary: </b> {1}<br/>" + 
            "<br/><img src=\"{3}\" alt=\"Thumbnail\" /><br/><br/><b>Wikipedia-Link: </b><a href=\"http://{2}\" target=\"_new\" >{0}</a>"; 
    var htmlNoImage = "<br/><b>Summary: </b> {1}<br/>" + 
            "<br/><br/><b>Wikipedia-Link: </b><a href=\"http://{2}\" target=\"_new\" >{0}</a>"; 
    var details = "";
    if (entry.thumbnailImg == undefined)
        details = String.format(htmlNoImage, 
            entry.title, entry.summary, escape(entry.wikipediaUrl)); 
    else
        details = String.format(htmlImage, 
            entry.title, entry.summary, escape(entry.wikipediaUrl), 
            escape(entry.thumbnailImg));         
     
    icon = String.format("/images/Wikipedia_Icon_kl.png", icon); 
    icon = GetCorrectIcon(icon, 24, 24, -5, 4); 
    AddPushpin(entry.lat, entry.lng, entry.title, details, icon, 9); 
}

function GetWiki_Failed(e) 
{ 
    MessageBox(true, "Error while connecting to the remote web service. Please try again later.", 5000); 
} 

// Wetterinfos ###############################################################################################
function ShowWeatherInfo()
{
    var centre = map.GetCenter(); 
    LeaveYourTracks.com.WSAjax.AJAXSvc.GetWeatherByLocation(centre.Latitude, centre.Longitude, GetWeather_success, GetWeather_Failed); 
    MessageBox(true, "Please wait while retrieving weather data..."); 
}

function GetWeather_Failed(e) 
{ 
    MessageBox(true, "Error while connecting to the remote web service. Please try again later.", 5000); 
} 

function GetWeather_success(e) 
{ 
    var weatherData = Sys.Serialization.JavaScriptSerializer.deserialize(e); 
    var stationsFound = 0; 
     
    if (weatherData.weatherObservations && weatherData.weatherObservations.length > 0) 
    { 
        Array.forEach(weatherData.weatherObservations, AddWeatherPushpin); 
        stationsFound = weatherData.weatherObservations.length; 
    } 
     
    if (stationsFound > 0) 
    { 
        var message = String.format("Data was retrieved for {0} weather stations.", stationsFound); 
        MessageBox(true, message, 2000);     
    } 
    else 
    { 
        MessageBox(true, "No weather data was found. Please try again.", 5000); 
    } 
}

function AddWeatherPushpin(observation) 
{ 
    var icon; 
    // The observation time is parsed in order to determine 
    // whether the observation was taken during the day or 
    // the night and choose an appropriate icon.
    // The format of the returned date is yyyy-MM-dd hh:mm:ss 
    var d = observation.datetime; 
    var date = new Date(d.substr(0,4), d.substr(5,2), d.substr(8,2), 
                        d.substr(11,2), d.substr(14,2), d.substr(17,2)); 
     
    var isDay = (date.getHours() > 6 && date.getHours() < 20); 
       
    switch (observation.clouds) 
    { 
        case 'clear sky': 
            if (isDay) icon = '32'; else icon = '31'; 
            break; 
        case 'few clouds': 
            if (isDay) icon = '30'; else icon = '29'; 
            break; 
        case 'scattered clouds': 
            if (isDay) icon = '28'; else icon = '27'; 
            break; 
        case 'broken clouds': 
            icon = '26'; 
            break; 
        case 'overcast': 
        case 'vertical visibility': 
            icon = '23'; 
            break; 
        default: 
            icon = 'NA'; 
    } 
    // The wind speed is converted from knots to m/s 
    var windSpeedMs = Math.round(observation.windSpeed * 0.5144444 * 100)/100; 
   
    var html = "<em>{0}</em><br/><b>Clouds:</b> {1}<br/><b>Weather condition:</b> {2}<br/>" + 
            "<b>Temperature:</b> {3} °C<br/><b>Dew Point:</b> {4} °C<br/>" + 
            "<b>Wind:</b> {5}kt ({6} m/s) from {7}°<br/><b>Altimeter:</b> {8} hPa"; 
    var details = String.format(html, 
            observation.datetime, observation.clouds, observation.weatherCondition, 
            observation.temperature, observation.dewPoint, observation.windSpeed, 
            windSpeedMs, observation.windDirection, observation.hectoPascAltimeter); 
     
    icon = String.format("/images/{0}.png", icon); 
    icon = GetCorrectIcon(icon, 48, 48, -10, -12); 
    AddPushpin(observation.lat, observation.lng, observation.stationName, details, icon, 10); 
}

function GetCorrectIcon(iconPath, width, height, offsetLeft, offsetTop) 
{ 
    /// <summary>Fixes the IE6 png transparency issue for the passed icon</summary> 
    var icon = new VECustomIconSpecification();
    
    var html; 
    if (!offsetLeft) offsetLeft = 0; 
    if (!offsetTop) offsetTop = 0;
    if (Sys.Browser.agent == Sys.Browser.InternetExplorer && 
        Sys.Browser.version == 6) 
        {
        html = "<img src='/images/blank.gif' " + 
        "style='position:absolute;left:{0}px;top:{1}px;width:{2}px;height:{3}px;" + 
        "filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\"{4}\", " + 
        "sizingMethod=\"image\" );' />"; 
        return String.format(html, offsetLeft, offsetTop, width, height, iconPath); 
        }
    else 
    {
        icon.Image = iconPath;
        icon.ImageOffset = new VEPixel(offsetLeft, offsetTop);
        return icon; 
    } 
}     

function AddPushpin(lat, lon, title, description, icon, lr) 
{ 
    var point = new VELatLong(lat, lon); 
    var shp = new VEShape(VEShapeType.Pushpin, point); 
    shp.SetTitle(title); 
    shp.SetDescription(description); 
    if (icon) 
    { 
        shp.SetCustomIcon(icon); 
    } 
    layer = map.GetShapeLayerByIndex(lr);
    layer.AddShape(shp); 
}

// Wetterinfos ###############################################################################################
