

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; 
  if (d.images) { 
    if (! d.MM_p) 
      d.MM_p = new Array();
    var i, j = d.MM_p.length, a = MM_preloadImages.arguments; 
    for (i = 0; i < a.length; i++)
      if (a[i].indexOf("#") != 0) { 
        d.MM_p[j] = new Image; 
	d.MM_p[j++].src = a[i];
      }
  }
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j = 0, x;
  var a = MM_swapImage.arguments; 
  document.MM_sr = new Array; 
  for (i = 0; i < (a.length - 2); i += 3)
    if ((x = MM_findObj(a[i])) != null) {
      document.MM_sr[j++] = x; 
      if (!x.oSrc) 
        x.oSrc = x.src; 
      x.src = a[i+2];
    }
}

function load() {
  if (GBrowserIsCompatible()) {
    var map = new GMap2(document.getElementById('map'));
    map.addControl(new GSmallMapControl());
    map.addControl(new GMapTypeControl());
    // javascript:void(prompt('',gApplication.getMap().getCenter()));
    // (40.807247957491825, -73.92760276794434)
    //                        Lat         Long        Zoom
    map.setCenter(new GLatLng(40.806618, -73.927658), 14);
    map.addOverlay(new GMarker(new GLatLng(40.8066, -73.9278)));
    map.openInfoWindowHtml(map.getCenter(), "<table><tr align=left><td class='size11 lineHeight15'><img src='/images/logos/RSTTiny.jpg' /><br />Robotic Systems & Technologies, Inc.<br />79 Alexander Ave<br />Suite 35-A<br />Bronx, NY 10454<br /></td></tr></table>");
  }
}

function swapVideoPlayerToWMV(videoFile) {
  document.getElementById('videoPlayer').innerHTML = "<object id='mediaPlayer' \n width='326' \n height='260' \n classid='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95' \n codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701' \n standby='Loading Microsoft Windows Media Player components...' \n type='application/x-oleobject'> \n <param name='fileName' value='" + videoFile + ".wmv' /> \n <param name='animationatStart' value='true' /> \n <param name='transparentatStart' value='true' /> \n <param name='autoStart' value='true' /> \n <param name='showControls' value='true' /> \n	<param name='loop' value='false' /> \n <embed type='application/x-mplayer2' \n pluginspage='http://microsoft.com/windows/mediaplayer/en/download/' \n id='mediaPlayer' \n name='mediaPlayer' \n displaysize='4' \n autosize='-1' \n bgcolor='darkblue' \n showcontrols='true' \n showtracker='-1' \n showdisplay='0' \n showstatusbar='-1' \n videoborder3d='-1' \n width='326' \n height='260' \n src='" + videoFile + ".wmv' \n autostart='true' \n designtimesp='5311' \n loop='false'> \n </embed> \n </object>";
  var otherVersionLink = document.getElementById('otherVersionLink');
  otherVersionLink.innerHTML = "switch to Quicktime";
  otherVersionLink.href = videoFile + ".mov";
  otherVersionLink.onclick = function () { swapVideoPlayerToMOV(videoFile); return false; };
  //otherVersionLink.onclick = "swapVideoPlayerToMOV('" + videoFile + "'); return false;";
}

function swapVideoPlayerToMOV(videoFile) {
  document.getElementById('videoPlayer').innerHTML = "<object classid='clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B' \n width='326' \n height='260' \n data='" + videoFile + ".mov' \n codebase='http://www.apple.com/qtactivex/qtplugin.cab'> \n	<param name='src' value='" + videoFile + ".mov' /> \n <param name='autoplay' value='true' /> \n <param name='controller' value='true' /> \n <param name='loop' value='false' /> \n <embed src='" + videoFile + ".mov' \n width='326' \n height='260' \n autoplay='true' \n controller='true' \n loop='false' \n pluginspage='http://www.apple.com/quicktime/download/'> \n </embed> \n </object>";
  var otherVersionLink = document.getElementById('otherVersionLink');
  otherVersionLink.innerHTML = "switch to Windows Media Player";
  otherVersionLink.href = videoFile + ".wmv";
  otherVersionLink.onclick = function () { swapVideoPlayerToWMV(videoFile); return false; };
  //otherVersionLink.onclick = "swapVideoPlayerToWMV('" + videoFile + "'); return false;";
}

function calculateInvestment(obj) {
  document.getElementById('investment_calc_money').innerHTML = parseInt(obj.value) * 5000;
  document.getElementById('investment_calc_shares').innerHTML = parseInt(obj.value) * 50;
}

function printfire() {
   if (document.createEvent)
   {
      printfire.args =  arguments;
      var ev = document.createEvent("Events");
      ev.initEvent("printfire", false, true );
      dispatchEvent(ev);
   }
}
