<html>
<head>

<!-- Include components common to everyn page -->
-include pages Head.inc

<script language="JavaScript"
        src=
        -quote -url pages Login/Messages.js
>
</script>

<script language="JavaScript">
<!-- 
// Output title
document.writeln('<title>' + Messages.INFO__LOGIN_TO_CC_TITLE + '</title>');

// Variables required by the Login page

// Initial error check
var browserCheck =
-jsquote -startpage
;

// Server hostname
var serverName = 
-jsquote -servername
;

// Last user logged in
var userName = 
-jsquote -user
;

// Platform of web server
var serverPlatform = 
-jsquote -server_platform
;

-if -server_platform "Windows"

// Windows NT domain
var domain = 
-jsquote -domain
;

var isLoginPage = true;
-endif


// helpCallback is called when the "Help" button on the CCLogo bar is clicked
function
helpCallback()
{
    CCWebHelp.displayTopic("clearcase_web_client");
}

var loginButton = new TableButton("LOGIN_BUTTON_TEXT",
                                  Messages.INFO__LOGIN_BUTTON_TEXT,
                                  function ()
                                  {
                                      submitIfAppletStarted();
                                  },
                                  "submitIfAppletStarted()",
                                  false, // enable it when the applet starts
                                  document);

function
buildLoginContent()
{
    var login_message;

    if (document.mainform.cmd != null &&
        document.mainform.cmd.value.toLowerCase() == "logout")
    {
        login_message = '<strong>' + Messages.INFO__LOGOUT + '</strong></br>' + Messages.INFO__INSTRUCTIONS;
        document.mainform.cmd.value = "";
    }
    else
        login_message = Messages.INFO__INSTRUCTIONS;

    var s = '<img src="' + baseImageURL + 'shim.gif" width="1" height="120" alt="' + Messages.INFO__ALT_IMAGE + '" />'
          + '<table width="355" border="0" cellspacing="0" cellpadding="0" align="center" class="dialogueboxbg" summary="">'
          +   '<tr>'
          +     '<td class="bgwhite"><img src="' + baseImageURL + 'shim.gif" width="1" height="1" alt="' + Messages.INFO__ALT_IMAGE + '" /></td>'
          +     '<td class="bgwhite"><img src="' + baseImageURL + 'shim.gif" width="7" height="1" alt="' + Messages.INFO__ALT_IMAGE + '" /></td>'
          +     '<td class="bgwhite"><img src="' + baseImageURL + 'shim.gif" width="346" height="1" alt="' + Messages.INFO__ALT_IMAGE + '" /></td>'
          +     '<td class="bgwhite"><img src="' + baseImageURL + 'shim.gif" width="1" height="1" alt="' + Messages.INFO__ALT_IMAGE + '" /></td>'
          +   '</tr>'
          +   '<tr>' 
          +     '<td colspan="3" class="dialogueboxborder"><img src="' + baseImageURL + 'shim.gif" width="1" height="1" alt="' + Messages.INFO__ALT_IMAGE + '" /></td>'
          +     '<td rowspan="8" class="dialogueboxborder"><img src="' + baseImageURL + 'shim.gif" width="1" height="1" alt="' + Messages.INFO__ALT_IMAGE + '" /></td>'
          +   '</tr>'
          +   '<tr>'
          +     '<td rowspan="6" class="dialogueboxborder"><img src="' + baseImageURL + 'shim.gif" width="1" height="1" alt="' + Messages.INFO__ALT_IMAGE + '" /></td>'
          +     '<td colspan="2" class="dialogueboxhighlight"><img src="' + baseImageURL + 'shim.gif" width="1" height="1" alt="' + Messages.INFO__ALT_IMAGE + '" /></td>'
          +   '</tr>'
          +   '<tr>' 
          +     '<td colspan="2" height="24" align="center">' + login_message
          +     '</td>'
          +   '</tr>'
          +   '<tr>'
          +     '<td><img src="' + baseImageURL + 'shim.gif" width="1" height="1" alt="' + Messages.INFO__ALT_IMAGE + '" /></td>'
          +     '<td>'
          +       '<table width="346" border="0" cellspacing="0" cellpadding="0" summary="">'
          +         '<tr>'
          +           '<td><img src="' + baseImageURL + 'shim.gif" width="1" height="1" alt="' + Messages.INFO__ALT_IMAGE + '" /></td>'
          +           '<td><img src="' + baseImageURL + 'shim.gif" width="1" height="1" alt="' + Messages.INFO__ALT_IMAGE + '" /></td>'
          +           '<td><img src="' + baseImageURL + 'shim.gif" width="177" height="1" alt="' + Messages.INFO__ALT_IMAGE + '" /></td>'
          +           '<td><img src="' + baseImageURL + 'shim.gif" width="1" height="1" alt="' + Messages.INFO__ALT_IMAGE + '" /></td>'
          +           '<td><img src="' + baseImageURL + 'shim.gif" width="1" height="1" alt="' + Messages.INFO__ALT_IMAGE + '" /></td>'
          +           '<td><img src="' + baseImageURL + 'shim.gif" width="10" height="1" alt="' + Messages.INFO__ALT_IMAGE + '" /></td>'
          +           '<td><img src="' + baseImageURL + 'shim.gif" width="140" height="1" alt="' + Messages.INFO__ALT_IMAGE + '" /></td>'
          +           '<td><img src="' + baseImageURL + 'shim.gif" width="1" height="1" alt="' + Messages.INFO__ALT_IMAGE + '" /></td>'
          +           '<td><img src="' + baseImageURL + 'shim.gif" width="1" height="1" alt="' + Messages.INFO__ALT_IMAGE + '" /></td>'
          +           '<td><img src="' + baseImageURL + 'shim.gif" width="13" height="1" alt="' + Messages.INFO__ALT_IMAGE + '" /></td>'
          +         '</tr>'
          +         '<tr>'
          +           '<td rowspan="10" class="dialogueboxhighlight"><img src="' + baseImageURL + 'shim.gif" width="1" height="1" alt="' + Messages.INFO__ALT_IMAGE + '" /></td>'
          +           '<td rowspan="9" class="dialgbxshadow2"><img src="' + baseImageURL + 'shim.gif" width="1" height="1" alt="' + Messages.INFO__ALT_IMAGE + '" /></td>'
          +           '<td class="dialgbxshadow2"><img src="' + baseImageURL + 'shim.gif" width="1" height="1" alt="' + Messages.INFO__ALT_IMAGE + '" /></td>'
          +           '<td rowspan="9" class="dialgbxshadow2"><img src="' + baseImageURL + 'shim.gif" width="1" height="1" alt="' + Messages.INFO__ALT_IMAGE + '" /></td>'
          +           '<td rowspan="10" class="dialogueboxhighlight"><img src="' + baseImageURL + 'shim.gif" width="1" height="1" alt="' + Messages.INFO__ALT_IMAGE + '" /></td>'
          +           '<td colspan="5" class="dialgbxshadow2"><img src="' + baseImageURL + 'shim.gif" width="1" height="1" alt="' + Messages.INFO__ALT_IMAGE + '" /></td>'
          +         '</tr>'
          +         '<tr>' 
          +           '<td class="dialogueboxhighlight"><img src="' + baseImageURL + 'shim.gif" width="1" height="1" alt="' + Messages.INFO__ALT_IMAGE + '" /></td>'
          +           '<td colspan="5" class="dialogueboxhighlight"><img src="' + baseImageURL + 'shim.gif" width="1" height="1" alt="' + Messages.INFO__ALT_IMAGE + '" /></td>'
          +         '</tr>'
          +         '<tr>' 
          +           '<td rowspan="6" class="bgwhite" valign="bottom" align="center"><img src="' + baseImageURL + 'abs_welcome_message_sr3.jpg" width="177" height="198" alt="' + Messages.INFO__LOGO_TOOLTIP + '" border="0" />'   // abs modify
          +           '</td>'
          +         '</tr>'
          +         '<tr> '
          +           '<td height="40">&#160;</td>'
          +           '<td valign="top">' + Messages.INFO__SITE_LABEL + '&#058;<BR />'
          +             '<span class="bold">' + serverName
          +             '</span>'
          +           '</td>'
          +           '<td class="dialgbxshadow2" rowspan="5"><img src="' + baseImageURL + 'shim.gif" width="1" height="1" alt="' + Messages.INFO__ALT_IMAGE + '" /></td>'
          +           '<td class="dialogueboxhighlight" rowspan="5"><img src="' + baseImageURL + 'shim.gif" width="1" height="1" alt="' + Messages.INFO__ALT_IMAGE + '" /></td>'
          +           '<td rowspan="5" class="dialogueboxbg2" align="center"><img src="' + baseImageURL + 'logo_rational_text.gif" width="11" height="173" alt="' + Messages.INFO__RATLTEXT_TOOLTIP + '&#174;" /></td>'
          +         '</tr>'
          +         '<tr>'
          +           '<td height="40">&#160;</td>'
          +           '<td valign="top">' + Messages.INFO__USER_LABEL + '&#058;<BR />'
          +             '<input type="text" name="user" size="10" maxlength="20" '
          +             '       onKeyDown="return onKeyDown(event)"'
          +             '       value="' + userName + '">'
          +           '</td>'
          +         '</tr>'
          +         '<tr>'
          +           '<td height="40">&#160;</td>'
          +           '<td valign="top">' + Messages.INFO__PASSWORD_LABEL + '&#058;<BR />'
          +             '<input type="password" name="password" size="10" onKeyDown="return onKeyDown(event)">'
          +           '</td>'
          +         '</tr>';
    if (serverPlatform == "Windows") {
        s +=        '<tr>'
          +           '<td height="40">&#160;</td>'
          +           '<td valign="top">' + Messages.INFO__DOMAIN_LABEL + '&#058;<BR />'
          +             '<input type="text" name="domain" size="10" value="' + domain + '"'
          +               ' onKeyDown="return onKeyDown(event)">'
          +           '</td>'
          +         '</tr>';
    } else {
        s +=        '<tr>'
          +           '<td height="40">&#160;</td>'
          +           '<td> </td>'
          +         '</tr>';
    }
    s +=         '<tr>'
       +           '<td height="40">&#160;</td>'
       +           '<td>';

    s += loginButton.generateHTML();

    s +=           '</td>';
    s +=         '</tr>'
       +         '<tr>' 
       +            '<td colspan="3" class="dialogueboxhighlight"><img src="' + baseImageURL + 'shim.gif" width="1" height="1" alt="' + Messages.INFO__ALT_IMAGE + '" /></td>'
       +           '<td colspan="5" class="dialogueboxhighlight"><img src="' + baseImageURL + 'shim.gif" width="1" height="1" alt="' + Messages.INFO__ALT_IMAGE + '" /></td>'
       +         '</tr>'
       +       '</table>'
       +     '</td>'
       +   '</tr>'
       +   '<tr>'
       +    '<td colspan="2" align="center" height="35"><img src="' + baseImageURL + 'shim.gif" width="1" height="35" alt="' + Messages.INFO__ALT_IMAGE + '" /></td>'
       +   '</tr>'
       +   '<tr>'
       +     '<td colspan="2" class="dialogueboxMedium"><img src="' + baseImageURL + 'shim.gif" width="1" height="1" alt="' + Messages.INFO__ALT_IMAGE + '" /></td>'
       +   '</tr>'
       +   '<tr>'
       +     '<td colspan="2" class="dialogueboxborder"><img src="' + baseImageURL + 'shim.gif" width="1" height="1" alt="' + Messages.INFO__ALT_IMAGE + '" /></td>'
       +   '</tr>'
       + '</table>'
       + '<input type="hidden" name="ie_jvm" value="">'
       + '<p>&#160;</p>'
       + '<p class="copyright" align="center">' + Messages.INFO__COPYRIGHT
       +   '<a id="IDLINK__ABOUT_RATIONAL" href="http://www.rational.com" target="_blank" class="copyright">' + Messages.INFO__ABOUT_RATIONAL + '</a>' + Messages.INFO__PERIOD + '</p>'

       // abs modify - add start

       ;

     s += '<p class="copyright" align="center">' + 'Copyright  2002 A Better Solution, Inc. All Rights Reserved. '
       +   '<a id="IDLINK__ABOUT_ABS" href="http://www.abs-consulting.com" target="_blank" class="copyright">' + 'About A Better Solution, Inc.</a></p>'

       // abs modify - add start

       + '<p>&#160;</p>';

    return s;
}

function
setFocus()
{
    // Focus on the appropriate field.
    //
    if (document.mainform.user.value == '')
        document.mainform.user.focus();
    else
        document.mainform.password.focus();
}

function
onLoad()
{
    setFocus();

    // Bind the Enter key for NN4.
    //
    if (Browser.isNN4) {
        // This is necessary in NN4 to capture keydown events.  The TEXT object
        // cannot handle key events, so the document must do so.
        //
        document.captureEvents(Event.KEYDOWN);
        document.onkeydown = top.onKeyDown;
    }

    waitUntilAppletStarted();
}

var appletStarted = false;
var jvmVendor = null;
var jvmVersion = null;
function
onAppletStarted(
    vendor,
    version
)
{
    jvmVendor = vendor;
    jvmVersion = version;
    appletStarted = true;

    // Schedule the setting of focus for after the applet start()
    // method has run.
    //
    setTimeout("setFocus();", 500);
}

function
warnJavaNotStarted()
{
    if (window.confirm(Messages.ERR__JAVA_NOT_STARTED)) {
        document.location = "/Java_Plugins";
    }
}

var waitCount = 0;
var maxWaitCount = 60; // 60 seconds max wait for applet to start
function
waitUntilAppletStarted()
{
    if (!navigator.javaEnabled()) {
       alert(Messages.ERR__JAVA_NOT_ENABLED);
       return;
    }

    if (!appletStarted) {
        ++waitCount;

        // If we have waited long enough, conclude that Java is not
        // operating due to lack of a JRE plugin.
        //
        if (waitCount == maxWaitCount)
            warnJavaNotStarted();

        // Keep waiting.
        //
        setTimeout("waitUntilAppletStarted()", 1000);
        return;
    }

    loginButton.enable();

    // If the browser is IE, record the name of the JVM in use in a
    // cookie so the server code can know what kind of tags to use to
    // imbed signed applets. We also record the name in a request
    // parameter, in case cookies are or become disabled.
    //
    if (Browser.isIE) {
        var jvmShortName = "unknown";

        if (0 <= jvmVendor.indexOf("Sun Microsystems"))
            jvmShortName = "Sun";
        if (0 <= jvmVendor.indexOf("Microsoft"))
            jvmShortName = "Microsoft";

       document.mainform.ie_jvm.value = jvmShortName;
    }
        
    // Check that if the Sun JVM is in use, it is at least 1.4.0.
    //
    if (0 <= jvmVendor.indexOf("Sun Microsystems")) {
        var majorVer = jvmVersion.substr(0, 3);
        if ((majorVer == "1.1")
            || 
            (majorVer == "1.2")
            || 
            (majorVer == "1.3")) {
            if (window.confirm(Messages.ERR__OLD_SUN_JVM)) {
                document.location = "/Java_Plugins";
            }
        }
    }
}

function
submitIfAppletStarted()
{
    if (!navigator.javaEnabled()) {
       alert(Messages.ERR__JAVA_NOT_ENABLED);
       return;
    }

    if (!appletStarted) {
        if (waitCount < maxWaitCount) {
            alert(Messages.ERR__WAITING_FOR_JAVA);
            return;
        }
        else {
            warnJavaNotStarted();
            return;
        }
    }

    storeLoginInfoInCookies();
    document.mainform.submit();
}

function
storeLoginInfoInCookies()
{
   if (navigator.cookieEnabled) {

       // Compute cookie path.
       //
       var components = baseImageURL.split("/");
       var path = "/" + components[1] + "/";

       // Compute cookie expiration.
       //
       var nextYear = new Date();
       nextYear.setFullYear(nextYear.getFullYear() + 1)
       var expiration = nextYear.toGMTString();
       
       if (0 != document.mainform.user.value.length) {
           document.cookie =
               "user=" + document.mainform.user.value
               + "; path=" + path
               + "; expires=" + expiration;
       }
           
       if ((null != document.mainform.domain)
           &&
           (0 != document.mainform.domain.value)) {
           
           document.cookie =
               "domain=" + document.mainform.domain.value
               + "; path=" + path
               + "; expires=" + expiration;
       }
   }
}

function
onKeyDown(
    e
)
{
    if (Browser.isIE && e.keyCode == 13) {
        e.returnValue = false;
        submitIfAppletStarted();
        return false;
    }
    if (Browser.isMozillaBased && e.keyCode == 13) {
        submitIfAppletStarted();
        return false;
    }
    else if (Browser.isNN4 && e.which == 13) {
        submitIfAppletStarted();
        return false;
    }
    return true;
}
// -->
</script>
</head>

<body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0" bgcolor="#ffffff" onload="onLoad()">

<!-- We deliberately do not use the "-applet" macro here because the
code is by necessity not signed.
// -->
<applet code="JVMSnifferApplet.class"
        codebase=
        -quote -url applets ""
        width="0"
        height="0"
        name="jvmSnifferApplet"
        id="jvmSnifferApplet"
        MAYSCRIPT
>
</applet>


<form name="mainform" method="POST" enctype="multipart/form-data">

-request

<script language="JavaScript">
<!--
    // Do not show Logout button on login page
    noLogout = true;

    var html_str = buildHtmlErrorText(browserCheck)
                   + buildLoginContent();
    document.write(html_str);
    document.close();
// -->
</script>
<noscript>
  <strong>
    Error:  Your browser does not have JavaScript enabled.  Please enable JavaScript and 
    refresh this page in order to access ClearCase Web.
  </strong>
</noscript>

</form>

-endpage

</body>
</html>
