// video tracking functions

function version() {
	var versionNum;
	var indexVer;
	// accounting for MSIE masquerading as Navigator
	indexVer = navigator.appVersion.indexOf("MSIE")
	if (indexVer < 0) {
		indexVer = 0;
	} else {
		indexVer = indexVer + 5;
	}		
	versionNum = parseFloat(navigator.appVersion.substring(indexVer,indexVer + 4));
	return versionNum;
}


function pluginDesc(aMimeType) {
    if (navigator.mimeTypes) {
      if (navigator.mimeTypes[aMimeType]) {
        if (navigator.mimeTypes[aMimeType].enabledPlugin) {
          if (aMimeType == 'video/quicktime') {	// special case for QuickTime -- version is in name, not description

            return navigator.mimeTypes[aMimeType].enabledPlugin.name;
          } else {
          	return navigator.mimeTypes[aMimeType].enabledPlugin.description;
          }
        }
      }
    }
}


function  plugin_ret() {
  // given a mime type, returns the plug-in's description, if there is one.
  var q = '?';
  q += 'screen.height=' + screen.height + '&';
  q += 'screen.width=' + screen.width + '&';
  if (document.body) {
    q += 'window.height=' + document.body.clientHeight + '&';
    q += 'window.width=' + document.body.clientWidth + '&';
  } else if (window.innerHeight) {
    q += 'window.height=' + window.innerHeight + '&';
    q += 'window.width=' + window.innerWidth + '&';
  }
  if (pluginDesc('application/x-director')) { q+= 'shockwave=' + escape(pluginDesc('application/x-director')) + '&'; }
  if (pluginDesc('application/x-shockwave-flash')) { q+= 'flash=' + escape(pluginDesc('application/x-shockwave-flash')) + '&'; }
  if (pluginDesc('video/quicktime')) { q+= 'quicktime=' + escape(pluginDesc('video/quicktime')) + '&'; }
  q += 'javaEnabled=' + navigator.javaEnabled() + '&';
  if (document.images) {
    var detect = new Image();
    detect.src = 'http://intapp.wgbh.org/intapp/track/single.gif' + q;
    document.write('<img src="' + detect.src + '" height="1" width="1" alt="">');
  }
}

function cfl2_window(which_window, image_width, image_height) {
	var window_width = image_width + 46;
	var window_height = image_height + 175;
  	newwin = window.open(which_window, "cfl2_window",'toolbar=0,location=0,directories=0,scrollbars=1,status=0,menubar=0,resizable=1,width=' + window_width + ',height=' + window_height);
	window.self.name = "cfl2_parent";
}
