﻿// JScript File

// This Script is Copyright by Offensiv-Medien
// You are only permitted to use this Script if you are Customer of Offensiv-Medien
// Information: office@offensiv-medien.de

var map;        // Map Guid
var apicode;    // Special CustomerID
var sb;         // ShowBalloon
var so;         // Show Surrounding Placemarks
var sr;         // Show Route Line
var bz;         // Block Zoom to min. startlevel
var wi;         // Framewidth
var hi;         // Frameheight    
var agent;      // Cutomer ID
var filetype;   // Renderengine
var viewfilter; // Placemarkfilter
var showoverlay;// Show GroundOverlay and GoogleEarth Download Link
var _3d;         // Show 3D Button

window.onload = initOMMap;

function initOMMap()
{
    var url = "http://maps.offensiv-medien.de/Digital_WebMap.aspx?";
    
    if(typeof(map) == "undefined" && typeof(apicode)=="undefined")
        alert("Es wurde keine Karte festgelegt!");
    url += "map=" + map;

    if(typeof(apicode) != "undefined")
        url += "&apicode=" + apicode;
    if(typeof(sb)== "undefined")
        sb = true;
    url += "&sb=" + sb;
    
    if(typeof(so)=="undefined")
        so = false;
    url += "&so=" + so;
    
    if(typeof(sr)== "undefined")
        sr = true;
    url += "&sr=" + sr;
    
    if(typeof(bz)== "undefined")
        bz = false;
    url += "&bz=" + bz;
    
    if(typeof(wi)== "undefined")
        wi = 800;
    url += "&wi=" + wi;
    
    if(typeof(hi)== "undefined")
        hi = 600;
    url += "&hi=" + hi;
    
    if(typeof(agent) != "undefined")
        url += "&agent=" + agent;
        
    if(typeof(viewfilter) != "undefined")    
        url += "&viewfilter=" + viewfilter;
        
    if(typeof(filetype) == "undefined")
        filetype = ".ggl";
    url += "&filetype=" + filetype;
    
    if(typeof(showoverlay) == "undefined")
        showoverlay = false;
    url += "&showoverlay=" + showoverlay;
    
    if(typeof(_3d) == "undefined")
        _3d = false;
    url += "&3d=" + _3d;

    // Random
    url += "&rnd=" + zufall();
    
    var container = document.getElementById("OMMap");
    var ifr = document.createElement("iframe");
    ifr.id="MainMapFrame";
        ifr.src = url;
    ifr.style.margin="0px";
    ifr.style.border= "0px none #ffffff";
    ifr.allowtransparency = true;
    ifr.frameBorder = "0";
    ifr.hspace="0";
    ifr.vspace="0";
    ifr.marginWidth="0";
    ifr.marginHeight = "0";
    ifr.name="GoogleMapOffensiv-Medien";
    ifr.style.width = (wi+45) + "px";
    ifr.style.height = (hi+55) + "px";
    
    container.appendChild(ifr);

}


function zufall()
{
    var a = 0;
    a = Math.random();
    a *= 4992;
    a = Math.ceil(a);
    return a;
}
