<html>
<head>
<style type="text/css">
table.login
{
   border:           double 3px;
   border-spacing:   0px;
   empty-cells:      show;
   background-color: #d7d7d7;
   margin:           0px;
   padding:          0px
}

td.logo
{
   width:  470px;
   height: 330px;
   background-color: #FFFFFF;
   background-image: url('images/rbc41UAFloginchannel.jpg');
   background-repeat: no-repeat;
   margin:  0px;
   padding: 0px
}

td.form
{
   margin:  0px;
   padding: 5px
}

td.footlinks
{
   font-family:      Tahoma;
   font-size:        10px;
   vertical-align:   bottom;
   margin:           0px;
   padding:          1px 5px 5px 5px;
}
</style>

<SCRIPT LANGUAGE="JavaScript" type="text/javascript">

   function MM_openBrWindow(theURL,winName,features) //v2.0
   {
     window.open(theURL,winName,features);
   }

   function getCookie(strName)
   {
      return getCookie(strName, "");
   }

   function getCookie(strName, strDefault)
   {
     var Cookie = " "+document.cookie+";";
     strName = strName + '=';
     var strCookie;
     var start = Cookie.lastIndexOf(strName);
     var end;

     if (start!=-1)
     {
        start += strName.length;
        end = Cookie.indexOf(";", start);
        strCookie = unescape(Cookie.substring(start, end));
        strCookie = unescape(strCookie); // make damn sure
        return strCookie;
     }

     return strDefault;
   }

   function getSubCookie(strCookieName, strWholeCookie)
   {
      return getSubCookie(strCookieName, strWholeCookie, "");
   }

   function getSubCookie(strCookieName, strWholeCookie, strDefault)
   {
     strCookieName = strCookieName + '=';
     strWholeCookie = strWholeCookie+'&';
     var strCookie;
     var start = strWholeCookie.indexOf(strCookieName);
     var end;

     if (start!=-1)
     {
        start += strCookieName.length;
        end = strWholeCookie.indexOf("&", start);
        strCookie = unescape(strWholeCookie.substring(start, end));
        strCookie = unescape(strCookie); // make damn sure
        return strCookie;
     }
     return strDefault;

   }

   // Returns true if the string evaluates to true.  A string is true if it is not
   // null and is equal to one of the following, "1", "YES", "TRUE".  The case of
   // the string is not important.
   function IsTrue(str)
   {
      // dbg2("IsTrue(): str='"+str+"'", "c:\\isv.txt");
      // dbg2("IsTrue(): test1="+(str!=null), "c:\\isv.txt");
      if( (str != null) )
      {
         sss = (new String(str)).toUpperCase();
         // dbg2("IsTrue(): test2="+(sss.length > 0), "c:\\isv.txt");
         if(sss.length > 0)
         {
            if(sss.indexOf("1") == 0 ||
               sss.indexOf("YES") == 0 ||
               sss.indexOf("TRUE") == 0)
            {
               // dbg2("IsTrue(): test3=true", "c:\\isv.txt");
               return true;
            }
            // dbg2("IsTrue(): test3=false", "c:\\isv.txt");
         }
      }
      return false;
   }

   var Title = getCookie("FT", "Channel") + getCookie("ServerTitle", "");
   var UseSSL = getCookie("UseSSL", "TRUE");
   var LoginProtocol = IsTrue(UseSSL) ? "https" : "http";

   document.write("<title>"+Title+"</title>");
</SCRIPT>

</head>

<body onload="Load()" onresize="Load()" background="images/watermark.jpg" bgproperties="fixed" vlink="#0000FF">
 <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;


<div align="center">
  <center>

   <table class="login" cellpadding="0" cellspacing="0" hspace="0" width="697" bordercolorlight="#C0C0C0" bordercolordark="#808080" bordercolor="#808080">
   <script>
   var action = LoginProtocol + "://"+window.location.hostname+"/bc/base/bwf.dll?";
   document.write('<form NAME="frmlogin" action="'+action+'" method="post">');
   </script>
      <!-- <form NAME="frmlogin" action="/bc/base/bwf.dll?" method=post> -->

      <!-- 1st row -->
      <tr>
         <td class="logo footlinks" rowspan="4" valign="bottom">
<p style="{text-align: left;">
            <a href="webhelp/system_requirements.htm">System Requirements</a>&nbsp;&nbsp;
            <a href="webhelp/installing_dde.htm">DDE Install</a>&nbsp; </font>
         &nbsp;<a href="http://reuters.articulateglobal.com/Portal/Storage/DownloadDocument.aspx?DocumentID=e9ed33d6-9523-4159-8467-7a1a0d5b893c">Flash Tutorial</a>&nbsp;&nbsp;
            <a href="webhelp/what_s_new.htm">What's New</a>&nbsp;&nbsp;
<a href="http://www.reuters.com">Reuters.com</a> </p>


<p style="{text-align: left;">Version 4.1.2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;


<a href="requirements.html" target="_blank">
            Run System Requirements Check</a>&nbsp;&nbsp;</p>
         </td>

         <td class="form" width="201" height="240" valign="top">

            <p style="{text-align: right}">
            <a href="webhelp/customer_support.htm"><font size="1" face="Tahoma" color="#000080">
            Contact Us
            </font></a>
            </p>

            <INPUT type=hidden name="MfcISAPICommand" value="Login"/>
            <INPUT type=hidden name="token"/>
            <INPUT type=hidden name="url"   value="url"/>

            <font face="Tahoma" size="1" color="#808080">
            <p>
            Enter Your user id and password and click the LOG IN button.
            </p>
            <p>
            Please disable pop-up blocker before logging in.
            </p>
            </font>
            <font face="Tahoma" size="1">User ID:</font><br>
            <font face="Tahoma" size="2"> <input name="user-name" size="19"/></font><br>
            <font face="Tahoma" size="1"><br>Password:</font><br>
            <font face="Tahoma" size="2"><input type="password" name="password" size="19"/></font><br>
            <input type="image" img border="0" src="images/logingif.gif" value="Login" align="absmiddle" onclick="login()" width="44" height="18"/>

         </td>
      </tr>

      <!-- 2nd row -->
      <tr>
         <td class="footlinks" width="201" align="left">
            <font color="#808080">This is a Reuters proprietary system. No use 
			is allowed without proper authorization. Unauthorized use of this 
			product or network resource may constitute a breach of Reuters 
			policy and be liable to prosecution under relevant legislation</font></td>

      </tr>

      <!-- 3rd row -->
      <tr>
         <td class="footlinks" width="201">
            <font face="Tahoma" size="1" color="#808080">
            Java Web Start is an optional way to run Channel.</font><br><input type="checkbox" name="cbJWS"/>
            <font face="Tahoma" size="1">
            Java Web Start
            </font>
         </td>
      </tr>
      </form>
   </table>

  </center>
</div>


<SCRIPT LANGUAGE="JavaScript" type="text/javascript">

   /*
     This method will delete the token data from Cookie so that cookie 
     will be clear of unnecessary token data when login screen is displayed
   */
   function createCookie(name,value,days) {
        // If days are positive then cookie is created.If days are negative then Cookie is deleted.
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}
   /*
     This method will remove the tokens from QueryString of the URL
   */
   function escapeTokens(Temp)
   {
	var tempUrl = Temp.substring(0,Temp.indexOf("?")+1); // Retrieve the QueryString
	//alert("tempUrl ------------->"+tempUrl);
	var tokenFound = "false"; 
	// parse the QueryString params
	var QueryParams = Temp.substring(Temp.indexOf("?")+1).split('&');
	// Array to retrieve the QueryString parameters
	var qsParm = new Array();
        var temporaryUrl = "";
	var modifiedUrl = new Array(QueryParams.length);
	//modifiedUrl[0] = tempUrl;
	// Loop through Query Params
	for (var i=0; i<QueryParams.length; i++)
	{
		// Retrive the position of QueryString Key
		var pos = QueryParams[i].indexOf('=');
		if (pos > 0) 
		{
			//  Retrieve the QueryString param name
			var key = QueryParams[i].substring(0,pos);
			// Check whether the key is Token
			if( key.toLowerCase().match("token"))
			{
				// If the QueryString param name is Token then do not append it to the Modified URL
				var val = QueryParams[i].substring(pos+1);
				if(  i==0)
				{
					modifiedUrl[i] = "";
				}
				else if( i >= 1)
				{
					if( modifiedUrl[i-1].match("undefined"))
					{
						modifiedUrl[i] = "".concat(key,"=",val,"&");
					}
					else
					{
						modifiedUrl[i] = modifiedUrl[i-1];
					}
				}
				//Token is found
				tokenFound = "true";
				createCookie(key,"",-1);
			}
			// QueryString is not Token. SO we need to append this to URL after removing JavaScript 
			else
			{
				var val = QueryParams[i].substring(pos+1);
				var value = val;
				//  Remove the JavaScript from QueryString
				if( val.toLowerCase().indexOf("script") != -1 && val.toLowerCase().indexOf("/script") != -1 )
				{
					value = val.substring(0,val.toLowerCase().indexOf("script")).concat(val.substring(val.toLowerCase().indexOf("/script")+8));
				}
				if(  i==0)
				{
					modifiedUrl[i] = "".concat(key,"=",value,"&");
				}
				else if( i >= 1)
				{
					if( modifiedUrl[i-1].match("undefined"))
					{
						modifiedUrl[i] = "".concat(key,"=",value,"&");
					}
					else
					{
						modifiedUrl[i] = modifiedUrl[i-1].concat(key,"=",value,"&");
					}
				}
				temporaryUrl = modifiedUrl[i];
				//createCookie(key,"",-1);
					
			}
		}
	}
	// Remove the trailing & from URL
	Temp = tempUrl.concat(temporaryUrl);
	//Temp = tempUrl.concat(temporaryUrl);
	// If token was found redirect to the modified URL
	if( tokenFound.match("true"))
	{
	   window.location.href=Temp; 
	}
	    //return Temp;
   }
   function Load()
   {
         // Modifcation to Fix XSS Issue with Token
	 	// If  any tokens are found delete them from Cookie and redirect back to login screen
         escapeTokens(document.URL);
         // Modifcation to Fix XSS Issue with Token
         
     	//code added for testing malicious code

	    var strPos = document.URL;
            var locN = strPos.indexOf("//")+2;
            if (strPos.indexOf("?") != -1)
                     var loc = strPos.substr(strPos.indexOf("/",locN),strPos.indexOf("?"));
            else
                        var loc = strPos.substr(strPos.indexOf("/",locN));
            document.frmlogin.url.value=loc;

	//code added for testing malicious code


      var Cookie = " "+document.cookie+";";
      var bcPlugin = ""+unescape(getCookie("UsePlugin"));
      //alert("VM Vender - "+strVender+" so use plugin is "+bcPlugin);

      var User = ""+unescape(getCookie("BCUSERID"));
      var temp = ""+User;
      if((temp.length>0)&&(temp!="undefined"))
      {
         document.frmlogin.elements[3].value=User;
         document.frmlogin.password.focus();
      }
      else
      {
        document.frmlogin.elements[3].focus();
         //document.frmlogin.user-name.focus();
      }

      document.frmlogin.password.onkeydown=enterPressed;

      temp = "" + unescape(getCookie("JWS"));
      if((temp.length > 0) && (temp == "true"))
         document.frmlogin.elements['cbJWS'].checked=true;
      else
         document.frmlogin.elements['cbJWS'].checked=false;

   }

   function login()
   {
      //Store the userid for six months
      /////////////////////////////////

      var sixMonths = 6*31*24*60*60*1000;
      var expDate = new Date();
      expDate.setTime(expDate.getTime()+sixMonths);
      var strExpireDate = expDate.toGMTString();

      if (window.screen.width > 1023)
        document.cookie="Res=large;expires="+strExpireDate;   // Resolution is changed to Res for Cookie Reduction
      else
        document.cookie="Res=small;expires="+strExpireDate;   // Resolution is changed to Res for Cookie Reduction


      //Use Java script to store the Token as a Tempary cookie.  This was more
      //reliable then doing it through ASP

      var strUser =""+document.frmlogin.elements[3].value;

      if ((strUser != null)&&strUser!="undefined")
      {
         var len = strUser.length;
         if (len>0)
         {
            strUserCookie = "BCUSERID="+strUser+";expires="+strExpireDate;
            document.cookie=strUserCookie;
         }
      }

      var cb = document.frmlogin.elements['cbJWS'];
      if(cb != null)
      {
         var str = "JWS="+""+cb.checked+";expires="+strExpireDate;
         document.cookie=str;
         // alert(document.cookie);
      }


      document.frmlogin.submit();
      return true;
   }

   function enterPressed(e)
   {
      var ch;
      var strBrowser = ""+navigator.appName;

      if (strBrowser.indexOf("Microsoft") == -1)
         ch = e.which;
      else
         ch = event.keyCode;

      if (ch == 13)
         login();
   }
   document.frmlogin.password.onkeydown=enterPressed;

</SCRIPT>

</body>

</html>
