//*********************************************
// CWA Toolkit Configuration
// Version 1.6
//*********************************************

// CWA & Related Application URLs
//var cwaserver = "https://qwww51.honeywell.com/cwa";
//var cwaserver = "https://dwww51.honeywell.com/cwa";
var cwaserver = "https://www51.honeywell.com/cwa";

//var changepwdlink = "https://qwww.honeywell.com/secure/pm/change_questions.jsp?sync=yes";
//var resetpwdlink = "https://qwww.honeywell.com/secure/pm/pwd_step1.jsp?action=forgot";
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';

// Application ID
// Dev appid
//var cwaAppId = 2419;

// Prod appid
var cwaAppId = 1216;

// QA appid
//var cwaAppId = 31049; 

// Legacy Login Box Form Variables
// *********************************************
// Form Name
var f_formname = "loginform";
// User Name Field Name
var f_username = "txt_user";
// Password Field Name
var f_pwd = "txt_pwd";
// Username and Password Labels
var lbl_username="Last Name";
var lbl_password="Email";
// *********************************************

// 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();
	}
}

// UI Login Box with provision to pass customdata
function paintloginui_cd(sappid,hidstats,cdata) 
{
	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+'&custom_data='+cdata+'"><\/script>');
	}else{
		painterror();
	}
}

// Inside Honeywell UI Login Box
function paintloginui_ih(sappid,hidstats) 
{
	if (hidstats == '1')
	{
		document.write('<LINK href="'+cwaserver+'/styles/honidlogin_ih.css" type=text/css rel=stylesheet>');
		document.write('<script language=javascript src="'+cwaserver+'/loginui.do?appid='+sappid+'&type=ih"><\/script>');
	}else{
		painterror();
	}
}

// Inside Honeywell UI Login Box with provision to pass customdata
function paintloginui_ih_cd(sappid,hidstats,cdata) 
{
	if (hidstats == '1')
	{
		document.write('<LINK href="'+cwaserver+'/styles/honidlogin_ih.css" type=text/css rel=stylesheet>');
		document.write('<script language=javascript src="'+cwaserver+'/loginui.do?appid='+sappid+'&type=ih&custom_data='+cdata+'"><\/script>');
	}else{
		painterror();
	}
}

// UI Login Box in PAC WIZARD
function paintloginui_pac(sappid,hidstats) 
{
	if (hidstats == '1')
	{
		document.write('<LINK href="'+cwaserver+'/styles/honidlogin_ih.css" type=text/css rel=stylesheet>');
		document.write('<script language=javascript src="'+cwaserver+'/loginui.do?appid='+sappid+'&type=pac"><\/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.loginform.action = "/shoplogin.asp";
	document.forms.loginform.submit();
}