var flag=0;
// submit the login form
function OnLoginFormSubmit()
{
	var objForm ;

	// get the form object
	objForm = document.tvLoginForm ;
	var password = objForm.password.value;

	if(Trim(objForm.password.value)!="")
	{
		objForm.password.value = "";
		objForm.encpassword.value = encrypt(password,"80");
		return true;
	}
	else
	{
		objForm.encpassword.value      = "NULL";
		return true;
	}
}

//Function to TRIM white spaces
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 enablepass()
{
	var objForm ;
	objForm = document.tvLoginForm ;
	if(objForm && objForm.password.type=='text')
	{
		var elem = document.getElementById('password');
        var newElem = document.createElement('input');
		newElem.setAttribute('type','password');
        newElem.id = "password";
		elem.parentNode.replaceChild(newElem,elem);
		objForm.password.focus();
		objForm.password.focus();
		objForm.password.className='subText';
		objForm.password.style.cssText ='color:#000000;width:125px;';
	}
}

function disabletxt()
{
	var objForm ;
	objForm = document.tvLoginForm ;
	if(objForm )
	{
		var userid = objForm.userid.value
		if(userid=='Email' && flag==0) {
			flag=1;
			objForm.userid.value='';
			objForm.userid.focus();
		}
		objForm.userid.style.cssText ='color:#000000;width:125px;';
	}
}

<!--enc_js -->

function encrypt(str, pwd)
{
var x1=0;
retNum1 = "";
x="";
var a=0;
b="";

for (var i=0; i<str.length; i++)
    {
        asc_val = str.charCodeAt(i);
        asc_pwd = parseInt(asc_val) + parseInt(pwd);

        leftNum = Math.floor(asc_pwd / 16);
		leftNumS = fixHex(leftNum);
		rightNum = asc_pwd%16;
		rightNumS = fixHex(rightNum);

		retNum = leftNumS + rightNumS;
x2 = retNum.length;

  if (x2 == "2")
  {
    b = a + retNum;
    x = x + b;
  }
}

	return x;

}



function fixHex(theDec) {

	var hNum = new

Array("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f");

	var retHex = hNum[theDec];

	return retHex;

}