var OnFailure;

function WriteForm(OnFailureForm){
var TheForm;
	OnFailure = OnFailureForm;
	TheForm = '<div id="SkillportLogin"><table width="474" border="0" cellspacing="1" cellpadding="5">';
	TheForm = TheForm+'<tr><td width="150" valign="top" bgcolor="8DB0D7"><font color="#FFFFFF" size="1" face="Verdana, Arial, Helvetica, sans-serif">Enable Web Accessibility:</font></td><td bgcolor="e5e5e5"><input type="checkbox" name="WebAccess" id="WebAccess" value="1" checked></td></tr>';
	TheForm = TheForm+'<tr><td width="150" valign="top" bgcolor="8DB0D7"><font color="#FFFFFF" size="1" face="Verdana, Arial, Helvetica, sans-serif">User Name:</font></td><td bgcolor="e5e5e5"><input type="text" name="SkillName" id="SkillName" size="20" value=""></td></tr>';
	TheForm = TheForm+'<tr><td width="150" valign="top" bgcolor="8DB0D7"><font color="#FFFFFF" size="1" face="Verdana, Arial, Helvetica, sans-serif">Password:</font></td><td bgcolor="e5e5e5"><input type="password" name="SkillPassword" id="SkillPassword" size="20" value=""></td></tr>';
	TheForm = TheForm+'<tr><td width="150" valign="top" bgcolor="8DB0D7"><font color="#FFFFFF" size="1" face="Verdana, Arial, Helvetica, sans-serif">Login & Continue:</font></td><td bgcolor="e5e5e5"><input type="submit" value="Login" name="B1" onclick="Redirect();"></td></tr>';
	TheForm = TheForm+'</table></div>'
	
	document.write(TheForm);
}

function Redirect() {
var login;
var x508;
var SkillName=document.getElementById('SkillName').value;
var SkillPassword=document.getElementById('SkillPassword').value;
	if (document.getElementById('WebAccess').checked) {
		x508 = 1;
	} else if (!document.getElementById('WebAccess').checked) {
		x508 = 0;
	}
	login='http://cbtdirect.skillport.com/skillportfe/bcs/bypasslogin.cfm';
	login=login+'?userName='+SkillName+'&password='+SkillPassword;
	login=login+'&Onfailure='+OnFailure;
	login=login+'&x508='+x508;
	login=login+'&Restype=0';

	window.open(login);
	return false;
}
