function showlogin(){

var urlPrefix = getUrlPrefix();

document.write('<table border="0" cellspacing="0" cellpadding="0"><tr><td width=5 ></td><td bgcolor="#EEEEEF" width=41></td><td>');

document.write('<table bgcolor="#EEEEEF" border="0" cellspacing="0" cellpadding="0">');
document.write('<tr>');
document.write('<td valign="top">');
document.write('<br>');
document.write('<p class="pageheaders"><strong>JOB APPLICATIONS</strong></p>');
document.write('<p class="pagesubheader"><b>ONLINE APPLICATION</b></p>');
document.write('');

document.write('<table border="0" width=523 cellspacing="2" cellpadding="2"  style="border-collapse: collapse;font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 11px;color: #000000;" >');
document.write('<tr><td>');
document.write('Welcome to PSA Online Application');
document.write('<br><br>');
document.write('If this is your first visit, please create a new application account by entering new User ID and Password below then click the Submit button.');
document.write('<br><br>');
document.write('Please note that:<br>');
document.write('1. User ID must be between 8 to 15 characters long, password must be between 4 to 8 characters long. <br>');
document.write('2. Both User ID and Password are case sensitive<br>');
document.write('3. Password should contain alphanumeric characters (letters, numbers and special characters)<br>');
document.write('4. Cookies should be enabled in your browser. To enable cookies, please <a href="javascript:void(0)" onclick="javascript:window.open(\''+urlPrefix+'/JobApp/images/enablecookies.html\',\'pop\',\'menubar=no,scrollbars=yes,resizable=no,addressbar=no,statusbar=no,width=400,height=500\');" alt="How to Enable Cookies" title="How to Enable Cookies" ><u>click here</u></a>');
document.write('<br>');
document.write('5. The Date and Time Settings on your PC/Notebook must be set to GMT +8:00 Kuala Lumpur, Singapore Timezone. <a href="javascript:void(0)" onclick="javascript:window.open(\''+urlPrefix+'/JobApp/images/timezonesettings.html\',\'pop\',\'menubar=no,scrollbars=yes,resizable=no,addressbar=no,statusbar=no,width=400,height=350\');" alt="Timezone Settings" title="Timezone Settings" ><u>Click here</u></a> for the steps to change your PC/Notebook timezone settings. ');
document.write('<br><br>');
document.write('You may apply for multiple positions in a single application. Do not submit more than once.');
document.write('<br><br>');
document.write('The PSA Online Application system will log out after 20 minutes of user inactivity.  Information submitted prior to this will not be stored unless previously saved.');
document.write('<br><br>');
document.write('All incomplete applications will be stored in our system for 30 days. You may login anytime within this period to complete and submit your application. Once expired, you will need to re-apply following the same procedure.');
document.write('<br><br>');
document.write('This online application is optimised for viewing in Internet Explorer 6.0.');
document.write('<br>');
document.write('');
document.write('</td></tr>');
document.write('</table>');

document.write('<p>&nbsp;</p></td>');
document.write('</tr>');
document.write('<tr>');
document.write('<td valign="top">');
document.write('<form name="frmlogin" method="post" action="'+urlPrefix+'/hrapp/JobApp?function=login" onsubmit="return checkLoginfrm()">');


document.write('<table border="0" cellspacing="0" cellpadding="2" align="left" style="font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 11px;color: #000000;">');
document.write('<tr>');
document.write('<td colspan=2>');
document.write('<font color="#800040"><b>');
document.write('<!--OWL-message-->');
errmsg = getErrmsg();
if(errmsg!="")
document.write(errmsg);
document.write('</b></font>');
document.write('</td>');
document.write('</tr>');
document.write('<tr>');
document.write('<td width="40%">User ID:</td>');
document.write('<td>');
document.write('<div align="left">');
document.write('<input type="text" name="login" size="15" maxlength="25" style="border-collapse: collapse;font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 11px;color: #666666;" >');
document.write('</div>');
document.write('</td>');
document.write('</tr>');
document.write('<tr>');
document.write('<td width="40%">Password:</td>');
document.write('<td>');
document.write('<div align="left">');
document.write('<input type="password" name="password" size="15" maxlength="8" style="border-collapse: collapse;font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 11px;color: #666666;">');
document.write('</div>');
document.write('</td>');
document.write('</tr>');
document.write('</table>');

document.write('<p>&nbsp;</p>');
document.write('<p>&nbsp;</p>');
document.write('<br>');

document.write('<table border="0" cellspacing="0" cellpadding="2" align="center">');
document.write('<tr>');
document.write('<td width="40%">');
document.write('<input type="submit" name="Submit23" value="Submit">');
document.write('</td>');
document.write('<td>');
document.write('<div align="left">');
document.write('<input type="reset" name="Submit222" value="Reset">');
document.write('</div>');
document.write('</td>');
document.write('</tr>');
document.write('</table>');

document.write('</form>');
document.write('</td>');
document.write('</tr>');

document.write('<tr>');
document.write('<td valign="top" style="font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 11px;color: #000000;">');
document.write('You may continue to complete a previous entry at your next visit by entering ');
document.write('your user ID and password.<br><br></td>');
document.write('</tr>');
document.write('</table>');
document.write('</td></tr></table><br>');


};
function checkLoginfrm(){

	f = document.frmlogin;
	userid = f.login.value;
	passwd = f.password.value;
	if(userid == ''){
		alert('Please enter User ID');
		return false;
	}

	if(passwd == ''){
		alert('Please enter password');
		return false;
	}

	if(userid!='ADMIN'){
		if(userid.length<8 || userid.length>15){
			alert('User ID must be between 8 to 15 characters!');
			return false;
		}
		if(passwd.length<4 || passwd.length>8){
			alert('Password must be between 4 to 8 characters!');
			return false;
		}
	}

	reg1 = /^[A-Za-z0-9-]+$/;
	if (!reg1.test(userid)){
		alert('User ID wrong format!');
		return false;
	}

	return true;
}
function getErrmsg(){
	var url = parent.document.URL;
	var msgstr = '';
	if(url.indexOf('msg=')>0){
		msg = url.substring(url.indexOf('msg=')+4, url.length);
	}else{
		msg = '';
	}
	if (msg=='wrongpwd'){
		msgstr = 'Invalid&nbsp;password,&nbsp;please&nbsp;try&nbsp;again';
	}
	if (msg=='timeout'){
		msgstr = 'Session&nbsp;time&nbsp;out,&nbsp;please&nbsp;login&nbsp;again';
	}
	return msgstr;
}
function getUrlPrefix(){
	var url = parent.document.URL;
	var prefix = '';
	if(url!=null && url.indexOf('10.106.80.2')>0){
		prefix = '';
	}else{
		prefix = 'http://hrapp.singaporepsa.com';
	}
	return prefix;
}
showlogin();

//add by Tony 23Aug2007 --control keypress event for all pages
/*
var nav=navigator.appName;
var ns=(nav.indexOf("Netscape")!=-1);
function keyfilter(keyStroke){
  var num = (ns)?keyStroke.which: event.keyCode;
  var chr = String.fromCharCode(num)
  var objname = '';
  var filterstrs = '^;>%<+?|\\~*';
  var filterstrs2 = '@\'';
  var filterfields = ',name,emailAddress,';
  if(filterstrs.indexOf(chr)>=0)
	return false;
  if(ns){
	objname = keyStroke.target.name;
  }else{
	objname = event.srcElement.name;
  }
  if(filterfields.indexOf(','+objname+',')<0){//only names & emails allow @ ' 
    if(filterstrs2.indexOf(chr)>=0)
	  return false;
  }
  return true;
}
if(ns){
  document.captureEvents(Event.KEYPRESS);
  document.onkeypress = keyfilter;
}else{
  document.onkeypress = keyfilter
}
*/

