//*********************************************
// CWA Toolkit Configuration
// Version 1.4
//*********************************************

// CWA & Related Application URLs
// Modification starts here for HQC#126 by kamal
//var cwaserver = "https://www51.honeywell.com/cwa";

var cwaserver = "https://cwa.honeywell.com";

// Modification ends here for HQC#126 by kamal
var changepwdlink = "https://www.honeywell.com/secure/pm/change_questions.jsp?sync=yes";

var resetpwdlink = "https://www.honeywell.com/secure/pm/pwd_step1.jsp?action=forgot";

var profilelink = "/userUpdate.do";
var appalive = '0';

// Legacy Login Box Form Variables
// *********************************************
// Form Name
//var f_formname = "myform";
// User Name Field Name
//var f_username = "txt_user";
// Password Field Name
//var f_pwd = "txt_pwd";
// Username and Password Labels
//var lbl_username="User Name";
//var lbl_password="Password";

var f_formname = "frmlogin";
// User Name Field Name
var f_username = "UserID";
// Password Field Name
var f_pwd = "msgDigest";
// Username and Password Labels
var lbl_username="User Name";
var lbl_password="Password";

// *********************************************

// Error box in case CWA application server is down
function painterror()
{
	document.write('<style>.uierrborder {background-color : #666666;}.errlogin {background-color : #dce8f5;}.uierrbg {background-color : #2e6099;}.uierrwhiteb {font: 11px tahoma, verdana, helvetica, sans-serif; font-weight: bold; color:#ffffff;} .uierrtext{font: 12px arial, verdana, helvetica, sans-serif; font-weight: bold; color:red;}</style></script>');
	document.write('<TABLE BORDER="0" CELLPADDING="1" CELLSPACING="0" class="uierrborder">');
	document.write('<TR><TD>');
	document.write('<TABLE BORDER="0" CELLPADDING="3" CELLSPACING="0" width="100%" class="errlogin">');
	document.write('<TR class="uierrbg">');
	document.write('<TD class="uierrwhiteb">Sign In</TD>');
	document.write('</TR><TR>');
	document.write('<TD class="uierrtext">The Honeywell ID system is currently unavailable. <br><br> We apologize for any inconvenience.</TD>');
	document.write('</TR></TABLE></TD></TR></TABLE>');
}

// Include HID Server Stats Page
function includestats()
{
	document.write('<script src="'+cwaserver+'/admin/hidstats.jsp"><\/script>');
}

// Standard UI Login Box
function paintloginui(sappid,hidstats) 
{
	if (hidstats == '1')
	{
		document.write('<LINK href="'+cwaserver+'/styles/honidlogin.css" type=text/css rel=stylesheet>');
		document.write('<script language=javascript src="'+cwaserver+'/loginui.do?appid='+sappid+'"><\/script>');
	}else{
		painterror();
	}
}

// UI Login Box for Registration Pages
function paintloginui_4reg(sappid,hidstats) 
{
	if (hidstats == '1')
	{
	document.write('<LINK href="'+cwaserver+'/styles/honidlogin.css" type=text/css rel=stylesheet>');
	document.write('<script language=javascript src="'+cwaserver+'/loginui.do?appid='+sappid+'&4reg=y"><\/script>');
	}else{
		painterror();
	}
}

// Forgot Password Link
function launchchangepwd ()
{
	window.open(changepwdlink);
}

// User Profile Management Link
function updateprofile ()
{
	window.open (cwaserver+profilelink);
}

// Reset Password Link
function resetPassword ()
{
	window.open(resetpwdlink);
}
// Launch Honeywell ID Registration Wizard
function startHoneywellIDRegistration(refurl,appid)
{
	window.location.href=""+cwaserver+"/register.do?referer_url="+refurl+"&appid="+appid+"";
}

// Provide implementation to authentication the user against application data source
function doauthenticate () 
{
	document.forms.frmlogin.msgDigest.value=calcMD5(document.forms.frmlogin.msgDigest.value);
	document.forms.frmlogin.action="/servlet/com.honeywell.aes.cwa.HonCWAMigrateServlet";
	document.forms.frmlogin.submit();	
}