//Copyright (c) 2001 Kiesel Media Group, Inc.
//All Rights Reserved.
//Unauthorized Duplication Prohibited by law.

//Authors : Nishant Ramachandran & Jason Kiesel
//Last Modified 05.23.01


//Variable IE Declaration

var isIE = (navigator.appName.indexOf("Internet Explorer") > 0) ? true : false;


//Redirects to Flash Frame

function redirectKMGFLash() {
  window.self.location.href = "kmg.asp";
}


//Maximizes Flash Window

function maximizeWindow() {
  if (window.screen) {
    var availableWidth = screen.availWidth;
    var availableHeight = screen.availHeight;
    window.parent.moveTo(0, 0);
    window.parent.resizeTo(availableWidth, availableHeight);
    window.parent.opener.close()
  }
}


//Opens KMG Flash Window

function launchKMGFlash() {
  var handlerWindow = null;
  var strPage = "flash/en/index.asp";
  var iHeight = 450;
  var iWidth = 700;
  var sParameters = (isIE) ? ("toolbar=no,status=no,scrollbars=yes,left=" + ((screen.availWidth / 2) - (iWidth / 2)) + ",top=" + ((screen.availHeight / 2) - (iHeight / 2)) + ",height=" + iHeight + ",width=" + iWidth) : ("toolbar=no,status=no,scrollbars=yes,screenX=" + ((screen.availWidth / 2) - (iWidth / 2)) + ",screenY=" + ((screen.availHeight / 2) - (iHeight / 2)) + ",height=" + iHeight + ",width=" + iWidth);

  handlerWindow = window.open(strPage, "KMGFlash", sParameters);

  if (handlerWindow != null)
    handlerWindow.focus();
  else
    self.location = strPage;
}


//Opens Legal Window

function launchLegal() {
  var handlerWindow = null;
  var strPage = "html/popouts/legal.asp";
  var iHeight = 450;
  var iWidth = 700;
  var sParameters = (isIE) ? ("toolbar=no,status=no,scrollbars=yes,left=" + ((screen.availWidth / 2) - (iWidth / 2)) + ",top=" + ((screen.availHeight / 2) - (iHeight / 2)) + ",height=" + iHeight + ",width=" + iWidth) : ("toolbar=no,status=no,scrollbars=yes,screenX=" + ((screen.availWidth / 2) - (iWidth / 2)) + ",screenY=" + ((screen.availHeight / 2) - (iHeight / 2)) + ",height=" + iHeight + ",width=" + iWidth);

  handlerWindow = window.open(strPage, "Help", sParameters);

  if (handlerWindow != null)
    handlerWindow.focus();
  else
    self.location = strPage;
}


//Opens News Detail Window

function launchNewsDetail(newsDetailID) {
  var handlerWindow = null;
  var strPage = "../../html/popouts/news_detail.asp?newsDetailID=" + newsDetailID;
  var iHeight = 450;
  var iWidth = 700;
  var sParameters = (isIE) ? ("toolbar=no,status=no,scrollbars=yes,left=" + ((screen.availWidth / 2) - (iWidth / 2)) + ",top=" + ((screen.availHeight / 2) - (iHeight / 2)) + ",height=" + iHeight + ",width=" + iWidth) : ("toolbar=no,status=no,scrollbars=yes,screenX=" + ((screen.availWidth / 2) - (iWidth / 2)) + ",screenY=" + ((screen.availHeight / 2) - (iHeight / 2)) + ",height=" + iHeight + ",width=" + iWidth);

  handlerWindow = window.open(strPage, "NewsDetail", sParameters);

  if (handlerWindow != null)
    handlerWindow.focus();
  else
    self.location = strPage;
}


//Opens Screenshot Window (from flash)

function launchScreenshot(screenshotID, xwidth, ywidth, xloc, yloc, scroll, resize, toolbar) {

var winPar;
var handlerWindow = null;

if (xwidth) winPar = winPar + ',width=' + xwidth;
if (ywidth) winPar = winPar + ',height=' + ywidth;
if (xloc)
  winPar = winPar + ',screenX=' + xloc + ',left=' + xloc;
else
  winPar = winPar + ',screenX=' + ((screen.availWidth / 2) - (xwidth / 2)) + ',left=' + ((screen.availWidth / 2) - (xwidth / 2));
if (yloc)
  winPar = winPar + ',screenY=' + yloc + ',top=' + yloc;
else
  winPar = winPar + ',screenY=' + ((screen.availHeight / 2) - (ywidth / 2)) + ',top=' + ((screen.availHeight / 2) - (ywidth / 2));
if (scroll) winPar = winPar + ',scrollbars=' + scroll;
if (resize) winPar = winPar + ',resizable=' + resize;
if (toolbar) winPar = winPar + ',toolbar=' + toolbar;
if (winPar)
  handlerWindow = window.open("../../html/popouts/kmg_screenshot.asp?" + screenshotID, '_popWindow', winPar);
else
  handlerWindow = window.open("../../html/popouts/kmg_screenshot.asp?" + screenshotID, '_popWindow');
if (handlerWindow == null)
  self.location.href = "../../html/popouts/kmg_screenshot.asp?" + screenshotID;
else
  handlerWindow.focus();

}


//Opens Flash Sample Window (from flash)

function launchFlash(screenshotID, xwidth, ywidth, xloc, yloc, scroll, resize, toolbar) {

var winPar;
var handlerWindow = null;

if (xwidth) winPar = winPar + ',width=' + xwidth;
if (ywidth) winPar = winPar + ',height=' + ywidth;
if (xloc)
  winPar = winPar + ',screenX=' + xloc + ',left=' + xloc;
else
  winPar = winPar + ',screenX=' + ((screen.availWidth / 2) - (xwidth / 2)) + ',left=' + ((screen.availWidth / 2) - (xwidth / 2));
if (yloc)
  winPar = winPar + ',screenY=' + yloc + ',top=' + yloc;
else
  winPar = winPar + ',screenY=' + ((screen.availHeight / 2) - (ywidth / 2)) + ',top=' + ((screen.availHeight / 2) - (ywidth / 2));
if (scroll) winPar = winPar + ',scrollbars=' + scroll;
if (resize) winPar = winPar + ',resizable=' + resize;
if (toolbar) winPar = winPar + ',toolbar=' + toolbar;
if (winPar)
  handlerWindow = window.open("../../html/popouts/kmg_flash.asp?id=" + screenshotID + "&width=" + xwidth + "&height=" + ywidth, '_popWindow', winPar);
else
  handlerWindow = window.open("../../html/popouts/kmg_flash.asp?id=" + screenshotID + "&width=" + xwidth + "&height=" + ywidth, '_popWindow');
if (handlerWindow == null)
  self.location.href = "../../html/popouts/kmg_flash.asp?id=" + screenshotID + "&width=" + xwidth + "&height=" + ywidth;
else
  handlerWindow.focus();

}

