<!--

String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
}

// return the value of the radio button that is checked
// return an empty string if none are checked, or
// there are no radio buttons
function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}

// set the radio button with the given value as being checked
// do nothing if there are no radio buttons
// if the given value does not exist, all the radio buttons
// are reset to unchecked
function setCheckedValue(radioObj, newValue) {
	if(!radioObj)
		return;
	var radioLength = radioObj.length;
	if(radioLength == undefined) {
		radioObj.checked = (radioObj.value == newValue.toString());
		return;
	}
	for(var i = 0; i < radioLength; i++) {
		radioObj[i].checked = false;
		if(radioObj[i].value == newValue.toString()) {
			radioObj[i].checked = true;
		}
	}
}

function checkFields(){
	if(document.frmMain.eusername.value.trim() == ""){
        window.alert("Please enter login name");
		document.frmMain.eusername.focus();
		return false;
     }
	if(document.frmMain.epassword.value.trim() == ""){cu
	    window.alert("Please enter password");
		document.frmMain.epassword.focus();
		return false;
     }
  return true;
}	

function coNum(x) { return (x<10)? '0'+x:''+x; }

function getdate()
{
	var d = new Date();
	return dd = coNum(d.getDate())+'/'+coNum(d.getMonth()+1)+'/'+d.getFullYear()+' '+coNum(d.getHours())+':'+coNum(d.getMinutes());
}

function clearDetails()
{
	document.frmMain.eusername.value = "";
	document.frmMain.epassword.value = "";
}

function login ()
{
	//debugger
	if (checkFields())
	{
	//debugger
		document.frmLogin.action = pathActionASPX +'pgoksubmit.aspx';
		document.frmLogin.eusername.value = document.frmMain.eusername.value;
		document.frmLogin.epassword.value = document.frmMain.epassword.value;
		document.frmLogin.efromwhere.value = getCheckedValue(document.frmMain.efromwhere);
		document.frmLogin.thisday.value = getdate();
		document.frmMain.epassword.value = "";
		document.forms["frmLogin"].submit();
		//window.alert (document.forms["frmLogin"].action + " " +  document.frmLogin.eusername.value + " " + document.frmLogin.epassword.value + " " + document.frmLogin.efromwhere.value + " " + document.frmLogin.thisday.value);
	}
	//loginonsubmit(document.frmMain.eusername.value,document.frmMain.epassword.value,getCheckedValue(document.frmMain.efromwhere),'null') 
}
            
//-->