﻿/// <reference name="MicrosoftAjax.js"/>
function showVideo(p,v)
{
  var url = null;
  
  if (typeof(p) !== 'undefined' && typeof(v) === 'undefined') url = p;
  else {
    if (typeof(p) === 'undefined') p = productName;
    if (typeof(v) === 'undefined') v = videoName;
    url = '/content/subscribers/' + p + '/' + v + '/' + v + '.html';
  }
  
  window.open
  (
    url, 
    "video", 
    "menubar=0,toolbar=0,location=0,directories=0,status=0,scrollbars=0,resizable=0,width=800,height=655,left=0,top=0", 
    true
  );
}

function showVideojw(p, v) {
  var url = null;

  if (typeof(p) !== 'undefined' && typeof(v) === 'undefined') url = p;
  else {
      if (typeof(p) === 'undefined') p = productName;
      if (typeof(v) === 'undefined') v = videoName;
      url = '/content/subscribers/' + p + '/' + v + '/' + v + '.html';
  }

  window.open
  (
    url,
    "video",
    "menubar=0,toolbar=0,location=0,directories=0,status=0,scrollbars=0,resizable=0,width=990,height=570,left=0,top=0",
    true
  );
}

function downloadVideo(p,v)
{
  if (typeof(p) === 'undefined')
    p = productName;

  if (typeof(v) === 'undefined')
    v = videoName;
    
  document.location.href = '/content/subscribers/' + p + '/' + v + '/' + v + '.zip';
}

// HACK to enable default buttons in FireFox.
function WebForm_FireDefaultButton(event, target) {
  if (event.keyCode == 13 && !(event.srcElement && (event.srcElement.tagName.toLowerCase() == "textarea"))) 
  {
    var defaultButton;
    if (__nonMSDOMBrowser) 
    {
        defaultButton = document.getElementById(target);
    }
    else 
    {
        defaultButton = document.all[target];
    }
    
    if (defaultButton)
    {
      // if the default button supports a click method then invoke it
      if (typeof(defaultButton.click) != "undefined") 
      {
        defaultButton.click();
      }
      // otherwise check to see if the button is an anchor tag and if it is then
      // invoke any script specified in the href
      else if (defaultButton.tagName == "A" && defaultButton.href.startsWith("javascript:"))
      {
        var f = defaultButton.href.replace("javascript:", "");
        eval(f);
      }
      
      event.cancelBubble = true;
      if (event.stopPropagation) event.stopPropagation();
      
      return false;
    }
  }
  return true;
}