//*********************************************
// CWA Toolkit Configuration
// Version 1.0
// Added By: Kavitha
// On : 29-Aug-2005
// Reason: CWA-HPG Implementation
//*********************************************


// CWA Server URL
var cwaserver = "https://www51.honeywell.com/cwa";
var changepwdlink = "https://www.honeywell.com/secure/pm/change_questions.jsp?sync=yes";
var resetpwdlink = "https://www.honeywell.com/secure/pm/index.jsp?action=change";
var profilelink = "/userUpdate.do";
var appalive = '0';


// Legacy Login Box Form Variables
// *********************************************
// Form Name
var f_formname = "hpglogin";
// User Name Field Name
var f_username = "username";
// Password Field Name
var f_pwd = "password";
// 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>');
}


// Standrad 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.hpglogin.action="/servlet/com.honeywell.cwa.hpg.LoginConfirmMigrationServlet";
	document.hpglogin.submit();	
}

