function loginonsubmit()
{
	document.forms['login_form'].user_pass.value = calcMD5(document.forms['login_form'].user_passMD5.value);
	document.forms['login_form'].user_passMD5.value = '';
	return true;
} 

function setfocus()
{
    document.forms['login_form'].user_passMD5.focus();
}

function setorderdate(day,month,year)
{
   var theDate = new Date();
   month = month - 1;
   theDate.setFullYear(year);
   theDate.setDate(day);
   theDate.setMonth(month,day);
   theDate.setHours(1);
   dateString = theDate.toUTCString();
   dc = dateString.split(" ");
   db = dc[1] + " " + dc[2] + " " + dc[3];

   document.forms['addtask_form'].order_date.value = (db);
   document.forms['addtask_form'].order_date_unix.value = (theDate.getTime()-theDate.getMilliseconds())/1000;
}

function setenddate(day,month,year)
{
   var theDate = new Date();
   month = month - 1;
   theDate.setFullYear(year);
   theDate.setDate(day);
   theDate.setMonth(month,day);
   theDate.setHours(1);
   dateString = theDate.toUTCString();
   dc = dateString.split(" ");
   db = dc[1] + " " + dc[2] + " " + dc[3];

   document.forms['addtask_form'].filled_date.value = (db);
   document.forms['addtask_form'].filled_date_unix.value = (theDate.getTime()-theDate.getMilliseconds())/1000;
}



function setanticipateddate(day,month,year)
{
   var theDate = new Date();
   month = month - 1;
   theDate.setFullYear(year);
   theDate.setDate(day);
   theDate.setMonth(month,day);
   theDate.setHours(1);
   dateString = theDate.toUTCString();
   dc = dateString.split(" ");
   db = dc[1] + " " + dc[2] + " " + dc[3];

   document.forms['addtask_form'].anticipated_date.value = (db);
   document.forms['addtask_form'].anticipated_date_unix.value = (theDate.getTime()-theDate.getMilliseconds())/1000;
}



function passwordsubmit()
{
	document.forms['changepassword'].old_password_set.value = calcMD5(document.forms['changepassword'].old_password.value);
	document.forms['changepassword'].old_password.value = '';
	
	document.forms['changepassword'].new_password_set.value = calcMD5(document.forms['changepassword'].new_password.value);
	document.forms['changepassword'].new_password.value = '';
	
	document.forms['changepassword'].confirm_password_set.value = calcMD5(document.forms['changepassword'].confirm_password.value);
	document.forms['changepassword'].confirm_password.value = '';
	return true;
}

function OpenEmpInfoWindow(session)
{
    var empinfo_win = window.open("viewprofile.php?s=" + session, '', "width=410, height=485, scrollbars=no, resizable=no, toolbars=no, status=no");
}

function inline_results(container, url) {
	new Ajax.Updater (container, url, {method:'post'});
}

