home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2008 November / PCWNOV08.iso / Software / Freeware / Mini Map Sidebar 0.3 / mini_map_sidebar-0.3.0-fx.xpi / chrome / content / embed.js < prev    next >
Encoding:
JavaScript  |  2007-08-04  |  1.5 KB  |  35 lines

  1. var $ = function(x) { return  document.getElementById(x); };
  2. var gLat;
  3. var gLng;
  4.  
  5. function embedInit(){
  6.     var params = window.arguments[0];
  7.     gLat = params.lat;
  8.     gLng = params.lng;
  9.     var title = params.title;
  10.     $('embed-title').setAttribute('value',title);
  11.     title = encodeURIComponent(title);
  12.     var source = "http://maps.stcstm.org/embed?lat="+gLat+"&lng="+gLng+"&title="+title+"&type=m&zoom=11";
  13.     var iframecode = '<iframe src="'+source+'" width="400" height="300" frameborder="0" scrolling="no" marginwidth="0" marginheight="0" />'; 
  14.     $('minimap-embed-code').setAttribute('value',iframecode);
  15.     var body = $('minimap-embed-iframe').contentWindow.document.getElementsByTagName('body')[0];
  16.     body.innerHTML = '<div width="100%" height="100%" align="center">'+iframecode+'</div>';
  17. }
  18.  
  19. function embedRefresh(){
  20.     var mt = $('minimap-embed-maptype').value;
  21.     var z = $('minimap-embed-zoom').value;
  22.     var title = $('embed-title').value;
  23.     title = encodeURIComponent(title);
  24.     var w = $('minimap-embed-width').value;
  25.     var h = $('minimap-embed-height').value;
  26.     var source = "http://maps.stcstm.org/embed?lat="+gLat+"&lng="+gLng+"&title="+title+"&type="+mt+"&zoom="+z;
  27.     var iframecode = '<iframe src="'+source+'" width="'+w+'" height="'+h+'" frameborder="0" scrolling="no" marginwidth="0" marginheight="0" />'; 
  28.     $('minimap-embed-code').setAttribute('value',iframecode);
  29.     var body = $('minimap-embed-iframe').contentWindow.document.getElementsByTagName('body')[0];
  30.     body.innerHTML = '<div width="100%" height="100%" align="center">'+iframecode+'</div>';
  31. }
  32.  
  33.  
  34.  
  35.