home *** CD-ROM | disk | FTP | other *** search
/ Chip 2003 February / Chip_2003-02_cd1.bin / tema / tipy / navig-gps.mht / tms_scripts.php < prev    next >
Encoding:
Text File  |  2003-01-06  |  3.5 KB  |  117 lines

  1. // Copyright 2000 T-Mapy spol. s r. o. All rights reserved.
  2.  
  3. root_script = 'http://www.shocart.cz/tms/shocart';
  4. w_left = 50;
  5. w_top = 50;
  6. w_width = 710;
  7. w_height = 515;
  8. w_features = ',menubar';
  9. strange_opener = 0;
  10. map_window = null;
  11.  
  12. isN = false;
  13. isIE = false;
  14. version = 0;
  15. if (navigator.appName == "Netscape") {
  16.   isN = true;
  17.   if (navigator.appVersion.search("5.0") == -1)
  18.     version = 4;
  19.   else version = 5;
  20. }
  21. else isIE = true;
  22.  
  23. function Map() {
  24.   newwindow = window.open(root_script+'/index.php?client_type=shocart&client_lang=&strange_opener=0', 'TMapServer','status,width='+w_width+',height='+w_height+',left='+w_left+',top='+w_top+w_features);
  25.   newwindow.focus();
  26. }
  27.  
  28. function MapScript(script) {
  29.   newwindow = window.open(script, 'TMapServer','status,width='+w_width+',height='+w_height+',left='+w_left+',top='+w_top+w_features);
  30.   newwindow.focus();
  31. }
  32.  
  33. function MapScriptWindow(script, width, height) {
  34.   newwindow = window.open(script, 'TMapServer','status,width='+w_width+',height='+w_height+',left='+w_left+',top='+w_top+w_features);
  35.   newwindow.focus();
  36. }
  37.  
  38. function GetUrl(l) {
  39.   var script = l.pathname;
  40.   var arr = script.split('/');
  41.   arr.length = arr.length-1;
  42.   script = arr.join('/');
  43.   return l.protocol + '//' + l.host + script;
  44. }
  45.  
  46. function MapExist() {
  47.   var exist = false;
  48.   if (strange_opener !=1) {
  49.     if (parent.opener != null) { 
  50.       if (!parent.opener.closed) { 
  51.         if (parent.opener.name == 'map_panel') {
  52.           exist = true;
  53.           map_window = parent.opener.top;
  54.         }
  55.       }
  56.     }  
  57.     if (!exist) {
  58.       if (parent.name == 'map_db') {
  59.         if (parent.map_window != null) {
  60.           if (!parent.map_window.closed) { 
  61.             map_window = parent.map_window;
  62.             exist = true;
  63.           }
  64.         }
  65.       }
  66.     }  
  67.     if (!exist) {
  68.       if (map_window != null) { if (!map_window.closed) exist = true; }
  69.     }
  70.     //alert('map_window');
  71.   }
  72.   return exist;
  73. }
  74.  
  75. function SetMap(map_exist, str) {
  76.   if (top.map_interface != null) {
  77.     top.map_interface.location.href = GetUrl(top.map_interface.location) + '/db_interface.php?' + str;
  78.   }
  79.   else {
  80.     if (map_exist && (strange_opener != 1)) {
  81.       map_window.map_interface.location.href = GetUrl(map_window.map_interface.location) + '/db_interface.php?' + str;
  82.       map_window.focus();
  83.     }
  84.     else {
  85.       var script = root_script + '/index.php?client_type=shocart&strange_opener=0&interface=tmv&' + str;
  86.       var win_feature = 'status,width='+w_width+',height='+w_height+',left='+w_left+',top='+w_top+w_features;
  87.       map_window = window.open('','TMapServer',win_feature);
  88.       if (map_window.map_interface != null && strange_opener != 1) map_window.map_interface.location.href = GetUrl(map_window.map_interface.location) + '/db_interface.php?' + str;
  89.       else map_window.location.href = script;
  90.       if (strange_opener !=1) {
  91.         if (parent.name == 'map_db') parent.map_window = map_window;
  92.       }  
  93.       map_window.focus();
  94.     }
  95.   }
  96. }
  97.  
  98. function ShowMap(theme,field,code,zoom,lang) {
  99.   var str = 'Theme='+theme+'&Command=SelByFld&Field='+field+'&Values='+code+'&Zoom='+zoom+'&Percent=110&client_lang='+lang+'&strange_opener=0&Project=TMS_SHOCART&cacheID=';
  100.   str = str + (new Date).getTime();
  101.  
  102.   SetMap(MapExist(), str);
  103. }
  104.  
  105. function ShowMapEx(parameters,lang) {
  106.   var str = parameters + '&Project=TMS_SHOCART&strange_opener=0&client_lang='+lang + '&cacheID=' + (new Date).getTime();
  107.  
  108.   SetMap(MapExist(), str);
  109. }
  110.  
  111. function DynamicMap(id) {
  112.     var code = id.split("_");
  113.     ShowMap('spot','ID',code[0],'ToScale','cz');
  114. }
  115.  
  116.  
  117.