// convert all characters to lowercase to simplify testing
    var agt=navigator.userAgent.toLowerCase();

// *** BROWSER VERSION ***
// Note: On IE5, these return 4, so use is_ie5up to detect IE5.
    var is_major = parseInt(navigator.appVersion);
    var is_minor = parseFloat(navigator.appVersion);

// Note: Opera and WebTV spoof Navigator.  We do strict client detection.
// If you want to allow spoofing, take out the tests for opera and webtv.
    var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
                && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
                && (agt.indexOf('webtv')==-1));
    var is_nav2 = (is_nav && (is_major == 2));
    var is_nav3 = (is_nav && (is_major == 3));
    var is_nav4 = (is_nav && (is_major == 4));
    var is_nav4up = (is_nav && (is_major >= 4));
    var is_navonly      = (is_nav && ((agt.indexOf(";nav") != -1) ||
                          (agt.indexOf("; nav") != -1)) );
    var is_nav5 = (is_nav && (is_major == 5));
    var is_nav5up = (is_nav && (is_major >= 5));
    var is_nav6 = (is_nav && (agt.indexOf("mozilla/5") >= 0));
    
    var is_ie   = (agt.indexOf("msie") != -1);
    var is_ie3  = (is_ie && (is_major < 4));
    var is_ie4  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")==-1) );
    var is_ie4up  = (is_ie  && (is_major >= 4));
    var is_ie5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
    var is_ie5up  = (is_ie  && !is_ie3 && !is_ie4);


function setCookie (cookieName, cookieValue, cookieExpires, cookiePath, cookieDomain, cookieSecure) {
  document.cookie =
    escape(cookieName) + '=' + escape(cookieValue)
    + (cookieExpires ? '; EXPIRES=' + cookieExpires.toGMTString() : '')
    + (cookiePath ? '; PATH=' + cookiePath : '')
    + (cookieDomain ? '; DOMAIN=' + cookieDomain : '')
    + (cookieSecure ? '; SECURE' : '');
}


function  CreateWindowChat()
{
	NewWindow = window.open(AppPath("/remote/live/marketchat/MarketChat.html",false), "Chat",
               "toolbar=no, WIDTH=700, HEIGHT=440, directories=no, status=no, scrollbars=no, resizable=no, menubar=no");
}

function notqualify() {
alert("This application is not compatible with your browser .  Please call your Global Link representative for the most current requirements.")
window.open("../../contact/contact.html", "_blank", "width=650,height=480,toolbar=0,menubar=0,scrollbars=auto,resizable=1,status=0,location=0,directories=0,copyhistory=0")

}

function  CreateWindowOptimizer()
{
        NewWindow = window.open(AppPath("/optprod/mainnew2.asp", false), "Optimiser",
                        "toolbar=no,WIDTH=700,HEIGHT=440,directories=no,status=no,scrollbars=no,resizable=no,menubar=no")
}


<!-- ******************************** end of Market Chat pop-up ************************* -->


<!-- hide this script from non-javascript-enabled browsers

function newImage(arg) {
 if (document.images) {
  rslt = new Image();
  rslt.src = arg;
  return rslt;
 }
}

function changeImages() {
 if (document.images) {
  for (var i=0; i<changeImages.arguments.length; i+=2) {
   document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
  }
 }
}

function preloadImages() {
}

function show(name) {
		if( document.layers ) {
			if (document.layers[name])
				document.layers[name].visibility='visible';
		}
		else
			if (document.all[name])
				document.all[name].style.visibility='visible';
	}

function hide(name) {
		if( document.layers ) {
			if (document.layers[name])
				document.layers[name].visibility='hidden';
		}
		else
			if (document.all[name])
				document.all[name].style.visibility='hidden';
        }

	// stop hiding -->



// ******************************************************************
// Function: DisplayChangePasswordPage
//   Author: Joe Sicree
//     Date: March 03, 2003
//
// Displays the APS-enabled change password page. The function will
// encode the current URL and append it as parameter to the change
// password URL. The function has one argument, which is the URL for
// the change password page.
//
// The URL for the change password page depends on the environment.
// In Development, the change password page is on a different web
// server than the application, so a fully qualified URL must be used.
// In QA and Production, the change password page is on the same server
// as the rest of the application, so a relative URL may be used.
//
// NOTE: THIS FUNCTION HAS BEEN REPLACED BY THE createChangePasswordUrl
// FUNCTION. A CODE CHANGE TO THE JSP THAT USED TO CALL THIS FUNCTION
// WAS ALSO MADE.
//
// *****************************************************************
function DisplayChangePasswordPage(changePwUrl) {

  alert('The function DisplayChangePasswordPage was called erroneously. Please contact your Globallink Admin.');
}


// ******************************************************************
// Function: CreateWindowChangePassword
//
// Original function used to display the pre-APS change password page in a new
// window. Once all applications have been converted to use the SiteMinder
// APS module, this function will be removed.
//
// *****************************************************************
function CreateWindowChangePassword()
{
  NewWindow = window.open(AppPath("/remote/sellside/changepassword/changepassword.htm",false), "ChangePassword",
          "toolbar=yes,WIDTH=700,HEIGHT=440,directories=no,status=yes,scrollbars=no,resizable=yes,menubar=yes");
}

// ******************************************************************
// Function: createChangePasswordUrl
//   Author: Joe Sicree
//     Date: Dec 01, 2003
//
// Returns the HTML text for the change password link. This function
// takes the URL for the change password page and the link text as
// input. The string returned is an HTML <a> tag.
//
// This method uses the JavaScript location.host variable to get
// the client side host. This should be the name of the LTS the
// user is using. The host name is needed within the change password
// page to correctly build the link to the change password CGI.
//
// The link text is the text and/or HTML to go between the href
// HTML tag.
//
// *****************************************************************
function createChangePasswordUrl(changePwUrl, changePwText) {

  // the changePwUrl variable should be a relative URL.

  // Get the current pages's URL and encode it.
  var currentPage = escape(window.location.href);

  var host = location.host;
  var protocol = location.protocol;

  var newUrl = protocol + "//" + host + "/" + changePwUrl + "?StatusCode=PASSWORD_CHANGE&Target=" + currentPage;

  return "<a href=\"" + newUrl + "\">" + changePwText + "</a>";
}


// myServer is the secure version of the current server; note: "Login" should
// never be called from the private network
function Login(myServer)
{
	currentLocation=window.location.href;
        offset = currentLocation.indexOf("://");
        if (offset > -1)
           offset = currentLocation.indexOf("/", offset+3);
           if (offset > -1) {
              newLocation = "" + myServer + currentLocation.substr(offset);
	      window.location.href=newLocation;
           }
}

function Logout()

{
	window.location.href="/NASApp/cs/ContentServer?pagename=GlobalLink/Common/rCSLogout";
}

var trace = 'true';
var popupHandle;

function openapplauncher( product, exeMsg, exeOptions, failMsg, linkTxt ) {

    var windowName = 'AppLauncher';
    var height = 200;
    var width = 200;

    x = (640 - width)/2, y = (480 - height)/2;

    if (screen) {
        y = (screen.availHeight - height)/2;
        x = (screen.availWidth - width)/2;
    }

    var features =
        'width='        + '200' +
        ',height='      + '200' +
        ',directories=' + 0 +
        ',location='    + 0 +
        ',menubar='     + 0 +
        ',scrollbars='  + 0 +
        ',status='      + 0 +
        ',toolbar='     + 0 +
        ',resizable='   + 0 +
        ',screenX='		+ x +
        ',screenY='		+ y +
        ',top='			+ y	+
        ',left='		+ x;


    popupHandle = window.open("",windowName,features);

    // write out requisite header and javascript hook function
    popupHandle.document.open();

    popupHandle.document.writeln('<HTML><HEAD><TITLE>Launching ' + product + '<\/TITLE><\/HEAD>');
    popupHandle.document.writeln('<BODY leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 bgcolor="white">');
    popupHandle.document.writeln('<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center"><tr><td align="center" valign="top">');

    // start ie and navigator compatible applet tags
    if (is_ie == true)
        popupHandle.document.writeln('<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = "' + width + '" HEIGHT = "' + height +'"  codebase="http:\/\/java.sun.com\/products\/plugin\/1.3\/jinstall-13-win32.cab"><NOEMBED><XMP>');
    else if (is_nav == true && is_nav6 == false)
        popupHandle.document.writeln('<EMBED type="application\/x-java-applet;version=1.3.1"  CODE = "com.globallink.utils.launcher.AutoAppLauncher" ARCHIVE = "GLAppLauncher.jar" WIDTH = "' + width + '" HEIGHT = "' + height +'" MAYSCRIPT = true CODEBASE =  "/software" ARCHIVE =  "GLAppLauncher.jar" product =  "' + product + '" exe.msg =  "' + exeMsg + '" options =  "' + exeOptions + '" fail.msg =  "'+ failMsg + '" link.label =  "' + linkTxt + '" scriptable =  "true"  trace = "' + trace + '"  pluginspage="http:\/\/java.sun.com\/j2se\/1.3\/jre "><NOEMBED><XMP>');
    popupHandle.document.writeln('<APPLET CODE = "com.globallink.utils.launcher.AutoAppLauncher" ARCHIVE = "GLAppLauncher.jar" WIDTH = "' + width + '" HEIGHT = "' + height +'" MAYSCRIPT=true><\/XMP>');
    popupHandle.document.writeln('<PARAM NAME="type" VALUE="application\/x-java-applet;version=1.3.1">');
    popupHandle.document.writeln('<PARAM NAME = "CODEBASE"      VALUE = "/software">');
    popupHandle.document.writeln('<PARAM NAME = "ARCHIVE" 		VALUE = "GLAppLauncher.jar">');
    popupHandle.document.writeln('<PARAM NAME = "CODE" 			VALUE = "com.globallink.utils.launcher.AutoAppLauncher">');
    popupHandle.document.writeln('<PARAM NAME = "product" 		VALUE = "' + product + '">');
    popupHandle.document.writeln('<PARAM NAME = "exe.msg" 		VALUE = "' + exeMsg + '">');
    popupHandle.document.writeln('<PARAM NAME = "options" 		VALUE = "' + exeOptions + '">');
    popupHandle.document.writeln('<PARAM NAME = "fail.msg" 		VALUE = "' + failMsg + '">');
    popupHandle.document.writeln('<PARAM NAME = "link.label" 	VALUE = "' + linkTxt + '">');
    popupHandle.document.writeln('<PARAM NAME = "scriptable" 	VALUE = "true">');
    popupHandle.document.writeln('<PARAM NAME = "trace" 		VALUE = "' + trace + '">');
    popupHandle.document.writeln('<\/APPLET>');
    popupHandle.document.writeln('<\/NOEMBED><\/EMBED><\/OBJECT>');

    // close out the document
    popupHandle.document.writeln('<\/td><\/tr><\/table>');
    popupHandle.document.write('<\/BODY><\/HTML>');
    popupHandle.document.close();
}

function closeapplauncher() {

    if( popupHandle != null )
        popupHandle.close();

}

