
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Pragma" content="no-cache" />
<title>Citrix Login</title>

<link rel="stylesheet" href="/admin_ui/common/css/ns/ui.css" type="text/css">
<script type="text/javascript" src="/admin_ui/common/js/jquery/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="/admin_ui/common/js/jquery/jquery.keyfilter-1.7.min.js"></script>
<style type="text/css">
.ns_alert_text a:hover
{
    color: #0000FF !important;
}
</style>
<!--[if IE]>
<style type="text/css">
.login_combo
{
    width: 83%;
}

.login_button_cell
{
    padding-right: 31px;
}
</style>
<![endif]-->
<script language="JavaScript" type="text/javascript">
var display_flag = "block";
if(!document.all)
    display_flag = "table-row";

function checkform ( form )
{
  //getTimezoneOffset() will return (GMT - client) minutes. We need (client - GMT) seconds
  document.form1.timezone_offset.value = new Date().getTimezoneOffset() * -60;

  if (form.username.value == "") {
    show_error("Please enter user name", form.username);
    return false ;
  }
  if (form.password.value == "") {
    show_error("Please enter password", form.password);
    return false ;
  }
  var timeout = form.timeout.value;
  if(timeout <= 0)
  {
        show_error("Please enter positive value for timeout.", form.timeout, true);
        return false ;
  }
  var strtime = timeout + "";
  if(!strtime.match(/^[\d]+$/))
  {
        show_error("Please enter numeric value for timeout.", form.timeout, true);
        return false ;
  }

  var unit = form.unit.options[form.unit.selectedIndex].value;
  if(unit == "Minutes")
  {
      if(timeout < 15)
      {
        show_error("Minimum timeout is 15 minutes.", form.timeout, true);
        return false ;
      }
      else if(timeout > 1666666)
      {
        show_error("Maximum timeout is 1,666,666 minutes.", form.timeout, true);
        return false ;
      }
  }
  else if (unit == "Hours")
  {
      if(timeout > 27777)
      {
        show_error("Maximum timeout is 27,777 hours.", form.timeout, true);
        return false ;
      }
  }
  else if(unit == "Days")
  {
      if(timeout > 1157)
      {
        show_error("Maximum timeout is 1,157 days.", form.timeout, true);
        return false ;
      }
  }

  return true ;
}

function checkHTTP() {
    if(location.protocol == "http:")
    {
        return  "To use Secure HTTPS <a href=javascript:redirectToHTTPS() class=\"ns_login_link\">Click here</a>";
    }
    else
    {
        $('.ns_login_secure').hide();
        return "";
    }

}

function redirectToHTTPS() {
    location.href = location.href.replace("http", "https");
}

function key_pressed(e)
{
    var keynum;
    if(window.event) // IE
        keynum = e.keyCode;
    else if(e.which) // Netscape/Firefox/Opera
        keynum = e.which;

    if(keynum == 13) //Enter key
        submit_form();

    return true;
}

function submit_form()
{
    if(checkform(document.form1))
        document.form1.submit();
}

function show_hide_options()
{

    var show_hide_options_link = document.getElementById("show_hide_options_link");
    var flag;
    if(!$("#ns_login_options").is(':hidden'))
    {
        flag = "none";
        show_hide_options_link.title = show_hide_options_link.title.replace(/Hide/, "Show");
        show_hide_options_link.innerHTML = show_hide_options_link.innerHTML.replace(/Hide/, "Show");
	$("#show_hide_options_link").removeClass("hide_option").addClass("show_option");
	if(isSafari())
	    $("#ns_login_options").hide();
	else
	    $("#ns_login_options").slideUp();
    }
    else
    {
        flag = display_flag;
        show_hide_options_link.title = show_hide_options_link.title.replace(/Show/, "Hide");
        show_hide_options_link.innerHTML = show_hide_options_link.innerHTML.replace(/Show/, "Hide");
	$("#show_hide_options_link").removeClass("show_option").addClass("hide_option");
	if(isSafari())
	    $("#ns_login_options").show();
	else
	    $("#ns_login_options").slideDown();
    }

    document.getElementById("ns_login_secure_top").style.display = flag;
}

function is_options_shown()
{
    var startin_row = document.getElementById("ns_login_options");
    return (!startin_row.style || startin_row.style.display == "" || startin_row.style.display == display_flag);
}

function show_error(message, element, expand_options)
{
    if(expand_options && !is_options_shown())
        show_hide_options();
    element.focus();
    alert(message);
}

// Mapping used by decodeXml
var escaped_one_to_xml_special_map = {
    '&amp;': '&',
    '&quot;': '"',
    '&lt;': '<',
    '&gt;': '>',
    "&#039;": "'"
};

// To decode the strings which are encoded using php function htmlspecialchars in the backend
function decodeXml(string) {
    return string.replace(/(&quot;|&#039;|&lt;|&gt;|&amp;)/g,
        function(str, item) {
            return escaped_one_to_xml_special_map[item];
    });
}

function isSafari() {
  return /Safari/.test(navigator.userAgent) && /Apple Computer/.test(navigator.vendor);
}

function getSupportedVersionString() {

	try
    {
		var display_string = "Best viewed in IE8+, Firefox 3.6.25+, Chrome v19+ or Safari 5.1.1+(for Mac)";
		var nAgt = navigator.userAgent;
		var browserName  = navigator.appName;
		var fullVersion  = ''+parseFloat(navigator.appVersion); 
		var majorVersion = parseInt(navigator.appVersion,10);
		var nameOffset,verOffset,ix;
		var vendor = null;
		if(navigator.vendor != null)
			vendor = navigator.vendor.toLowerCase();

		// In MSIE, the true version is after "MSIE" in userAgent
		if ((verOffset=nAgt.indexOf("MSIE"))!=-1 && (nAgt.indexOf('opera') == -1) && (nAgt.indexOf('webtv') == -1)) {
		 browserName = "MSIE";
		 fullVersion = nAgt.substring(verOffset+5);
		}
		// In Chrome, the true version is after "Chrome" 
		else if ((verOffset=nAgt.indexOf("Chrome"))!=-1) {
		 browserName = "Chrome";
		 fullVersion = nAgt.substring(verOffset+7);
		}
		// In Safari, the true version is after "Safari" or after "Version" 
		else if ((verOffset=nAgt.indexOf("Safari"))!=-1) {
		 browserName = "Safari";
		 fullVersion = nAgt.substring(verOffset+7);
		 if ((verOffset=nAgt.indexOf("Version"))!=-1) 
		   fullVersion = nAgt.substring(verOffset+8);
		}
		// In Firefox, the true version is after "Firefox" 
		else if ((verOffset=nAgt.indexOf("Firefox"))!=-1) {
		 browserName = "Firefox";
		 fullVersion = nAgt.substring(verOffset+8);
		}
		// If you can't detect the browser, return the not-supported warning string
		else 
		{
			return display_string;
		}
		// trim the fullVersion string at semicolon/space if present
		if ((ix=fullVersion.indexOf(";"))!=-1)
		   fullVersion=fullVersion.substring(0,ix);
		if ((ix=fullVersion.indexOf(" "))!=-1)
		   fullVersion=fullVersion.substring(0,ix);

		majorVersion = parseInt(''+fullVersion,10);
		if (isNaN(majorVersion)) {
		 fullVersion  = ''+parseFloat(navigator.appVersion); 
		 majorVersion = parseInt(navigator.appVersion,10);
		}
		if( (browserName == "MSIE" && compareFullVersion(fullVersion, "8")) || //IE
			(browserName == "Firefox" && compareFullVersion(fullVersion, "3.6.25"))|| //Firefox
			(browserName == "Chrome" && compareFullVersion(fullVersion, "19")  && vendor != null && vendor.indexOf('google') != -1) || //chrome
			(browserName == "Safari" && compareFullVersion(fullVersion, "5.1.1") && vendor != null && vendor.indexOf('apple') != -1)
																					 && nAgt.toLowerCase().indexOf('mac') != -1) //Safari for mac
			return "";
		else
			return display_string;
	}
	catch(err)
    {
		return "";
	}
}

function compareFullVersion(a, b) //if a>b, return true, else return false
{
    
	if (a === b)
    {
       return true;
    }

    var a_components = a.split(".");
    var b_components = b.split(".");

    var len = Math.min(a_components.length, b_components.length);

    // loop while the components are equal
    for (var i = 0; i < len; i++)
    {
        // A bigger than B
        var val_a = parseInt(a_components[i]);
		var val_b = parseInt(b_components[i]);
		if(isNaN(val_a) || isNaN(val_b))
		 return false;
		if (parseInt(a_components[i]) > parseInt(b_components[i]))
        {
            return true;
        }

        // B bigger than A
        if (parseInt(a_components[i]) < parseInt(b_components[i]))
        {
            return false;
        }
    }

    // If one's a prefix of the other, the longer one is greater.
    if (a_components.length >= b_components.length)
    {
        return true;
    }

    return false;
}

</script>
</head>
<body class="ns_login_body">
<noscript>
    <div class="center_panel ns_alert_text">
        JavaScript is either disabled in or not supported by the Web browser. To continue logon, use a Web browser that supports JavaScript or enable JavaScript in your current browser.
    </div>
    <div style="display: none">
</noscript>
<div class="ns_login_wrapper">
	<div class="ns_login_top"></div>
	<div class="ns_login_center">
	    <div class="ns_login_center_content">
		<table align="center" border="0" height="100%">
			<tr>
				<td valign="center" height="100%">
				<table  align="center" width="600"  border="0">

				<tr>
					<td valign="bottom" height="50%" width="210" class=ns_login_logo>
                       <table width="100%" border="0" height="100%" >

							<tr>
							<td valign="bottom" height="50%">
								<div id="ns_login_secure_top" class="ns_login_secure_height"></div>
								<div class="ns_login_secure">
									 <script language="JavaScript" type="text/javascript">
										document.writeln(checkHTTP());
									 </script>
								</div>
							</td>
							</tr>
						</table>
					</td>
					<td algin="left" valign="top" >
						<form name="form1" action="/login/do_login" method="post" autocomplete="off" onsubmit="return checkform(this);" >
							<table  align="top" width="330px" border="0">
								  <tr >
									<td class="ns_login_header">
										<b>Login</b></td>
								  </tr>
								  <tr>
									<td class="ns_grid_text"><label>User Name</label>
									<span class="ns_active">|</span><input type="text" id="username" name="username" class="login_input" onfocus=1></td>
								  </tr>
								  <tr>
									<td class="ns_grid_text"><label>Password</label>
																		<span class="ns_active">|</span><input type="password" name="password" class="login_input">
									</td>
								  </tr>
							</table>
							<div id="ns_login_options" style="display:none;">
							<table  align="top" width="330px" border="0" >
							    <tr>
								    <td class="ns_grid_text">
									   <label>Start in</label>
									   <span class="ns_active">|</span>
									   <select name="startin" id="appid" size="1" class="login_combo" onkeypress="return key_pressed(event)">
										   <option value="def" selected>Default</option> 
 <option value="st">Dashboard</option> 
 <option value="neo">Configuration</option> 
 <option value="rep">Reporting</option> 
 <option value="doc">Documentation</option> 
 <option value="dw">Downloads</option> 
									   </select>
								   </td>
							     </tr>
							     <tr>
                                   <td class="ns_grid_text"><label>Timeout</label>
                                   <span class="ns_active">|</span>
                                   <input type="text" value="30" title="This session will be expired after specified timeout in case of no activity." name="timeout" class="login_timeout_input mask-pint">
                                       <select name="unit" class="login_unit_combo" onkeypress="return key_pressed(event)">
                                       <option value="Minutes">Minutes</option>
                                       <option value="Hours">Hours</option>
                                       <option value="Days">Days</option>
									   </select>
								   </td>
							     </tr>
							     <tr>
								  <td class="ns_grid_text"><label>Java Memory</label>
									  <span class="ns_active">|</span>
									  <select name="jvm_memory" class="login_combo" title="Java memory settings" onkeypress="return key_pressed(event)">
										  <option value="system_default" title="Select this option to take Java memory settings from Java control panel.">System default</option>
										  <option value="128M" title="Select this option if your local system memory is 512M">128M</option>
										  <option value="256M" title="Select this option if your local system memory is 1G" selected>256M</option>
										  <option value="512M" title="Select this option if your local system memory is 2G">512M</option>
										  <option value="1024M" title="Select this option if your local system memory is 4G">1024M</option>
									  </select>
								  </td>
							    </tr>
							</table>
							</div>
							<table  align="top" width="330px" border="0">
								  <tr >
									<td><input type="hidden" name="url" value=""></td>
									<td><input type="hidden" name="timezone_offset" value=""></td>
								  </tr>
								  <tr>
									<td class="ns_grid_text">
										<label class="ns_show_hide_label"><a id="show_hide_options_link" href="#noAnchor" class="show_option" onclick="show_hide_options()" title="Show Start in, Timeout and Java Memory Settings" class="ns_login_link">Show Options</a></label>
									</td>
								   </tr>
								   <tr>
									<td align="left" class="login_button_cell">
									  <input type="submit" value="Login" class="login_button" title="Click to login">
									</td>
								  </tr>
								</table>
						</form>
					</td>
				</tr>
			</table>
				</td>
			</tr>
			<tr>
				<td class="ns_grid_text">
					<script language="JavaScript" type="text/javascript">
						document.writeln(getSupportedVersionString());
					</script>
				</td>
			</tr>
		</table>
	    </div>
	</div>
	<div class="ns_login_bottom"></div>
</div>


<script language="JavaScript" type="text/javascript">
//Don't allow this page to be embedded inside a frame
if(self != top)
{
    document.getElementsByTagName("body")[0].style.display = "none";
    top.location = self.location;
}
else
{
    document.form1.timeout.value = '30';;

    var unit_from_cookie = 'Minutes';
    var unitCombo = document.form1.unit;
    for(var i=0; i<unitCombo.length; i++)
    {
        var val = unitCombo.options[i].value;
        if(unit_from_cookie == val)
        {
            unitCombo.selectedIndex = i;
            break;
        }
    }

    var jvm_memory_from_cookie = '256M';
    var jvm_memory_combo = document.form1.jvm_memory;
    for(var i=0; i<jvm_memory_combo.length; i++)
    {
        var val = jvm_memory_combo.options[i].value;
        if(jvm_memory_from_cookie == val)
        {
            jvm_memory_combo.selectedIndex = i;
            break;
        }
    }

    //Here goes the logic to allow bookmarked URLs. If the user tries to access
    //a URL directly without logging in, show the login page, let the user login
    //and automatically take him to the URL provided by him. If not, take the user
    //to the app selected.
    //Bookmarks won't work online help, doc file links & download file links
    var startupapp_from_cookie = 'def';
    var startin = document.form1.startin;
    var url = location.href;

    var url_match = location.pathname.match(/^\/guiapplet.html|pcidss.*/);
    if (url_match)
    {
        url = "/menu/neo";
    }
    /*
        Order of preference for choosing the startup page
           * Explicit mentioned URL
           * Startup cookie
     */
    for(var i=0; i<startin.length; i++)
    {
        var val = startin.options[i].value;
        //Match /menu/st but not /menu/stc
        var rg = new RegExp("/menu/" + val + "(?![a-z])", "");
        if(url.match(rg))
        {
            startin.selectedIndex = i;
            document.form1.url.value = url.substring(url.indexOf("/menu/"+val));
            break;
        }
        if(startupapp_from_cookie.match(val))
            startin.selectedIndex = i;
    }
        document.form1.username.focus();
}


function input_hints() {
	var inputs = document.getElementsByTagName("input");
	for (var i=0; i<inputs.length; i++){
		if (inputs[i].parentNode.getElementsByTagName("span")[0]) {
				inputs[i].onfocus = function () {
				this.parentNode.getElementsByTagName("span")[0].className= "ns_active ns_active_color";
			}
			inputs[i].onblur = function () {
			this.parentNode.getElementsByTagName("span")[0].className= "ns_active";
			}
		}
	}

	var selects = document.getElementsByTagName("select");
	for (var k=0; k<selects.length; k++){
		if (selects[k].parentNode.getElementsByTagName("span")[0]) {
			selects[k].onfocus = function () {
				this.parentNode.getElementsByTagName("span")[0].className= "ns_active ns_active_color";
			}
			selects[k].onblur = function () {
				this.parentNode.getElementsByTagName("span")[0].className= "ns_active";
			}
		}
	}
}

function set_focus(){
	$("#username").focus();
}
$(document).ready(function(){
   input_hints();
   set_focus();
 });


</script>

</body>
</html>
