/* Newly Encrypted */
function submitEnter(myfield,e){var keycode;if(window.event){keycode=window.event.keyCode;}else if(e){keycode=e.which;}else{return true;}
if(keycode==13){xajax_login(document.getElementById('login').value,document.getElementById('password').value);return false;}
return true;}
function jumpEnter(myfield,e){var keycode;if(window.event){keycode=window.event.keyCode;}else if(e){keycode=e.which;}else{return true;}
if(keycode==13){document.getElementById('password').focus();return false;}
return true;}
function Select_Value_Set(SelectName,Value){SelectObject=$(SelectName);for(index=0;index < SelectObject.length;index++){if(SelectObject[index].value==Value){SelectObject.selectedIndex=index;}
}
}
function getScrollerWidth(){/* Typically works in IE */
var d=document.createElement("DIV");d.style.position='absolute';d.style.visible='hidden';d.style.overflowY='scroll';d.style.width=0;document.body.appendChild(d);var scrollBarW=d.offsetWidth;document.body.removeChild(document.body.lastChild);if(scrollBarW){return scrollBarW;}
/* Wroks in Firefox - sort of */
var scr=null;var inn=null;var wNoScroll=0;var wScroll=0;scr=document.createElement('div');scr.style.position='absolute';scr.style.top='-1000px';scr.style.left='-1000px';scr.style.width=xajax.$('cal_headerwrap').offsetWidth+'px';scr.style.height='50px';scr.style.overflow='hidden';inn=document.createElement('div');inn.style.width='100%';inn.style.height='200px';scr.appendChild(inn);document.body.appendChild(scr);wNoScroll=inn.offsetWidth;scr.style.overflow='auto';wScroll=inn.offsetWidth;document.body.removeChild(document.body.lastChild);return(wNoScroll-wScroll)+6;}
function inctime(h_control,m_control,increment){var oldtime=new Date();var newtime=new Date();var h_oldvalue=document.forms[0].elements[h_control].value;var m_oldvalue=document.forms[0].elements[m_control].value;oldtime.setHours(h_oldvalue);oldtime.setMinutes(m_oldvalue);oldtime.setSeconds(0);newtime.setTime(oldtime.getTime()+(increment*60000));var h_new=newtime.getHours();var m_new=newtime.getMinutes();if(h_new<10)h_new="0"+h_new;if(m_new<10)m_new="0"+m_new;document.forms[0].elements[h_control].value=h_new;document.forms[0].elements[m_control].value=m_new;}
function menuTaskRolover(){return coolTip(xajax.$('rollover_'+this.id).innerHTML,BORDER,1,BGCOLOR,'black',FGCOLOR,'#fafafa',TEXTCOLOR,'black',OPACITY,'80');}
function menuProjectRolover(){return coolTip(xajax.$('rollover_'+this.id).innerHTML,BORDER,1,BGCOLOR,'black',FGCOLOR,'#e6e6e6',TEXTCOLOR,'black',OPACITY,'80');}
function menuTaskRoloverHide(){nd();}
function menuProjectRoloverHide(){nd();}
function menuContextHide(e){nd('contextMenu');return true;}
function menuProjectContext(e){nd();coolTip('Loading context menu...',PUID,'contextMenu',STICKY,OPACITY,'90',FOLLOWMOUSE,false);xajax_zenContextMenu('project','timesheet',this.projectID);return false;}
function menuTaskContext(e){zenContextMenu('timesheet','task',this.taskID);return false;}
function menuClientContext(e){zenContextMenu('timesheet','client',this.clientID);return false;}
function zenContextMenu(from,action,arg1,arg2,arg3){nd('contextMenu');coolTip('Loading context menu...',PUID,'contextMenu',STICKY,OPACITY,'90',FOLLOWMOUSE,false);xajax_zenContextMenu(action,from,arg1,arg2,arg3);return false;}
function cal_resize(e){xajax.$('cal_headerwrap').style.width='100%';xajax.$('cal_headerwrap').style.width=(xajax.$('cal_headerwrap').offsetWidth-getScrollerWidth()+10)+'px';}
function updateAMPM(fieldname,time_value){if(time_value < 12){new_label="AM";}else{new_label="PM";}
var newSpan=document.createElement("span");var newText=document.createTextNode(new_label);newSpan.appendChild(newText);var para=document.getElementById(fieldname);var spanElm=para.lastChild;var replaced=para.replaceChild(newSpan,spanElm);}
function timenow(h_control,m_control,interval){var now=new Date();var hour=0;var min=0;now.getTime();hour=now.getHours();min=now.getMinutes();min=Math.round(min/interval)*interval;h_control.value=hour;m_control.value=min;}
function positionIFrame(){var div=$('zenPopup');var frm=$('zenPopup_iframe');if(div.offsetHeight){frm.style.left=div.style.left;frm.style.top=div.style.top;frm.style.height=div.offsetHeight+'px';frm.style.width=div.offsetWidth+'px';frm.style.display="block";}else{frm.style.display="none";}
}
function hideIFrame(){var frm=$('zenPopup_iframe');frm.style.display="none";}
Event.observe(document,'click',menuContextHide);