
function fix( h,w,u ) {
 x = window.open(u,'fixwin', 'top=0,left=0,width=' + w
 + ',height=' + h + ',toolbar=no,status=no,scrollbars=no'
 + ',resizable=no,menubar=no,location=no,personalbar=no');
 x.resizeTo(w,h); x.outerWidth=w; x.outerHeight=h;
 return(x);
}

function fixs( h,w,u ) {
 x = window.open(u,'fixwin', 'top=0,left=0,width=' + w
 + ',height=' + h + ',toolbar=no,status=no,scrollbars=yes'
 + ',resizable=yes,menubar=no,location=no,personalbar=no');
 x.resizeTo(w,h); x.outerWidth=w; x.outerHeight=h;
 return(x);
}

function gis( u ) {
 cmd = '%3Bstart=HS_index?urlID='+u;
 fix(700,800,'http://gis.swissinfo.org/cgi-bin/hsrun.exe/Distributed/SRI3/MapXtreme.htx'+cmd);
}

function geoSwissInfo(x,y,z,m) {
 cmd = 'Resolution=small&KOORDX='+x+'&KOORDY='+y+'&ZOOM='+z;
 if( m==1 ) cmd = cmd+'&markx='+x+'&marky='+y;
 fix(650,810,'http://gis.swissinfo.org/swissinfo-geo/neapoljs_GERMAN.htm?'+cmd);
 }

function cvtXYZ(x,y,z) {
var X,Y,d,r;
 Y = ( x - 600000 ) / 1000000;
 X = ( y - 200000 ) / 1000000;
 d = ( 2.6779094
 +   ( 4.728982 * Y )
 +   ( 0.791484 * Y * X )
 +   ( 0.1306   * Y * X * X )
 -   ( 0.0436   * Y * Y * Y )
 ) * 100 / 36;
 r = (16.9023892
 +   ( 3.238272 * X )
 -   ( 0.270978 * Y * Y )
 -   ( 0.002528 * X * X )
 -   ( 0.0447   * Y * Y * X )
 -   ( 0.0140   * X * X * X )
 ) * 100 / 36;
 x = Math.round(d*600000)/10000;
 y = Math.round(r*600000)/10000;
 z = Math.round(z*1000);
 return( new Array ( x,y,z ) );
}

function geoMap24(x,y,z) {
var c,x
 c = cvtXYZ(x,y,z);
 cmd = 'lid=ec03de43&maptype=JAVA&wx0='+c[0]+'&wy0='+c[1]+'&width='+c[2]+'?=de';
 x=fixs(700,950,'http://link2.map24.com/?'+cmd);
}

function geoMap24R(x,y,z) {
 var c,d;
 c = cvtXYZ(x,y,z);
 win = fix(290,225,'about:blank');
 d = win.document;
 d.close();
 d.open("text/html","replace");
 d.writeln('<html><body>')
 d.writeln('<form action="http://link2.map24.com/" method=get target="_blank" name=routeo>');
 d.writeln('<input type=hidden name=lang value=de>');
 d.writeln('<table width=200 height=210 cellspacing=0 cellpadding=6 border=0 background="http://www.map24.com/images/route_to_own_blb.gif">');
 d.writeln('<tr><td valign=bottom>');
 d.writeln('<b>Von:</b><br>');
 d.write('<input type=text name=sstreet size=12 maxlength=50 value="Strasse" onFocus="javascript');
 d.write(":if (document.routeo.sstreet.value == 'Strasse') document.routeo.sstreet.value = '';");
 d.writeln('"><br>');
 d.writeln('<input type=hidden name=scountry value=de>');
 d.write('<input type=text name=szip size=1 value="PLZ" onFocus="javascript:');
 d.write("if (document.routeo.szip.value == 'PLZ') document.routeo.szip.value = '';");
 d.write('"><input type=text name=scity size=8 maxlength=50 value="Stadt" onFocus="javascript:');
 d.write("if (document.routeo.scity.value == 'Stadt') document.routeo.scity.value = '';");
 d.writeln('"><br><br><b>Nach Nunningen</b><br>');
 d.writeln('<image src="http://img.map24.com/space.gif" width=1 height=5><br>');
 d.writeln('<select name=rtype size=1>');
 d.writeln('<option value="fast" selected>Schnellste Strecke</option>');
 d.writeln('<option value="short">Kürzeste Strecke</option>');
 d.writeln('</select><br>');
 d.write('<input type=image src="http://img.map24.com/route_button.gif" border=0');
 d.writeln(' align=right onClick="Javascript:close();">');
 d.writeln('<input type=hidden name=scountry value="ch">');
 d.writeln('<input type=hidden name=sdescription value="Start">');
 d.writeln('<input type=hidden name=dx value='+c[0]+'>');
 d.writeln('<input type=hidden name=dy value='+c[1]+'>');
 d.writeln('<input type=hidden name=ddescription value="Ziel">');
 d.writeln('<input type=hidden name=lid value="ec03de43">');
 d.writeln('<input type=hidden name=maptype value="CGI">');
 d.writeln('<input type=hidden name=width value='+c[2]+'>');
 d.writeln('</font></td></tr></table></form></body></html>');
 d.close();
}

function geo(x,y,z,m) {
var win,d;
  win = fix(250,250,'about:blank');
  d = win.document;
  d.close();
  d.open("text/html","replace");
//  d.writeln('<html><body><script type="text/javascript" language="JavaScript" src="http://www.ebp-gasser.ch/images/mkwin.js"></script>');
  d.writeln('<html><body><script type="text/javascript" language="JavaScript" src="fileadmin/tx_ebpgemadr/geo.js"></script>');
  d.writeln('<p align=center style="font-family:arial,helvetica"><b>SwissInfo</b><br />');
  d.write('<a href="Javascript:geoSwissInfo('+x+','+y+','+z+','+m+');">');
  d.writeln('Karte</a><br />&nbsp;<br /><b>Map 24</b><br />');
  d.write('<a href="Javascript:geoMap24('+x+','+y+','+z+');">');
  d.writeln('Karte</a><br />');
  d.write('<a href="Javascript:geoMap24R('+x+','+y+','+z+');">');
  d.writeln('Routen-Planung</a><br />&nbsp;<br />');
  d.writeln('<a href="Javascript:close();"><small>(Fenster Schliessen)</small></a>');
  d.writeln('</body></html>');
  d.close();
}

