
function trim(strText) {
	// this will get rid of leading spaces
	while (strText.substring(0,1) == ' ')
		strText = strText.substring(1, strText.length);

	// this will get rid of trailing spaces
	while (strText.substring(strText.length-1,strText.length) == ' ')
		strText = strText.substring(0, strText.length-1);

	return strText;
}


function validation() {
	var msg='';
	
	if(document.forms.frmLogin.txtUsername.value == '') {msg+='\n - Username'}
	if(document.forms.frmLogin.txtPassword.value == '') {msg+='\n - Password'}
	
	if (msg=='') {
	  document.forms.frmLogin.submit();
		return true;
	} else {
		alert('The following fields are required:\n' + msg);
		return false;
	}				 
}


function enc(str)
{
	var to_enc = str;

	var xor_key=6
	var the_res="";//the result will be here
	for(i=0;i<to_enc.length;++i)
	{
		the_res += String.fromCharCode(xor_key^to_enc.charCodeAt(i));
	}

	return the_res;
}



