﻿function PushpinVisible(shopId, status) {
    var shost = document.getElementById("MapApp");
    shost.content.InfoMap2D.PushpinVisible(shopId, status);
}
function PushpinsVisible(shopIds, status) {
    var shost = document.getElementById("MapApp");
    shost.content.InfoMap2D.PushpinsVisible(shopIds, status);
}
function AddPushpin(shopId, sLoc, message) {
    var shost = document.getElementById("MapApp");
    shost.content.InfoMap2D.AddPushpin(shopId, sLoc, message);
}
function AddPushpins(shopIds, messages) {
    var shost = document.getElementById("MapApp");
    shost.content.InfoMap2D.AddPushpins(shopIds, messages);
}
function AddPushpin(shopId, message) {
    var shost = document.getElementById("MapApp");
    shost.content.InfoMap2D.AddPushpin(shopId, message);
}

function FlyToLocation(sLoc) {
    var shost = document.getElementById("MapApp");
    shost.content.InfoMap2D.FlyToLocation(sLoc);
}

function FlyToLocationByShopId(shopId, message) {
    var shost = document.getElementById("MapApp");
    shost.content.InfoMap2D.FlyToLocationByShopId(shopId, message);
   
}

function onSilverlightError(sender, args) {
    var appSource = "";
    if (sender != null && sender != 0) {
        appSource = sender.getHost().Source;
    }

    var errorType = args.ErrorType;
    var iErrorCode = args.ErrorCode;

    if (errorType == "ImageError" || errorType == "MediaError") {
        return;
    }

    var errMsg = "Unhandled Error in Silverlight Application " + appSource + "\n";

    errMsg += "Code: " + iErrorCode + "    \n";
    errMsg += "Category: " + errorType + "       \n";
    errMsg += "Message: " + args.ErrorMessage + "     \n";

    if (errorType == "ParserError") {
        errMsg += "File: " + args.xamlFile + "     \n";
        errMsg += "Line: " + args.lineNumber + "     \n";
        errMsg += "Position: " + args.charPosition + "     \n";
    }
    else if (errorType == "RuntimeError") {
        if (args.lineNumber != 0) {
            errMsg += "Line: " + args.lineNumber + "     \n";
            errMsg += "Position: " + args.charPosition + "     \n";
        }
        errMsg += "MethodName: " + args.methodName + "     \n";
    }

    throw new Error(errMsg);
}
//function DrawBorderByCommune(communeId, trans_value, message, colorcode) {
//    var shost = document.getElementById("MapApp");
//    shost.content.InfoMap2D.DrawBorderByCommune(communeId, trans_value, message, colorcode);
//}
function DrawBorderByCommune(communeId, level, colorFactor, title, message, colorcode, opacity) {
    var shost = document.getElementById("MapApp");
    shost.content.InfoMap2D.DrawBorderByCommuneWithLayer(communeId, level, colorFactor, title, message, colorcode, opacity);
}
function CommuneBorderVisible(communeId, isVisible) {
    var shost = document.getElementById("MapApp");
    shost.content.InfoMap2D.CommuneBorderVisible(communeId, isVisible);
} 
function LocateRoad(roadID, translate, title, slevel, colorCode) {
    var shost = document.getElementById("MapApp");
    shost.content.InfoMap2D.LocateRoad(roadID, translate, title, slevel, colorCode);
}
function DisplayNote(location, title, desc, level, icon, transformed) {
    var shost = document.getElementById("MapApp");
    shost.content.InfoMap2D.DisplayNote(location, title, desc, level, icon, transformed);
}