
var JXDoPositionMainTables=0;var JXCalendarInitiallyShown=0;var JXToolbarCalendarInitialized=0;function fncPageInit(){fncAdjustPrimaryContentHeight();fncPageOnload();fncMaybeFocusOnSearch();}
function fncJTGUIonresize(){jtguiOnLoad();fncAdjustPrimaryContentHeight();}
function fncPageStateChange(){if(JXDoPositionMainTables){window.onresize=fncJTGUIonresize;jtguiOnLoad();}
if(bad(window.onresize)){window.onresize=fncAdjustPrimaryContentHeight;}}
function fncPageOnload(){maybeInitializeCalendar();fncPageStateChange();try{maybeCollapseColumns();}catch(e){}}
function maybeCollapseColumns(){var toggle_columns_list=window.toggle_columns_list;if(bad(toggle_columns_list)){return false;}
for(var col_i=0;col_i<toggle_columns_list.length;col_i++){strSection=toggle_columns_list[col_i];section_cookie_name=fncGetToggleColumnCookieName(strSection);section_pref=readCookie(section_cookie_name);if(!section_pref){continue;}
current_state=fncToggleColumn_getCurrentState(strSection);if((current_state=="on")&&(section_pref!='1')||(current_state=="off")&&(section_pref!='0')){fncMainTableToggleColumn(strSection,false);}}
return true;}
function maybeInitializeCalendar(){if(JXCalendarInitiallyShown){initializeToolbarCalendar();}}
function fncAdjustPrimaryContentHeight(){var ViewFrame=document.getElementById('idPrimaryContent');ViewFrame.style.height=null;var Orig_ViewFrameHeight=fncGetHeight('idPrimaryContent');var PrimaryContainerHeight=fncGetHeight('idMainPageContainerTD');var PrimaryTabsHeight=0;var TabSubNavHeight=0;var StatusErrorHelpHeight=0;if(document.getElementById('idPrimaryTabs')){PrimaryTabsHeight=fncGetHeight('idPrimaryTabs');}
if(document.getElementById('idTabSubNav')){TabSubNavHeight=fncGetHeight('idTabSubNav');}
if(document.getElementById('idStatusErrorHelp')){StatusErrorHelpHeight=fncGetHeight('idStatusErrorHelp');}
var combined_heights=PrimaryTabsHeight+TabSubNavHeight+StatusErrorHelpHeight;var extra_padding=12;var new_height=PrimaryContainerHeight-combined_heights-extra_padding;if(Orig_ViewFrameHeight<new_height){ViewFrame.style.height=new_height+"px";}}
function fncSwitchClass(oElement,strNewClass,strMatchClass){if(typeof(oElement)!="undefined"&&oElement!==null){if(strMatchClass.length>0){if(oElement.className==strMatchClass){oElement.className=strNewClass;}}
else{oElement.className=strNewClass;}}}
function fncDOMElementIsContained(container,target){var isContained=false;while(target){if(container==target){isContained=true;break;}
try{target=target.parentNode;}catch(E){target=null;}}
return isContained;}
function fncGetMouseEventPositionX(e){if(!e)e=window.event;var posx=0;if(e.pageX){posx=e.pageX;}
else if(e.clientX){posx=e.clientX+document.body.scrollLeft-document.body.clientLeft;}
return posx;}
function fncGetMouseEventPositionY(e){if(!e)e=window.event;var posy=0;if(e.pageY){posy=e.pageY;}
else if(e.clientY){posy=e.clientY+document.body.scrollTop-document.body.clientTop;}
return posy;}
function fncGetMouseEventPositionXAndY(e){if(!e)e=window.event;var posx=0;var posy=0;if(e.pageX){posx=e.pageX;}
else if(e.clientX){posx=e.clientX+document.body.scrollLeft-document.body.clientLeft;}
if(e.pageY){posy=e.pageY;}
else if(e.clientY){posy=e.clientY+document.body.scrollTop-document.body.clientTop;}
return[posx,posy];}
function fncGetAbsoluteX(oObjectToGetPosition){var intCoords={x:0};while(oObjectToGetPosition){intCoords.x+=oObjectToGetPosition.offsetLeft;oObjectToGetPosition=oObjectToGetPosition.offsetParent;}
return intCoords.x;}
function fncGetAbsoluteY(oObjectToGetPosition){var intCoords={y:0};while(oObjectToGetPosition){intCoords.y+=oObjectToGetPosition.offsetTop;oObjectToGetPosition=oObjectToGetPosition.offsetParent;}
return intCoords.y;}
function fncGetWidth(strObject){if(!strObject){return null;}
if(bad(strObject.nodeType)){strObject=document.getElementById(strObject);}
return strObject.offsetWidth;}
function fncGetHeight(strObject){if(!strObject){return null;}
if(bad(strObject.nodeType)){strObject=document.getElementById(strObject);}
return strObject.offsetHeight;}
function fncCheckIfPositionInsideElement(x,y,anElement){if(bad(x)||bad(y)||bad(anElement)){return false;}
var elemTopLeftX=fncGetAbsoluteX(anElement);var elemTopLeftY=fncGetAbsoluteY(anElement);var elemWidth=fncGetWidth(anElement);var elemHeight=fncGetHeight(anElement);var elemBottomRightX=elemTopLeftX+elemWidth;var elemBottomRightY=elemTopLeftY+elemHeight;if((x>=elemTopLeftX)&&(x<=elemBottomRightX)&&(y>=elemTopLeftY)&&(y<=elemBottomRightY)){return true;}
return false;}
function fncListTransferSelected(strSourceListID,strTargetListID,blnResortTarget){oSourceList=document.getElementById(strSourceListID);oTargetList=document.getElementById(strTargetListID);var i;if(oSourceList!==null&&oTargetList!==null){for(i=0;i<oSourceList.options.length;i++){if(oSourceList.options[i].selected){intSelectedIndex=i;itemText=oSourceList.options[intSelectedIndex].text;itemValue=oSourceList.options[intSelectedIndex].value;oNewItem=new Option(itemText,itemValue);newIndex=oTargetList.options.length;oTargetList.options[newIndex]=oNewItem;}}
i=0;while(i<oSourceList.options.length){if(oSourceList.options[i].selected){oSourceList.options[i]=null;}
else{i=i+1;}}
if(blnResortTarget){fncListSort(oTargetList);}}}
function fncListTransferAll(strSourceListID,strTargetListID,blnResortTarget){oSourceList=document.getElementById(strSourceListID);oTargetList=document.getElementById(strTargetListID);if(oSourceList!==null&&oTargetList!==null){for(var i=0;i<oSourceList.options.length;i++){itemText=oSourceList.options[i].text;itemValue=oSourceList.options[i].value;oNewItem=new Option(itemText,itemValue);newIndex=oTargetList.options.length;oTargetList.options[newIndex]=oNewItem;}
i=0;while(i<oSourceList.options.length){oSourceList.options[i]=null;}
if(blnResortTarget){fncListSort(oTargetList);}}}
function fncListItemOrder(strListID,strDirection){var strDelimiter="^|^";var intSelectedIndex;var i,j;var astrOptions;oList=document.getElementById(strListID);if(oList!==null){if(fncListNumSelected(oList)==1){var aobjNewList=new Array(oList.length);intSelectedIndex=oList.selectedIndex;if(strDirection=="up"&&oList.selectedIndex>0){for(i=0;i<oList.selectedIndex-1;i++){aobjNewList[i]=oList.options[i].text+strDelimiter+oList.options[i].value;}
aobjNewList[i]=oList.options[i+1].text+strDelimiter+oList.options[i+1].value;aobjNewList[i+1]=oList.options[i].text+strDelimiter+oList.options[i].value;for(i=oList.selectedIndex+1;i<oList.length;i++){aobjNewList[i]=oList.options[i].text+strDelimiter+oList.options[i].value;}
i=0;while(i<oList.options.length){oList.options[i]=null;}
for(j=0;j<aobjNewList.length;j++){astrOptions=aobjNewList[j].split(strDelimiter);oNewItem=new Option(astrOptions[0],astrOptions[1]);oList.options[oList.options.length]=oNewItem;}
oList.options[intSelectedIndex-1].selected=true;}
if(strDirection=="down"&&oList.selectedIndex<oList.length-1){for(i=0;i<oList.selectedIndex;i++){aobjNewList[i]=oList.options[i].text+strDelimiter+oList.options[i].value;}
aobjNewList[i]=oList.options[i+1].text+strDelimiter+oList.options[i+1].value;aobjNewList[i+1]=oList.options[i].text+strDelimiter+oList.options[i].value;for(i=oList.selectedIndex+2;i<oList.length;i++){aobjNewList[i]=oList.options[i].text+strDelimiter+oList.options[i].value;}
i=0;while(i<oList.options.length){oList.options[i]=null;}
for(j=0;j<aobjNewList.length;j++){astrOptions=aobjNewList[j].split(strDelimiter);oNewItem=new Option(astrOptions[0],astrOptions[1]);oList.options[oList.options.length]=oNewItem;}
oList.options[intSelectedIndex+1].selected=true;}}}}
function fncListSortText(a,b){return a.text!=b.text?a.text<b.text?-1:1:0;}
function fncListSort(oList){var intNumItems=oList.options.length;var aobjItems=new Array(intNumItems);var i;for(i=0;i<intNumItems;i++){aobjItems[i]=new Option(oList.options[i].text,oList.options[i].value);}
aobjItems.sort(fncListSortText);for(i=0;i<intNumItems;i++){oList.options[i]=new Option(aobjItems[i].text,aobjItems[i].value);}}
function fncListNumSelected(oList){var intNumSelected=0;for(var i=0;i<oList.options.length;i++){if(oList.options[i].selected){intNumSelected++;}}
return intNumSelected;}
function fncDisableInputs(inputsIDList){for(var i=0;i<inputsIDList.length;i++){var the_element=document.getElementById(inputsIDList[i]);the_element.disabled=true;}
return true;}
function fncEnableInputs(inputsIDList){for(var i=0;i<inputsIDList.length;i++){var the_element=document.getElementById(inputsIDList[i]);the_element.disabled=false;}
return true;}
function fncToggleInputsEnabled(inputsIDList){for(var i=0;i<inputsIDList.length;i++){var the_element=document.getElementById(inputsIDList[i]);if(the_element.disabled){the_element.disabled=false;}
else{the_element.disabled=true;}}
return true;}
function fncSyncOtherSelects(select_element){var other_selects=document.getElementsByName(select_element.name);for(i=0;i<other_selects.length;i++){var a_select=other_selects[i];if(a_select!=select_element){a_select.options.length=0;for(i_opt=0;i_opt<select_element.options.length;i_opt++){orig_opt=select_element.options[i_opt];var new_opt=new Option(orig_opt.text,orig_opt.value);if(orig_opt.selected){new_opt.selected=true;}
a_select.options[i_opt]=new_opt;}}}
return true;}
var report_popup_options='menubar=yes,resizable=yes,scrollbars=yes';var usePopupReport='&makebuttons=0';function fncReportViewButton(formName,viewParam){var myForm=document.getElementsByName(formName)[0];selectedThing=myForm.outputtype.options[myForm.outputtype.selectedIndex].value;if((selectedThing=='html')||(selectedThing=='cube')){if(selectedThing=='cube'){myForm.owc_version.value=getOWCversion();}
myForm.submit();return true;}
var finalURL='showrpt.pyc?'+viewParam+'&fromTimeSheet='+myForm.fromTimeSheet.value;finalURL=finalURL+'&outputtype='+selectedThing+usePopupReport;window.open(finalURL,'_blank',report_popup_options);return false;}
function fncRunReportFromSearch(reportId){var report_search=document.forms.report_search;var out_type=report_search.outputtype.value;var save_or_display=report_search.savereport[getRadio(report_search.savereport)].value;var save_report_only=false;if(save_or_display=='0'){save_report_only=true;}
if(save_report_only||(save_or_display=='1')){var saved_rep_name=report_search.description.value;if(!saved_rep_name){window.alert('You must give a description for the saved report output.');return false;}}
var runReport='Run Report';if(save_report_only||out_type=='html'||out_type=='cube'){if(out_type=='cube'){report_search.owc_version.value=getOWCversion();}
report_search.rpt.value=reportId;report_search.runreport.value=runReport;report_search.submit();return false;}
var finalURL='wtrptlist.pyc?'+'savereport='+save_or_display+'&runreport='+escape(runReport)+'&rpt='+escape(reportId);finalURL=finalURL+'&fromTimeSheet=0&outputtype='+out_type+usePopupReport;window.open(finalURL,'_blank',report_popup_options);return false;}
function fncRunRReportFromSearch(reportId,encodeddata){var report_search=document.forms.report_search;var out_type=report_search.outputtype.value;var runReport='Run Report';var fromsearch=0;var save_or_display;if(out_type=='html'||out_type=='cube'){if(out_type=='cube'){report_search.owc_version.value=getOWCversion();}
report_search.rpt.value=reportId;report_search.runreport.value=runReport;report_search.submit();return false;}
if(typeof(report_search.savereport)!="undefined"&&report_search.savereport!==null){fromsearch=1;if(report_search.savereport.checked===true){save_or_display=1;}else{save_or_display=0;}
var saved_report_name=report_search.description.value;}else{save_or_display=0;}
var finalURL='rreport.pyc?outputtype='+out_type+'&'+encodeddata+'&savereport='+save_or_display;if(fromsearch==1){finalURL=finalURL+'&'+'description='+saved_report_name;}
window.open(finalURL,'_blank',report_popup_options);return false;}
function fncMaybeFocusOnSearch(){var searchInputs=['gen_searchTerm','USERNAME','PROJECTNAME','TASKNAME','PAYTYPENAME','BILLTYPENAME','EXPENSENAME','EXPENSESOURCENAME','EXPENSECURRENCYNAME','MILEAGEREASONNAME','MILEAGEVEHICLENAME','MILEAGEMEASUREMENTNAME'];for(var i_inpName=0;i_inpName<searchInputs.length;i_inpName++){var inpName=searchInputs[i_inpName];var myInputCol=document.getElementsByName(inpName);if(!bad(myInputCol)&&(myInputCol.length>0)){for(var i_input=0;i_input<myInputCol.length;i_input++){var myInput=myInputCol[i_input];try{myInput.focus();}catch(e){}
return;}}}
return;}
function fncIsTableCollapsed(bodyID){return(getIdProperty(bodyID,"display")=="none");}
function fncToggleCollapsibleTable(caller,bodyID,arrowID,tCookie){if(fncIsTableCollapsed(bodyID)){caller.title="Hide Area";if(tCookie){setCookie(tCookie,'1','never','/','','');}}else{caller.title="Expand Area";if(tCookie){setCookie(tCookie,'0','never','/','','');}}
toggleDisplay(bodyID);toggleArrow(arrowID);try{fncAdjustPrimaryContentHeight();}catch(e){}}
function fncOpenPopupLink(thisHref,event,target,winname,opts){if(thisHref.disabled===true){return false;}
var new_win=window.open(target,winname,opts+';');return new_win;}
function fncChkModFromMemLink(openRowNum){if(thingshavechanged==1){var confMsg='Records were modified since last save.  Press OK to save now.';if(confirm(confMsg)){thingshavechanged=0;window.document.persist_form.openrowforedit.value=openRowNum;window.document.persist_form.alsosave.value='yes';window.document.persist_form.submit();}
else{return false;}}
else{thingshavechanged=0;window.document.persist_form.openrowforedit.value=openRowNum;window.document.persist_form.submit();}
return false;}
function fncChkModFromArrow(direction){if(thingshavechanged==1){var confMsg='Records were modified since last save.  Press OK to save now.';if(confirm(confMsg)){window.document.persist_form.alsosave.value='yes';}}
thingshavechanged=0;if(direction=='right'){window.document.persist_form.goright.value='yes';}
else{window.document.persist_form.goleft.value='yes';}
window.document.persist_form.submit();return false;}
function fncChkModFromEntry(){if(doingsearch==1){doingsearch=0;return;}
if(donotaskatall==1){}
else{if(thingshavechanged==1){var confMsg='Page has been modified since last save. Press OK to save now, or Cancel to continue without saving.'
if(confirm(confMsg)){window.document.persist_form.submit();thingshavechanged=0;}};};}
function fadeAnimation(domElem,fadeDurationMS,fadeOut,postFadeFunction,fadeIncrementMS){if(!domElem){return false;}
if(fadeOut==null){fadeOut=true;}
if(fadeDurationMS==null){fadeDurationMS=1000;}
if(fadeIncrementMS==null){fadeIncrementMS=60;}
if(!domElem.nodeType){domElem=document.getElementById(domElem);}
var startTime=new Date().valueOf();var desiredEndTime=startTime+fadeDurationMS;var startSlice=0;fadeAnimationTimer(domElem,startSlice,fadeOut,fadeIncrementMS,startTime,desiredEndTime,postFadeFunction);return true;}
function fadeAnimationTimer(domElem,fadeSlice,fadeOut,fadeIncrementMS,startTime,desiredEndTime,postFadeFunc){fadeSlice=fadeSlice+1;var dNow=new Date().valueOf();var timeleftMS=desiredEndTime-dNow;var totalTimeMS=desiredEndTime-startTime;var pctLeft=Math.round((timeleftMS*100)/totalTimeMS);if(pctLeft>0){var opacityPct=100;if(fadeOut){opacityPct=pctLeft;}
else{opacityPct=100-pctLeft;}
if(opacityPct!=undefined&&opacityPct!=NaN){setElementOpacity(domElem,opacityPct);}}
if(desiredEndTime>=dNow){var callBack=function(){fadeAnimationTimer(domElem,fadeSlice,fadeOut,fadeIncrementMS,startTime,desiredEndTime,postFadeFunc);}
setTimeout(callBack,fadeIncrementMS);return true;}
var finalOpacityPct=0;if(!fadeOut){finalOpacityPct=100;}
setElementOpacity(domElem,finalOpacityPct);if(postFadeFunc){postFadeFunc(domElem,fadeOut);}
return true;}
function setElementOpacity(domElem,opacityPct){if(is.ie){var newFilter='alpha(opacity='+opacityPct+')';domElem.style.filter=newFilter;}
else{domElem.style.opacity=opacityPct/100;}
return true;}
function fncOnClickVerifyFormElementsSet(formElemsList,errorMsg){if(!formElemsList.length){formElemsList=[formElemsList];}
var formElem,formElemID;for(var formElemID_i in formElemsList){formElemID=formElemsList[formElemID_i];formElem=window.document.form[formElemID];if(!formElem||!formElemID){continue;}
if(!formElem.value){window.alert(errorMsg);return false;}}
return true;}
function fncOnClickVerifyCommentsForGrid(this_form){var startcol=colstart;var fmat=regstype;var cmt_col,cmt_widget,cmt_value;var rowcol,rxcx_widget;var j,i;var h,m;for(i=0;;i++){rowcol="r"+i+"c"+startcol;rxcx_widget=this_form[rowcol];if(!rxcx_widget){break;}
for(j=startcol;;j++){rowcol="r"+i+"c"+j;rxcx_widget=this_form[rowcol];if(!rxcx_widget){break;}
if(fmat=="hhmm"){h=to_hour(rxcx_widget.value);m=to_minute(rxcx_widget.value);h=h+m/60;}
else{h=Number(rxcx_widget.value);}
if(h!=0){cmt_col="tb1_"+i;cmt_widget=this_form[cmt_col];cmt_value=cmt_widget.value
cmt_value.strip();if(!cmt_value){window.alert("You must enter a comment for each entry on this sheet before submitting.");return false;}
break;}}}
return true;}
function fncOnClickVerifyCommentsForLine(this_form){var cmt_col,cmt_widget,cmt_value;var rowcol,rxcx_widget;var j,i;var hrs;var inVal,outVal;var inOut=0;var amtEntry=0;rowcol='t_0';rxcx_widget=this_form[rowcol];if(!rxcx_widget){rowcol='t_0_1';rxcx_widget=this_form[rowcol];if(rxcx_widget){inOut=1;}}else{amtEntry=1;}
if(!amtEntry&&!inOut){return true;}
for(i=0;;i++){if(amtEntry){rowcol='t_'+i;rxcx_widget=this_form[rowcol];if(!rxcx_widget){break;}
hrs=formatTime(rxcx_widget.value,"dec");}else{hrs=0;rowcol='t_'+i+'_1';rxcx_widget=this_form[rowcol];if(!rxcx_widget){break;}
inTime=rxcx_widget.value
if(!inTime){rowcol='t_'+i+'_2';rxcx_widget=this_form[rowcol];outTime=rxcx_widget.value;if(outTime){hrs=1;}}else{hrs=1;}
if(h!=0){cmt_col="tb1_"+i;cmt_widget=this_form[cmt_col];cmt_value=cmt_widget.value
cmt_value.strip();if(!cmt_value){window.alert("You must enter a comment for each entry on this sheet before submitting.");return false;}}}}
return true;}