//ac_runactivecontent.js, v1.0, Copyright 2006 Adobe Systems, Inc. All rights reserved.
function AC_AddExtension(src,ext) {
  if (src.indexOf('?') != -1)
    return src.replace(/\?/,ext + '?');
  else
    return src + ext;
}
function AC_Generateobj(objAttrs,params,embedAttrs) {
  var str = '<object ';
  for (var i in objAttrs)
    str += i + '="' + objAttrs[i] + '" ';
  str += '>';
  for (var i in params)
    str += '<param name="' + i + '" value="' + params[i] + '" /> ';
  str += '<embed ';
  for (var i in embedAttrs)
    str += i + '="' + embedAttrs[i] + '" ';
  str += ' ></embed></object>';
  document.write(str);
}
function AC_FL_RunContent() {
  var ret =
    AC_GetArgs
    (arguments,".swf","movie","clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     ,"application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs,ret.params,ret.embedAttrs);
}
function AC_SW_RunContent() {
  var ret =
    AC_GetArgs
    (arguments,".dcr","src","clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     ,null
    );
  AC_Generateobj(ret.objAttrs,ret.params,ret.embedAttrs);
}
function AC_GetArgs(args,ext,srcParamName,classid,mimeType) {
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i = 0;i < args.length;i = i + 2) {
    var currArg = args[i].toLowerCase();
    switch (currArg) {
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i + 1];
        break;
      case "src":
      case "movie":
        args[i + 1] = AC_AddExtension(args[i + 1],ext);
        ret.embedAttrs["src"] = args[i + 1];
        ret.params[srcParamName] = args[i + 1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
        ret.objAttrs[args[i]] = args[i + 1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace":
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "id":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i + 1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i + 1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}

// global.js
var formSubmitValue = 'processing...';
function downloadPlugin(theUrl) {
  theNewWin = window.open(theUrl,'plugin','width=800,height=560,scrollbars=yes,resizable=yes,location=yes,toolbar=yes');
  theNewWin.focus();
}
function turnMeOff(id) {
  document.getElementById(id).style.display = "none";
}
function popArticle(theUrl) {
  theNewWin = window.open(theUrl,'emeraldArticle','width=640,height=500,scrollbars=yes,resizable=yes');
  theNewWin.focus();
}
function popApplyNowForm(theUrl) {
  theNewWin = window.open(theUrl,'emeraldApplyNow','width=600,height=580,scrollbars=yes,resizable=yes');
  theNewWin.focus();
}
function popCalculator(theUrl) {
  theNewWin = window.open(theUrl,'emeraldCalculator','width=640,height=500,scrollbars=yes,resizable=yes');
  theNewWin.focus();
}
function popContactUsForm(theUrl) {
  theNewWin = window.open(theUrl,'emeraldContactUs','width=600,height=580,scrollbars=yes,resizable=yes');
  theNewWin.focus();
}
function popEseminar(theUrl) {
  theNewWin = window.open(theUrl,'emeraldEseminar','width=623,height=536,resizable=yes');
  theNewWin.focus();
}
function popForm(theUrl,theClass) {
  if (theClass == 'quoteRequest') {
    theNewWin = window.open(theUrl,'emeraldForm','width=560,height=500,scrollbars=yes,resizable=yes');
  }
  else {
    theNewWin = window.open(theUrl,'emeraldForm','width=540,height=500,scrollbars=yes,resizable=yes');
  }
  theNewWin.focus();
}
function popNewsletter(theUrl) {
  theNewWin = window.open(theUrl,'emeraldNewsletter','width=640,height=500,scrollbars=yes,resizable=yes');
  theNewWin.focus();
}
function popSeminarSignupForm(theUrl) {
  theNewWin = window.open(theUrl,'emeraldSeminarSignup','width=600,height=580,scrollbars=yes,resizable=yes');
  theNewWin.focus();
}
function printPage() {
  window.print();
}
function hideIBuffer() {
  if (document.getElementById('iBuffer')) {
    document.getElementById('iBuffer').style.display = 'none';
  }
}
function showIBuffer() {
  if (document.getElementById('iBuffer')) {
    document.getElementById('iBuffer').style.display = '';
  }
}
function hideIframe() {
  if (document.getElementById('marketWatch_iContent')) {
    document.getElementById('marketWatch_iContent').style.display = 'none';
    showIBuffer();
  }
  if (document.getElementById('glossary_iContent')) {
    document.getElementById('glossary_iContent').style.display = 'none';
    showIBuffer();
  }
}
function showIframe() {
  if (document.getElementById('marketWatch_iContent')) {
    document.getElementById('marketWatch_iContent').style.display = '';
    hideIBuffer();
  }
  if (document.getElementById('glossary_iContent')) {
    document.getElementById('glossary_iContent').style.display = '';
    hideIBuffer();
  }
}
function marketWatch_iFrameGo(url) {
  if (document.getElementById('marketWatch_iContent')) {
    showIframe();
    document.getElementById('marketWatch_iContent').src = url;
  }
  else {
    window.location = 'subMarketWatch.cfm?url=' + url;
  }
}
function unBorderTables() {
  for (i = 0;i <= 29;i++) {
    if (document.getElementsByTagName("table")[i])
      document.getElementsByTagName("table")[i].border = 0;
  }
}
function open_window(url) {
  mywin = window.open(url,"win",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width=400,height=335');
}
function new_window(url,wx,hx) {
  newwin = window.open(url,"win",'toolbar=0,location=0,directories=0,scrollbars=1,resizable=1,status=1,menubar=0,width=' + wx + ',height=' + hx);
}
var NewBox = null;
function infobox(strURL,strWidth,strHeight) {
  if (NewBox != null && !NewBox.closed)
    NewBox.close();
  var strOptions = "";
  strOptions = "toolbar=0,directories=0,status=1,menubar=0,resizable=1," +
     "scrollbars=1,location=0,height=" + strHeight + ",width=" + strWidth;
  NewBox = window.open(strURL,'NewBox',strOptions);
  NewBox.focus();
}
var FileBox = null;
function filebox(strURL,strWidth,strHeight) {
  if (FileBox != null && !FileBox.closed)
    FileBox.close();
  var strOptions = "";
  strOptions = "toolbar=0,directories=0,status=1,menubar=0,resizable=1," +
     "scrollbars=1,location=0,height=" + strHeight + ",width=" + strWidth;
  FileBox = window.open(strURL,'FileBox',strOptions);
  FileBox.focus();
}
function open_windowMainNav(url) {
  myMainNavwin = window.open(url,"win",'toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1,width=600,height=450,left=1,top=1');
}
function getElementById(id) {
  return $(id);
}
function infoLink(theId,which,event) {
  if (which == "over") {
    getElementById(theId).style.display = "";
    drawBox(event,theId)
  } else {
    getElementById(theId).style.display = "none";
  }
}
function drawBox(event,target) {
  var y = event.clientY;
  var scrollY = (window.pageYOffset) ? window.pageYOffset : document.body.scrollTop;
  $(target).style.top = y + scrollY + 20 + "px";
  docWidth = document.viewport.getWidth();
  if (event.clientX > docWidth / 2) {
    var offset = $(target).getOffsetParent().cumulativeOffset();
    var x = Number(event.clientX) - (400 + offset[0]);
    $(target).style.left = x + "px";
  }
}
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

// SWFObject v1.5.1: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
if (typeof deconcept == "undefined") var deconcept = {};
if (typeof deconcept.util == "undefined") deconcept.util = {};
if (typeof deconcept.SWFObjectUtil == "undefined") deconcept.SWFObjectUtil = {};
deconcept.SWFObject = function(swf,id,w,h,ver,c,quality,xiRedirectUrl,redirectUrl,detectKey) {
  if (!document.getElementById) { return; }
  this.DETECT_KEY = detectKey ? detectKey : 'detectflash';
  this.skipDetect = deconcept.util.getRequestParameter(this.DETECT_KEY);
  this.params = {};
  this.variables = {};
  this.attributes = [];
  if (swf) { this.setAttribute('swf',swf); }
  if (id) { this.setAttribute('id',id); }
  if (w) { this.setAttribute('width',w); }
  if (h) { this.setAttribute('height',h); }
  if (ver) { this.setAttribute('version',new deconcept.PlayerVersion(ver.toString().split("."))); }
  this.installedVer = deconcept.SWFObjectUtil.getPlayerVersion();
  if (!window.opera && document.all && this.installedVer.major > 7) {
    if (!deconcept.unloadSet) {
      deconcept.SWFObjectUtil.prepUnload = function() {
        __flash_unloadHandler = function() { };
        __flash_savedUnloadHandler = function() { };
        window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);
      }
      window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);
      deconcept.unloadSet = true;
    }
  }
  if (c) { this.addParam('bgcolor',c); }
  var q = quality ? quality : 'high';
  this.addParam('quality',q);
  this.setAttribute('useExpressInstall',false);
  this.setAttribute('doExpressInstall',false);
  var xir = (xiRedirectUrl) ? xiRedirectUrl : window.location;
  this.setAttribute('xiRedirectUrl',xir);
  this.setAttribute('redirectUrl','');
  if (redirectUrl) { this.setAttribute('redirectUrl',redirectUrl); }
}
deconcept.SWFObject.prototype = {
  useExpressInstall: function(path) {
    this.xiSWFPath = !path ? "expressinstall.swf" : path;
    this.setAttribute('useExpressInstall',true);
  },
  setAttribute: function(name,value) {
    this.attributes[name] = value;
  },
  getAttribute: function(name) {
    return this.attributes[name] || "";
  },
  addParam: function(name,value) {
    this.params[name] = value;
  },
  getParams: function() {
    return this.params;
  },
  addVariable: function(name,value) {
    this.variables[name] = value;
  },
  getVariable: function(name) {
    return this.variables[name] || "";
  },
  getVariables: function() {
    return this.variables;
  },
  getVariablePairs: function() {
    var variablePairs = [];
    var key;
    var variables = this.getVariables();
    for (key in variables) {
      variablePairs[variablePairs.length] = key + "=" + variables[key];
    }
    return variablePairs;
  },
  getSWFHTML: function() {
    var swfNode = "";
    if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) {
      if (this.getAttribute("doExpressInstall")) {
        this.addVariable("MMplayerType","PlugIn");
        this.setAttribute('swf',this.xiSWFPath);
      }
      swfNode = '<embed type="application/x-shockwave-flash" src="' + this.getAttribute('swf') + '" width="' + this.getAttribute('width') + '" height="' + this.getAttribute('height') + '" style="' + (this.getAttribute('style') || "") + '"';
      swfNode += ' id="' + this.getAttribute('id') + '" name="' + this.getAttribute('id') + '" ';
      var params = this.getParams();
      for (var key in params) { swfNode += [key] + '="' + params[key] + '" '; }
      var pairs = this.getVariablePairs().join("&");
      if (pairs.length > 0) { swfNode += 'flashvars="' + pairs + '"'; }
      swfNode += '/>';
    } else {
      if (this.getAttribute("doExpressInstall")) {
        this.addVariable("MMplayerType","ActiveX");
        this.setAttribute('swf',this.xiSWFPath);
      }
      swfNode = '<object id="' + this.getAttribute('id') + '" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + this.getAttribute('width') + '" height="' + this.getAttribute('height') + '" style="' + (this.getAttribute('style') || "") + '">';
      swfNode += '<param name="movie" value="' + this.getAttribute('swf') + '" />';
      var params = this.getParams();
      for (var key in params) {
        swfNode += '<param name="' + key + '" value="' + params[key] + '" />';
      }
      var pairs = this.getVariablePairs().join("&");
      if (pairs.length > 0) { swfNode += '<param name="flashvars" value="' + pairs + '" />'; }
      swfNode += "</object>";
    }
    return swfNode;
  },
  write: function(elementId) {
    if (this.getAttribute('useExpressInstall')) {
      var expressInstallReqVer = new deconcept.PlayerVersion([6,0,65]);
      if (this.installedVer.versionIsValid(expressInstallReqVer) && !this.installedVer.versionIsValid(this.getAttribute('version'))) {
        this.setAttribute('doExpressInstall',true);
        this.addVariable("MMredirectURL",escape(this.getAttribute('xiRedirectUrl')));
        document.title = document.title.slice(0,47) + " - Flash Player Installation";
        this.addVariable("MMdoctitle",document.title);
      }
    }
    if (this.skipDetect || this.getAttribute('doExpressInstall') || this.installedVer.versionIsValid(this.getAttribute('version'))) {
      var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId;
      n.innerHTML = this.getSWFHTML();
      return true;
    } else {
      if (this.getAttribute('redirectUrl') != "") {
        document.location.replace(this.getAttribute('redirectUrl'));
      }
    }
    return false;
  }
}
deconcept.SWFObjectUtil.getPlayerVersion = function() {
  var PlayerVersion = new deconcept.PlayerVersion([0,0,0]);
  if (navigator.plugins && navigator.mimeTypes.length) {
    var x = navigator.plugins["Shockwave Flash"];
    if (x && x.description) {
      PlayerVersion = new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));
    }
  } else if (navigator.userAgent && navigator.userAgent.indexOf("Windows CE") >= 0) {
    var axo = 1;
    var counter = 3;
    while (axo) {
      try {
        counter++;
        axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + counter);
        PlayerVersion = new deconcept.PlayerVersion([counter,0,0]);
      } catch (e) {
        axo = null;
      }
    }
  } else { // Win IE (non mobile)
    try {
      var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
    } catch (e) {
      try {
        var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
        PlayerVersion = new deconcept.PlayerVersion([6,0,21]);
        axo.AllowScriptAccess = "always";
      } catch (e) {
        if (PlayerVersion.major == 6) {
          return PlayerVersion;
        }
      }
      try {
        axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
      } catch (e) { }
    }
    if (axo != null) {
      PlayerVersion = new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
    }
  }
  return PlayerVersion;
}
deconcept.PlayerVersion = function(arrVersion) {
  this.major = arrVersion[0] != null ? parseInt(arrVersion[0]) : 0;
  this.minor = arrVersion[1] != null ? parseInt(arrVersion[1]) : 0;
  this.rev = arrVersion[2] != null ? parseInt(arrVersion[2]) : 0;
}
deconcept.PlayerVersion.prototype.versionIsValid = function(fv) {
  if (this.major < fv.major) return false;
  if (this.major > fv.major) return true;
  if (this.minor < fv.minor) return false;
  if (this.minor > fv.minor) return true;
  if (this.rev < fv.rev) return false;
  return true;
}
deconcept.util = {
  getRequestParameter: function(param) {
    var q = document.location.search || document.location.hash;
    if (param == null) { return q; }
    if (q) {
      var pairs = q.substring(1).split("&");
      for (var i = 0;i < pairs.length;i++) {
        if (pairs[i].substring(0,pairs[i].indexOf("=")) == param) {
          return pairs[i].substring((pairs[i].indexOf("=") + 1));
        }
      }
    }
    return "";
  }
}
deconcept.SWFObjectUtil.cleanupSWFs = function() {
  var objects = document.getElementsByTagName("OBJECT");
  for (var i = objects.length - 1;i >= 0;i--) {
    objects[i].style.display = 'none';
    for (var x in objects[i]) {
      if (typeof objects[i][x] == 'function') {
        objects[i][x] = function() { };
      }
    }
  }
}
if (!document.getElementById && document.all) { document.getElementById = function(id) { return document.all[id]; } }
var getQueryParamValue = deconcept.util.getRequestParameter;
var FlashObject = deconcept.SWFObject;
var SWFObject = deconcept.SWFObject;
function checkBodyWidth() {
  var isIE = navigator.appName.match("Internet Explorer") ? true : false;
  if (isIE) {
    document.getElementsByTagName("body")[0].onresize = function() { shiftContainer() };
    shiftContainer();
  }
}
function shiftContainer() {
  if (document.body.clientWidth || document.documentElement.clientWidth) {
    if ((document.body.clientWidth) % 2 == 1 || (document.documentElement.clientWidth) % 2 == 1) {
      document.getElementById("container").style.left = "1px";
    }
    else {
      document.getElementById("container").style.left = "0";
    }
  }
}
var fixScreenShot = function() {
  var baseHeight = 300;
  var container = $('container');
  var contentBody = $('contentBody');
  if (container && contentBody) {
    var h = container.getHeight();
    if (h < baseHeight) {
      var contentHeight = Number(contentBody.getHeight());
      var contentTop = Number(contentBody.getStyle('top').replace('px',''));
      contentTop = contentTop ? contentTop : 0;
      contentHeight = contentHeight ? contentHeight : baseHeight;
      var pageHeight = (contentTop + contentHeight) + 'px';
      container.style.height = pageHeight;
      container.style.backgroundColor = 'transparent';
    }
  }
};
if (typeof Global == "undefined") {
  var Global = {};
}
Object.extend(Global,{
  applicationRoot: '/',
  alert: function(msg,w,h,ok,okCallback) {
    Global.simpleModal(msg,w,h,ok,okCallback);
  },
  confirm: function(msg,w,h,ok,okCallback,cancel,cancelCallback) {
    Global.simpleModal(msg,w,h,ok,okCallback,cancel,cancelCallback,'confirm');
  },
  simpleModal: function(msg,w,h,ok,okCallback,cancel,cancelCallback,type) {
    msg = (msg != "" && msg != null) ? msg : "Error: no var \"msg\" available";
    ok = (ok != "" && ok != null) ? ok : "Ok";
    w = (w != "" && w != null) ? Number(w) : 220;
    h = (h != "" && h != null) ? Number(h) : 90;
    msg = '<img style="float:left; margin:0 7px;" src="' + Global.applicationRoot + 'include/media/images/alert.gif" alt="" /><div style="margin-right:20px;">' + msg + '</div><div style="height:1px; overflow:hidden; clear:both;"></div>'
    okCallback = okCallback ? okCallback : function() { return true; };
    if (type == 'confirm') {
      cancel = (cancel != "" && cancel != null) ? cancel : "Cancel";
      cancelCallback = cancelCallback ? cancelCallback : function() { return false; };
      Dialog.confirm(msg,{
        windowParameters: {
          className: "alphacube",
          width: w,
          height: h
        },
        okLabel: ok,
        onOk: okCallback,
        cancelLabel: cancel,
        onCancel: cancelCallback
      });
    }
    else {
      Dialog.alert(msg,{
        windowParameters: {
          className: "alphacube",
          width: w,
          height: h
        },
        okLabel: ok,
        onOk: okCallback
      });
    }
    return false;
  },
  openModalWindow: function(url,w,h) {
    var bW = document.viewport.getWidth();
    var bH = document.viewport.getHeight();
    bW = bW ? bW : 640;
    bH = bH ? bH : 480;
    w = (w != "" && w != null) ? Number(w) : Math.abs(bW - 200);
    h = (h != "" && h != null) ? Number(h) : Math.abs(bH - 200);
    if (url) {
      Dialog.info('<iframe src="' + url + '" frameborder="0" style="width:' + w + 'px; height:' + h + 'px;"></iframe>',{
        windowParameters: {
          className: "alphacube",
          width: Number(w) + 20,
          height: Number(h) + 15,
          closable: true,
          draggable: true,
          destroyOnClose: true
        }
      });
    }
  },
  OpenFlipbookModal: function(element) {
    var w = 727;
    var h = 500;
    Dialog.info("<iframe frameborder=\"0\" scrolling=\"no\" width=\"" + Number(w - 10) + "\" height=\"" + Number(h - 10) + "\" src=\"" + element.href + "\"></iframe>",{
      className: "black alphacube",
      width: w,
      height: h,
      closable: true
    });
  },
  GetParameterStringValue: function(string,param) {
    var arrScript = string.split('?');
    var value;
    if (arrScript.length > 1) {
      var arrQuerystringParameters = arrScript[1].split('&');
      for (i = 0;i < arrQuerystringParameters.length;i++) {
        var arrParams = arrQuerystringParameters[i].split('=');
        if (arrParams[0] == param)
          value = arrParams[1];
      }
    }
    return value;
  },
  GetQuerystringValue: function(param) {
    var arrUrl = Global.url().split('/');
    var urlHash = Global.urlHash();
    var string = arrUrl[arrUrl.length - 1].replace(urlHash,'');
    return Global.GetParameterStringValue(string,param);
  },
  SetQuerystringValue: function(param,value,url) {
    var arrUrl = Global.url(url).split('/');
    var found = 0;
    var arrScript = arrUrl[arrUrl.length - 1].split('?');
    if (arrScript.length > 1) {
      var arrQuerystringParameters = arrScript[1].split('&');
      for (i = 0;i < arrQuerystringParameters.length;i++) {
        var arrParams = arrQuerystringParameters[i].split('=');
        if (arrParams[0] == param) {
          arrParams[1] = value;
          arrQuerystringParameters[i] = arrParams.join('=');
          found = 1;
        }
      }
    }
    if (found == 1) {
      return arrScript[0] + '?' + arrQuerystringParameters.join('&');
    }
    else {
      if (arrScript.length > 1)
        return arrScript.join('?') + '&' + param + '=' + value;
      else
        return arrScript[0] + '?' + param + '=' + value;
    }
  },
  DeleteQuerystringValue: function(param,url) {
    var arrUrl = Global.url(url).split('/');
    var found = 0;
    var arrScript = arrUrl[arrUrl.length - 1].split('?');
    if (arrScript.length > 1) {
      var arrQuerystringParameters = arrScript[1].split('&');
      var arrNewQuerystringParameters = new Array();
      var j = 0;
      for (i = 0;i < arrQuerystringParameters.length;i++) {
        var arrParams = arrQuerystringParameters[i].split('=');
        if (arrParams[0] != param) {
          arrNewQuerystringParameters[j] = arrQuerystringParameters[i];
          j++;
        }
      }
      return arrScript[0] + '?' + arrNewQuerystringParameters.join('&');
    }
    else {
      return arrScript[0];
    }
  },
  GetScript: function() {
    var url = location.href;
    var arrUrl = url.split('/');
    var arrScript = arrUrl[arrUrl.length - 1].split('?');
    if (arrScript[0] != '')
      return arrScript[0];
    else
      return 'index.aspx';
  },
  url: function(url) {
    if (!url)
      url = location.href;
    return url;
  },
  urlHash: function(urlHash) {
    if (!urlHash)
      urlHash = location.hash;
    return urlHash;
  },
  toggleDiv: function(element) {
    if (element.parentNode.parentNode.className == 'open') {
      element.parentNode.parentNode.className = 'closed';
    }
    else {
      element.parentNode.parentNode.className = 'open';
    }
  },
  target_blank: function(element) {
    var loc = element.href.trim();
    if (loc != '' && loc != '#' && !loc.match('javascript:')) {
      window.open(loc);
      return false;
    }
    else {
      return true;
    }
  },
  leavingWebsite: function(element) {
    var str = typeof leavingText != 'undefined' ? leavingText.text : '';
    var h = document.viewport.getDimensions().height;
    h = h ? h - 80 : 480;
    if (str != '') {
      Dialog.confirm(str,{
        className: 'alphacube',
        width: 400,
        maxHeight: h,
        closable: true,
        okLabel: 'Proceed',
        ok: function(win) {
          if (element.target == '_blank' || element.hasClassName('target_blank')) {
            Windows.closeAll();
            window.open(element.href);
          }
          else {
            document.location = element.href;
          }
        }
      });
      return false;
    }
    else {
      return true;
    }
  },
  routeGlobalEventHandlers: function(element) {
    element.observe('click',function(event) {
      try {
        var e = event.element();
        if (e.hasClassName('leavingWebsite')) {
          if (!Global.leavingWebsite(e)) {
            event.stop();
          }
        }
        else if (e.hasClassName('target_blank')) {
          if (!Global.target_blank(e)) {
            event.stop();
          }
        }
      }
      catch (error) {
        // do nothing
      }
    });
  }
}); // end Global
var initGlobalEventHandlers = function() {
  $$('.target_blank').each(function(element) {
    element.onclick = function() {
      return Global.target_blank(element);
    }
  });
  $$('.leavingWebsite').each(function(element) {
    element.onclick = function() {
      return Global.leavingWebsite(element);
    }
  });
  $$('.flipbookModal').each(function(element) {
    element.onclick = function() {
      Global.OpenFlipbookModal(element);
      return false;
    }
  });
  $$('.toggleDiv').each(function(element) {
    element.onclick = function() {
      Global.toggleDiv(element);
    }
    element.onmouseover = function() {
      var theText = 'expand/collapse';
      element.alt = theText;
      element.title = theText;
    }
  });
};
var MovieNavWidget = {
  movieArr: [],
  nextMovie: function() {
    var nextMovie = 0;
    for (i = 0;i < this.movieArr.length;i++) {
      if (this.movieArr[i] == so.getAttribute('swf')) {
        if (!(i == this.movieArr.length - 1)) {
          nextMovie = i + 1;
        }
      }
    }
    so.setAttribute('swf',this.movieArr[nextMovie]);
    so.write('HomeMovieSwf');
  },
  previousMovie: function() {
    var previousMovie = this.movieArr.length - 1;
    for (i = 0;i < this.movieArr.length;i++) {
      if (this.movieArr[i] == so.getAttribute('swf')) {
        if (!(i == 0)) {
          previousMovie = i - 1;
        }
      }
    }
    so.setAttribute('swf',this.movieArr[previousMovie]);
    so.write('HomeMovieSwf');
  }
}
// GLOSSARY SEARCH deprecate?
function renameFindButton() {
  document.getElementById('b1').value = 'Next';
}
function glossaryTerm(theUrl) {
  window.location = theUrl
}
var TRange = null
function findString(str) {
  if (parseInt(navigator.appVersion) < 4) return;
  var strFound;
  if (navigator.appName == "Netscape") {
    strFound = self.find(str);
    if (!strFound) {
      strFound = self.find(str,0,1)
      while (self.find(str,0,1)) continue
    }
  }
  if (navigator.appName.indexOf("Microsoft") != -1) {
    if (TRange != null) {
      TRange.collapse(false)
      strFound = TRange.findText(str)
      if (strFound) TRange.select()
    }
    if (TRange == null || strFound == 0) {
      TRange = self.document.body.createTextRange()
      strFound = TRange.findText(str)
      if (strFound) TRange.select()
    }
  }
  if (!strFound) alert('Sorry "' + str + '" was not found.')
}

function fsize(size) {
  $$("body").each(function(e) {
    e.className = e.className.replace(/defaultText|mediumText|largeText/g,"");
    e.className += (" " + size + "Text");
    document.cookie = "fontSize=" + size;
  });
}

Event.onReady(function() {
  if (location.href.match('/uat/')) {
    Global.applicationRoot = '/uat/';
  }

  initGlobalEventHandlers();

  // font resize based on cookie
  try { var c = document.cookie.split(";");$A(c).each(function(cookie) { if (cookie.split("=")[0] == "fontSize") { fsize(cookie.split("=")[1]); } }); } catch (e) { }
});


