﻿// JScript File

function openPic(imageURL) {
    window.open( "popup.htm?"+"images/"+imageURL, "",  
     "resizable=1,HEIGHT=200,WIDTH=200"); 
}

function openRoster(imageURL) {
    window.open( "popup.htm?"+"media/"+imageURL, "",  
     "resizable=1,HEIGHT=200,WIDTH=200"); 
}

function showPedigreeConfirm(url) {
    
   if(confirm('Are you sure you wish to update this report? Your Bris account will be charged!')){
    
       fnOpenWindow(url, 800, 600, 'yes'); };
}

function SetVideo(path, title){
    var so = new SWFObject("media/swf/VideoPlayer.swf", "player", "410", "400", "9", "#000000");
    so.addParam("scale", "noscale");
    so.addParam("wmode", "transparent");
    so.addParam("FlashVars", "path=" + "/media/swf/" + path + ".flv" + "&videotitle=" + title);
    so.write("flashcontent");
}

function playVideo(query) {
     fnOpenWindow("player.aspx?video="+query, 500, 337);}
     
function showPedigree(url) {
     fnOpenWindow(url, 800, 600, 'yes');
     
}

function fnOpenWindow(url, w, h, sb, r, mb, tb, s, loc, dir)
{
  var screenWidth = window.screen.availWidth;
  var screenHeight = window.screen.availHeight;

  var offsetXWinXP = 5;
  var offsetYWinXP = 18;

  var halfScreenWidth = Number(window.screen.availWidth / 2);
  var halfScreenHeight = Number(window.screen.availHeight / 2);

  var halfWindowWidth = Number(w / 2);
  var halfWindowHeight = Number(h / 2);

  var diffWidth = Number(halfScreenWidth-halfWindowWidth);
  var diffHeight = Number(halfScreenHeight-halfWindowHeight);

  diffWidth -= offsetXWinXP;
  diffHeight -= offsetYWinXP;
  
  //The windowName is a zero-based integer corresponding to the number of milliseconds
  //since January 1, 1970, to the date specified by the instance of the Date object;
  //therefore, the windowName will almost always be unique.
  var dtm = new Date();
  var windowName = dtm.getTime();
  
  //if (url == null) { url = "" };
  if (w == null) { w = 640 };
  if (h == null) { h = 480 };
  if (sb == null) { sb = "no" };
  if (r == null) { r = "no" };
  if (mb == null) { mb = "no" };
  if (tb == null) { tb = "no" };
  if (s == null) { s = "no" };
  if (loc == null) { loc = "no" };
  if (dir == null) { dir = "no" };

  var features = "directories=" + dir + ",";
  features += "location=" + loc + ",";
  features += "menubar=" + mb + ",";
  features += "resizable=" + r + ",";
  features += "scrollbars=" + sb + ",";
  features += "status=" + s + ",";
  features += "toolbar=" + tb +",";
  features += "width=" + w + ",";
  features += "height=" + h + ",";
  features += "top=" + diffHeight + ",";
  features += "left=" + diffWidth;
  
  if (url != null && url != "")
  {
    return window.open(url, windowName, features);
  }
  else
  {
    alert("The url parameter is missing.");
    return;
  }
}  