
if (!stepmapexportgeladen)
{

function getPageScroll()
{
    var yScroll;

    if (self.pageYOffset) {
      yScroll = self.pageYOffset;
    } else if (document.documentElement && document.documentElement.scrollTop){  // Explorer 6 Strict
      yScroll = document.documentElement.scrollTop;
    } else if (document.body) {// all other Explorers
      yScroll = document.body.scrollTop;
    }

    arrayPageScroll = new Array('',yScroll)
    return arrayPageScroll;
}

function getPageSize()
{
    var xScroll, yScroll;

    if (window.innerHeight && window.scrollMaxY) {
      xScroll = document.body.scrollWidth;
      yScroll = window.innerHeight + window.scrollMaxY;
    } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
      xScroll = document.body.scrollWidth;
      yScroll = document.body.scrollHeight;
    } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
      xScroll = document.body.offsetWidth;
      yScroll = document.body.offsetHeight;
    }

    var windowWidth, windowHeight;
    if (self.innerHeight) { // all except Explorer
      windowWidth = self.innerWidth;
      windowHeight = self.innerHeight;
    } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
      windowWidth = document.documentElement.clientWidth;
      windowHeight = document.documentElement.clientHeight;
    } else if (document.body) { // other Explorers
      windowWidth = document.body.clientWidth;
      windowHeight = document.body.clientHeight;
    }

    // for small pages with total height less then height of the viewport
    if(yScroll < windowHeight){
      pageHeight = windowHeight;
    } else {
      pageHeight = yScroll;
    }

    // for small pages with total width less then width of the viewport
    if(xScroll < windowWidth){
      pageWidth = windowWidth;
    } else {
      pageWidth = xScroll;
    }

    arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight);
    return arrayPageSize;
}

var stepmapexport_bild_arr = new Array();

function stepmapexport_zeigeBild(zufcode,url,bildnr,bildnrstr)
{
    var arrayPageSize = getPageSize();
    var arrayPageScroll = getPageScroll();

    var medialayerobj = document.getElementById('stepmapexport_medialayer');
    medialayerobj.style.width = (arrayPageSize[0] + 'px');
    medialayerobj.style.height = (arrayPageSize[1] + 'px');
    document.getElementById('mediaranddiv').style.marginTop = (arrayPageScroll[1] + 'px');

    var mediadivobj = document.getElementById('stepmapexport_mediadiv');	
	var html = "<img src='"+url+"' style='border:none;'>";	
	html += "<div style='padding:8px 0 0px;text-align:center;font-size:11px;font-family:Arial,Helvetica,Sans-Serif;color:#666666;'>"
	      + "<img src='http://www.stepmap.de/images/pfeil_grau_zurueck2.png' onmouseup=\"stepmapexport_zeigeBildNr('"+zufcode+"',"+(bildnr-1)+")\" style='float:left;cursor:pointer;width:70px;height:15px;'>"
		  + "<img src='http://www.stepmap.de/images/pfeil_grau_vor2.png' onmouseup=\"stepmapexport_zeigeBildNr('"+zufcode+"',"+(bildnr+1)+")\" style='float:right;cursor:pointer;width:70px;height:15px;'>"
		  + bildnrstr
		  + "</div>";	
    mediadivobj.innerHTML = html;	

    mediadivobj.style.display = 'block';
    medialayerobj.style.display = 'block';
}

function  stepmapexport_zeigeBildNr(zufcode,i)
{
    if ((stepmapexport_bild_arr[zufcode][i] != "") && (i >= 0) && (i < stepmapexport_bild_arr[zufcode].length))
    {
		stepmapexport_zeigeBild( zufcode, stepmapexport_bild_arr[zufcode][i], i, '<nobr>Bild '+(i+1)+' von '+stepmapexport_bild_arr[zufcode].length+'</nobr>');
    }
}

function cancelBubble(evt)
{
    var e = (evt) ? evt : window.event;
	e.cancelBubble = true;     
}

function stepmapexport_closeMediaLayer()
{
    document.getElementById('stepmapexport_medialayer').style.display = 'none';
    document.getElementById('stepmapexport_mediadiv').innerHTML = '';
    document.getElementById('stepmapexport_mediadiv').style.display = 'none';
    mediaansichtmedium = '';
}

function stepmapexport_zeigePunktInfo(i,px,py,zufcode,absusermapsdir)
{
    document.getElementById('stepmap_punkttitel_'+zufcode).innerHTML = punktData[zufcode][i]['punkttitel'];
    
    var obj = document.getElementById('stepmap_punktbeschreibung_'+zufcode);
    var s = punktData[zufcode][i]['punktbeschreibung'];
    if (s != '')
    {        
        obj.innerHTML = s;
        if (s.length > 250)
        { obj.style.height = '100px'; obj.style.overflow = 'scroll'; }
        else
        { obj.style.height = ''; obj.style.overflow = 'hidden'; }
        obj.style.display = 'block';
    }
    else
        obj.style.display = 'none';

    var obj = document.getElementById('stepmap_punktlink_'+zufcode);
    var s = punktData[zufcode][i]['punktlinkurl'];
    if (s != '')
    {        
        obj.innerHTML = '<a href="'+s+'" target="'+punktData[zufcode][i]['punktlinkfenster']+'">'+punktData[zufcode][i]['punktlinkhinweis']+'</a>';
        obj.style.display = 'block';
    }
    else
        obj.style.display = 'none';

    obj = document.getElementById('stepmap_punktbilder_'+zufcode);
    s = punktData[zufcode][i]['punktbilddateien'];    
	stepmapexport_bild_arr[zufcode] = new Array();
    if (s != '')
    {
        var res = s.split('\n');
        if ((res) && (res.length > 0) && (res[res.length-1] == '')) res.pop();
        var html = '';
        for (var c=0;c<res.length;c++)
        {
            var res2 = res[c].match(/(.*punkt_)(.*)(\..*)$/i);
            var urlgr = absusermapsdir+'/'+res[c];
            var urlkl = absusermapsdir+'/'+res2[1]+res2[2]+'_klein'+res2[3];
			stepmapexport_bild_arr[zufcode].push(urlgr);
            html += "<img src='"+urlkl+"' style='width:80px;height:80px;border:0;margin:0 6px 6px 0;cursor:pointer;' onclick=\"stepmapexport_zeigeBildNr('"+zufcode+"',"+c+")\">";
        }
        obj.innerHTML = html;
        if (c > 3) 
        { obj.style.height = '102px'; obj.style.overflow = 'scroll'; obj.style.marginBottom = '6px'; }
        else 
        { obj.style.height = ''; obj.style.overflow = ''; obj.style.marginBottom = ''; }
        obj.style.display = 'block';
    }
    else
        obj.style.display = 'none';
    obj = document.getElementById('stepmap_punktinfo_'+zufcode);
    obj.style.left = px+'px';
    obj.style.top  = py+'px';
	obj.style.display = 'block';
}

function stepmapexport_schliessePunktInfo(zufcode)
{
    document.getElementById('stepmap_punktinfo_'+zufcode).style.display = 'none';
}

document.write("<div id='stepmapexport_medialayer' onmouseup='stepmapexport_closeMediaLayer()' style='display:none;z-index:9995;position:absolute;left:0;top:0;width:100%;background:url(http://www.stepmap.de/images/transgrau.png);padding-top:20px;'><table style='width:100%;' cellpadding='0' cellspacing='0'><tr><td style='width:50%;'>&nbsp;</td><td><div id='mediaranddiv' onmouseup='cancelBubble(event)' style='padding:15px;border:4px solid #525252;background:#ffffff;'><div style='width:100%;text-align:right;'><img src='http://www.stepmap.de/images/schliessen2.png' onmouseup='stepmapexport_closeMediaLayer()' style='width:76px;heigth:18px;margin-bottom:2px;cursor:pointer;'></div><div id='stepmapexport_mediadiv'></div></div></td><td style='width:50%;'>&nbsp;</td></tr></table></div>");

var stepmapexportgeladen = true;
var punktData = new Object();

}
