<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<title>Tasks</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<meta http-equiv="pragma" content="no-cache" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
	<!--MqRelPath--><link rel="stylesheet" type="text/css" href="../../theme/css/censusmain.css"/><!--/MqRelPath--><!--MqAbsPath><link rel="stylesheet" type="text/css" href="<BASE_VD>/theme/css/censusmain.css"/></MqAbsPath-->
	
	<!--MqRelPath--><script type="text/javascript" src="../../js/mqsysutils.js"></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/mqsysutils.js"></script></MqAbsPath-->	
	<!--MqRelPath--><script type="text/javascript" src="../js/constants.js" ></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/<VIEW_FOLDER>/js/constants.js" ></script></MqAbsPath-->
	<!--MqRelPath--><script type="text/javascript" src="../../js/constantstimeout.js"></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/constantstimeout.js"></script></MqAbsPath-->	
	<!--MqRelPath--><script type="text/javascript" src="../../js/cmqsysmsg.js"></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/cmqsysmsg.js"></script></MqAbsPath-->	
	<!--MqRelPath--><script type="text/javascript" src="../../js/mqformelements.js"></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/mqformelements.js"></script></MqAbsPath-->	
	<!--MqRelPath--><script type="text/javascript" src="../../js/mqrecordset.js"></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/mqrecordset.js"></script></MqAbsPath-->	
	<!--MqRelPath--><script type="text/javascript" src="../../js/mqviewfields.js"></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/mqviewfields.js"></script></MqAbsPath-->	
	<!--MqRelPath--><script type="text/javascript" src="../../js/xml.js"></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/xml.js"></script></MqAbsPath-->	
	<!--MqRelPath--><script type="text/javascript" src="../../js/mqloaddata.js"></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/mqloaddata.js"></script></MqAbsPath-->	
	<!--MqRelPath--><script type="text/javascript" src="../../js/popupwindow.js"></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/popupwindow.js"></script></MqAbsPath-->	
	<!--MqRelPath--><script type="text/javascript" src="../../js/date.js"></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/date.js"></script></MqAbsPath-->	
	<!--MqRelPath--><script type="text/javascript" src="../../js/anchorposition.js"></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/anchorposition.js"></script></MqAbsPath-->	
	<!--MqRelPath--><script type="text/javascript" src="../../js/calendarpopup.js"></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/calendarpopup.js"></script></MqAbsPath-->	
	<!--MqRelPath--><script type="text/javascript" src="../../js/dragdrop.js"></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/dragdrop.js"></script></MqAbsPath-->	
	<!--MqRelPath--><script type="text/javascript" src="../../js/cmqlookupitemint.js"></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/cmqlookupitemint.js"></script></MqAbsPath-->	
	<!--MqRelPath--><script type="text/javascript" src="../../js/initlookupitemint.js"></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/initlookupitemint.js"></script></MqAbsPath-->	
	<!--MqRelPath--><script type="text/javascript" src="../../js/window.js" ></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/window.js" ></script></MqAbsPath-->
	<!--MqRelPath--><script type="text/javascript" src="../../js/autosuggest.js"></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/autosuggest.js"></script></MqAbsPath-->
	<!--MqRelPath--><script type="text/javascript" src="../../js/cmqrecmgr.js" ></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/cmqrecmgr.js" ></script></MqAbsPath-->				
	<!--MqRelPath--><script type="text/javascript" src="../../js/mqsysutils.js" ></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/mqsysutils.js" ></script></MqAbsPath-->
	<!--MqRelPath--><link rel="stylesheet" href="../../js/jquery/jquery.ui.all.css"><!--/MqRelPath--><!--MqAbsPath><link rel="stylesheet" href="<BASE_VD>/js/jquery/jquery.ui.all.css"></MqAbsPath-->
		<!--MqRelPath--><script type="text/javascript" src="../../js/jquery/jquery-1.7.1.js"></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/jquery/jquery-1.7.1.js"></script></MqAbsPath-->
		<!--MqRelPath--><script type="text/javascript" src="../../js/jquery/jquery.bgiframe-2.1.2.js"></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/jquery/jquery.bgiframe-2.1.2.js"></MqAbsPath-->
		<!--MqRelPath--><script type="text/javascript" src="../../js/jquery/jquery.ui.core.js"></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/jquery/jquery.ui.core.js"></MqAbsPath-->
		<!--MqRelPath--><script type="text/javascript" src="../../js/jquery/jquery.ui.widget.js"></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/jquery/jquery.ui.widget.js"></script></MqAbsPath-->
		<!--MqRelPath--><script type="text/javascript" src="../../js/jquery/jquery.ui.mouse.js"></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/jquery/jquery.ui.mouse.js"></script></MqAbsPath-->
		<!--MqRelPath--><script type="text/javascript" src="../../js/jquery/jquery.ui.draggable.js"></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/jquery/jquery.ui.draggable.js"></script></MqAbsPath-->
		<!--MqRelPath--><script type="text/javascript" src="../../js/jquery/jquery.ui.position.js"></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/jquery/jquery.ui.position.js"></script></MqAbsPath-->
		<!--MqRelPath--><script type="text/javascript" src="../../js/jquery/jquery.ui.resizable.js"></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/jquery/jquery.ui.resizable.js"></script></MqAbsPath-->
		<!--MqRelPath--><script type="text/javascript" src="../../js/jquery/jquery.ui.dialog.js"></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/jquery/jquery.ui.dialog.js"></script></MqAbsPath-->

	<script type="text/javascript">
		// always define this object for the system messages
		var objSysMsg = new CMqSysMsg();
		var m_blnNormalUnload;
		var m_blnEdit=false;
		var m_objMqButton = new MqButton();
		var m_RecMgr=this;
		var m_oFldsSch= new CMqFieldCol();
		var m_oFrmElem=new CMqFormElement();
		var m_objLoadDataMgr;
		var m_objRecordRef;
		var m_objMainRef;
		var m_objLookupItemInfo=new CMqLookupItemInfo();
		var m_objLookupItemInfoColl=new Array();
		var m_strWinID=parseInt( Math.random() * 1000);
		var m_objAutoSuggest = new CMqAutoSuggest();
		m_objAutoSuggest.Initialize("", document);
		var objRequest;
		var m_oRecMgr;
		
		
		if(opener){
			if(opener.Record){
				m_objRecordRef=opener.Record;
			}
			if(opener.parent){
				m_objMainRef=opener.parent;
				objRequest = opener.parent.objRequest;
			}
		}
		
		InitCal();
		
		var strMsg="<WC@MSG></WC@MSG>";
		if (strMsg){
			alert(strMsg);
		}
		
		function OnLoad(){

			OnLoad_InitCal();
			
			if(m_objMainRef){
				var oViewFields=m_objMainRef.m_objViewFields;
				if (oViewFields){
					oFieldValuesRs=new CMqRecordset(strXMLRec,oViewFields.GetFieldIDName());	
				}
					
				m_objLoadDataMgr=new CMqLoadDataMgr(oViewFields,"document");
					
				var lngMode=0 // disable all
				m_objLoadDataMgr.Load(oFieldValuesRs,lngMode,m_objMainRef.m_objDisplayElements,null);
			}					
			if(opener){
				opener.ShowDefaultControls(null, document);
			}
			m_oRecMgr=new CMqRecordMgr(m_objLoadDataMgr, objRequest, ";");
			
			return true;
		}
		
		function OnBeforeUnload(){
    		
    	if (!m_blnNormalUnload){
    		if (m_blnEdit){
    			event.returnValue = opener.MSG_EXIT_WITHOUT_SAVE;				
    		}	
    	}		
    }

		function OnRecordChanged(strFieldID){
			m_objLoadDataMgr.SetFieldChanged(strFieldID);
		}

		function OnMemoRecordChanged(objCtrl, strFieldID)
		{	
			if (objCtrl){
				if (objCtrl.value!= strTextAreaValue) {
					OnRecordChanged(strFieldID);
				}
			}		
		}

		function MemoGotFocus(ctrl)
		{
			this.strTextAreaValue = ctrl.value;
		}


		function InitCal(){
  		var objCal = new CalendarPopup("divCal");
  		objCal.setMonthNames(g_MqRef.RESX['MONTH_JANUARY'],g_MqRef.RESX['MONTH_FEBRUARY'],g_MqRef.RESX['MONTH_MARCH'],g_MqRef.RESX['MONTH_APRIL'],g_MqRef.RESX['MONTH_MAY'],g_MqRef.RESX['MONTH_JUNE'],g_MqRef.RESX['MONTH_JULY'],g_MqRef.RESX['MONTH_AUGUST'],g_MqRef.RESX['MONTH_SEPTEMBER'],g_MqRef.RESX['MONTH_OCTOBER'],g_MqRef.RESX['MONTH_NOVEMBER'],g_MqRef.RESX['MONTH_DECEMBER']);
  		objCal.setDayHeaders(g_MqRef.RESX['DAY_SUNDAY'],g_MqRef.RESX['DAY_MONDAY'],g_MqRef.RESX['DAY_TUESDAY'],g_MqRef.RESX['DAY_WEDNESDAY'],g_MqRef.RESX['DAY_THRUSDAY'],g_MqRef.RESX['DAY_FRIDAY'],g_MqRef.RESX['DAY_SATURDAY']);
  		objCal.setWeekStartDay(0); //Sunday
  		objCal.setDisabledWeekDays(); //allow to select any day of the week
  		objCal.setTodayText(g_MqRef.RESX['DAY_TODAY']);
  		objCal.setCloseText(g_MqRef.RESX['BUTTON_CLOSE']);
			this.objCal=objCal;
  		this.m_DefaultCursor="default";
			this.strDateFormat = "<WC@DATE_FORMAT></WC@DATE_FORMAT>";
			this.IE4=(document.all);
  		document.write(CalendarPopup_getStyles());
		}

		function OnLoad_InitCal(){
			var movableDiv=document.getElementById("divCal");
  		movableDiv.onmousedown=grabEl;
  		movableDiv.style.padding="3px";
  		movableDiv.onselectstart=checkEl;
  		wEl = movableDiv;
		}

		function CreateWindowWithApplet2(ctrl ,ctrlAnchor,strFieldID)
		{	
			objCal.select(ctrl, ctrlAnchor,strDateFormat,strFieldID);
		}
		
		function VerifyValue(ctrlName,strNewValue,strFieldID)
		{	
			var ctrl = document.getElementById(ctrlName);
			if (ctrl){
				ctrlvalue = ctrl.value;
				if (ctrlvalue !=  strNewValue){
					ctrl.value = strNewValue;
					m_RecMgr.OnRecordChanged(strFieldID);
				}		
			}
		}

		function SetMouse(blnCursorMove)
		{
			var divCalendar=document.getElementById("divCal");
			if (blnCursorMove){
				m_DefaultCursor=divCalendar.style.cursor;
				divCalendar.style.cursor="move";
			}else{
				divCalendar.style.cursor=m_DefaultCursor;
			}
		}
		
		function AddURLButton(strURL,strCSSClassName,strFieldID, strFieldName, objDocumentRef)
        {
			var strTooltipButton="";
			var URL_BUTTON_NAME="RC";
			var RC_CSS_CLASS_NAME="RemoteControl";
			var strURLButtonName;
			var objString=new MqString();
			var USER_DETAILS_CLASS_NAME ="UserDetails";
			var BROWSE_ALT_CHOICE_LIST_CLASS_NAME ="BrowseAlternateChoiceList";
			var strButtonAction="MqOpenURL('"+strURL+"')";
			var strButtonNamePostfix;
			
			strTooltipButton=parent.TITLE_SELECT_VALUE;
			strButtonAction=strURL;
			strButtonNamePostfix="_SelVal";
			
					
			if(m_objMqButton){	
				if(strFieldName){
					if(strButtonNamePostfix){
						strURLButtonName=strFieldName+strButtonNamePostfix;
					}else{
						strURLButtonName=URL_BUTTON_NAME+strFieldName;
					}
				}else{
					strURLButtonName=URL_BUTTON_NAME+strFieldID;		
				}
				
				m_objMqButton.WriteButtonHTML(strURLButtonName,strButtonAction,strCSSClassName,false,m_objMqButton.STATE_1,strTooltipButton, null, objDocumentRef);
			}
        }
		function OnOK()
		{
			if (ValidateFlds()){
				var strSaveURL="wcActItem.asp?wci=wcSaveAI&fid=<WC@FID></WC@FID>&ac=<WC@AC></WC@AC>&pid=<WC@PID></WC@PID>&rid=<WC@RID></WC@RID>";
				var strResult=m_oRecMgr.Save(null, null, false, strSaveURL, null, null, null, true);
				if(strResult!="0"){
					var strID="<WC@FID></WC@FID>";
					var m_LstCtrl;
					
					if (strID){
						if (opener){
							if (opener.Record){
								m_LstCtrl=opener.Record["m_o1tMLst" + strID];
								
								if (m_LstCtrl){
									
									m_LstCtrl.Load();
								}
							}
						}
					}			
					window.close();
				}
			}
		}

		function ValidateFlds()
		{			
			var blnRet=true;
			var strMsg="";
			
			return blnRet;
		}
					
		var strXMLRec="<WC@LOAD_DATA><Mq:Popup_Flds></WC@LOAD_DATA>"
		
		function AddURLButton(strURL,strCSSClassName,strFieldID, strFieldName)
        {
			var strTooltipButton="";
			var URL_BUTTON_NAME="RC";
			var RC_CSS_CLASS_NAME="RemoteControl";
			var strURLButtonName;
			var objString=new MqString();
			var USER_DETAILS_CLASS_NAME ="UserDetails";
			var BROWSE_ALT_CHOICE_LIST_CLASS_NAME ="BrowseAlternateChoiceList";
			var strButtonAction="MqOpenURL('"+strURL+"')";
			var strButtonNamePostfix;
			
			if (RC_CSS_CLASS_NAME==objString.Left(strCSSClassName,RC_CSS_CLASS_NAME.length)){
				strTooltipButton=g_MqRef.RESX['TOOLTIP_START_RC_SESSION'];
			}else{			
				if(USER_DETAILS_CLASS_NAME.toLowerCase()==objString.Left(strCSSClassName,USER_DETAILS_CLASS_NAME.length).toLowerCase()){
					strTooltipButton=g_MqRef.RESX['TOOLTIP_DETAILS'];
					strButtonAction=strURL;
				}else{	
					if(BROWSE_ALT_CHOICE_LIST_CLASS_NAME.toLowerCase()==objString.Left(strCSSClassName,BROWSE_ALT_CHOICE_LIST_CLASS_NAME.length).toLowerCase()){
						strTooltipButton=g_MqRef.RESX['TOOLTIP_SELECT_VALUE'];
						strButtonAction=strURL;
						strButtonNamePostfix="_SelVal";
					}else{
						strTooltipButton=g_MqRef.RESX['TOOLTIP_URL_CONNECT_ADDRESS'];
					}
				}
			}
					
			if(m_objMqButton){	
				if(strFieldName){
					if(strButtonNamePostfix){
						strURLButtonName=strFieldName+strButtonNamePostfix;
					}else{
						strURLButtonName=URL_BUTTON_NAME+strFieldName;
					}
				}else{
					strURLButtonName=URL_BUTTON_NAME+strFieldID;		
				}
				
				m_objMqButton.WriteButtonHTML(strURLButtonName,strButtonAction,strCSSClassName,false,m_objMqButton.STATE_1,strTooltipButton);
			}
        }	
		
		function LoadLargeListOrCombo(lngFieldID, strFieldCaption, strSearchResultsURL, strTableName, blnAutoComplete, lngRecordsPerPage, fnSetValue, lngWidth, lngHeight,lngDSType)
	{ 
		var blnShowWin=false;
		if(parent){
			if(parent.objRecord){
				if(parent.objRecord.GetRecordId() > 0){
					blnShowWin=true;
				}else{
					blnShowWin=false;
					if(parent.objFeatures){
						if(parent.objFeatures.getFeature(parent.FEATURE_SUBMIT)){
							blnShowWin=true;
						}
					}
				}
			}else{
				blnShowWin=true;
			}
		}
		
		if(blnShowWin){

			var objField=opener.parent.m_objViewFields.Field(lngFieldID);
			if (objField){

				var arrSelectedIDs;
				var arrSelectedValues;
				var blnMultiSelect;
				var fnSetValue=SetComboOrListValue;
				var strWorkflowValues="";
				var objHTMLElement;

				var objFormElement=new CMqFormElement();
				objFormElement.Initialize(objField.GetBoundControl(),objField.GetControlType(),'document');
				var lngControlType=objFormElement.GetControlType();

				if(lngControlType==CTRL_TYPE_LARGE_COMBO){
					blnMultiSelect=false;
					arrSelectedIDs=Array(objFormElement.GetValue());
				}else{  
					if(lngControlType==CTRL_TYPE_TEXT){
						blnMultiSelect=false;
						arrSelectedValues=Array(objFormElement.GetValue());
					}else{  // CTRL_TYPE_LARGE_LIST
						blnMultiSelect=true;
						var strValue = objFormElement.GetValue();
						if (strValue && strValue.length > 0)
						{
							var varValues=strValue.split(DEFAULT_VALUE_DELIM);
							if (varValues.length > 0){
								arrSelectedValues = new Array();
							}
							for(var lngIndex=0;lngIndex<varValues.length;lngIndex++)
							{
								arrSelectedValues[lngIndex]=varValues[lngIndex];
							}
						}
					}
				}
				
				objHTMLElement=objFormElement.GetElement();
				
				if(objHTMLElement){
					strWorkflowValues=objHTMLElement.getAttribute("MqWrkFlwVals");
				}

				InitLookupItemVals(lngFieldID, arrSelectedIDs, arrSelectedValues, fnSetValue, blnMultiSelect, strFieldCaption, strWorkflowValues, strSearchResultsURL, blnAutoComplete, lngRecordsPerPage, null, null, objHTMLElement);
    
				var strWinFeatures=GetWinFeaturesToCenter(650, 500); 
				
				if(!lngWidth){
					if(blnMultiSelect){
						lngWidth=1000;
					}else{
						lngWidth=850;
					}
				}
				if(!lngHeight){
					if(blnMultiSelect){
						lngHeight=770;
					}else{
						lngHeight=700;
					}
				}
				
				if(!blnAutoComplete){
					if(blnMultiSelect){
						MqOpenURL("../HTML/TmplLookupItemMultiSelect.htm?TBL=" + g_MqRef.MqStr.MqEncodeURIComponent(strTableName) + "&FID=" + lngFieldID,"ChoicesList"+lngFieldID+m_strWinID,"scrollbars=no,resizable=yes,toolbar=no,directories=no" + strWinFeatures, false, true, true, lngWidth, lngHeight);
					}else{
						MqOpenURL("../HTML/TmplLookupItem.htm?TBL=" + g_MqRef.MqStr.MqEncodeURIComponent(strTableName) + "&FID=" + lngFieldID,"ChoicesList"+lngFieldID+m_strWinID,"scrollbars=no,resizable=yes,toolbar=no,directories=no" + strWinFeatures, false, true, true, lngWidth, lngHeight);
					}
				}else{
					return "../HTML/TmplLookupItemCompact.htm?TBL=" + g_MqRef.MqStr.MqEncodeURIComponent(strTableName) + "&FID=" + lngFieldID;
				}
			} 
		}
	}
 
		function OpenInvPartDlg(strSrcFld, strFieldCaption)
		{ 


			var arrSelectedIDs;
			var arrSelectedValues;
			var blnMultiSelect;
			var fnSetValue=SetComboOrListValue;
			var strWorkflowValues="";
			var objHTMLElement;
			
			var strURL="WCDisplayChoices.asp?WCI=DisplayChoices&Ct=2&TBL=SOP30300&TBL2=SOP10201&DS=2048&HTbl=tblInvPartLst";
			var strURL2="WCDisplayChoices.asp?WCI=DisplayChoices&TBL=SOP30200&DS=2048&CO=0&ID=SOPNUMBE&VAL=SOPNUMBE&HTbl=tblInvLst&Cust=" + g_MqRef.MqStr.MqEncodeURIComponent(GetSelCust());
				
			if(strSrcFld=="538"){
				strURL+="&SelVal=" + g_MqRef.MqStr.MqEncodeURIComponent(document.getElementById("538").value);
				strURL2+="&INV=1&RMA=1&ORD=0&SelVal=" + document.getElementById("564").value;
			}else{
				if(strSrcFld=="539"){
					strURL+="&SelVal=" + g_MqRef.MqStr.MqEncodeURIComponent(document.getElementById("539").value);
					strURL2+="&INV=1&RMA=1&ORD=0&SelVal=" + g_MqRef.MqStr.MqEncodeURIComponent(document.getElementById("565").value);
				}
			}

			InitLookupItemVals(strSrcFld, arrSelectedIDs, arrSelectedValues, fnSetValue, blnMultiSelect, strFieldCaption, strWorkflowValues, strURL, strURL2);
    
			var strWinFeatures=opener.GetWinFeaturesToCenter(1024, 600); 
				
			MqOpenURL("../HTML/TmplInvDlg.htm","ChoicesList","scrollbars=no,resizable=yes,toolbar=no,directories=no" + strWinFeatures);

		}
		
		function GetSelCust()
		{
			if(m_objRecordRef){
				var objField=m_objRecordRef.document.getElementById("cbo_363_cbo_363_Contact_Company");
				if(objField){
					var objFormElement=m_objRecordRef.m_objFormElement;
					objFormElement.Initialize(objField.id,0,"Record.document");
					return objFormElement.GetValue();
				}
			}	
		}
		
		function MqOpenURL(strURL,strName, strFeatures,blnGetIDText,blnAsChildWin, blnAsModalWin, lngWidth, lngHeight)
		{               
			var MAX_URL_LEN=2020;
			if (!strName){
				strName="_blank";
			}
			
			if (!strFeatures){
				strFeatures="toolbar=no,directories=no,resizable=yes,scrollbars=yes";
			}
			if (strURL.length>MAX_URL_LEN){
				strURL=strURL.substr(0,MAX_URL_LEN);
			}
			if(blnAsChildWin){
				if(blnAsModalWin){
					var blnOpenFullScreen;
					
					OpenModalWindow(strURL, lngWidth, lngHeight, blnOpenFullScreen);
				}else{
					OpenChildWindow(strURL,strName,strFeatures);
				}
			}else{
				window.open(strURL,strName,strFeatures);
	        }
        }


	function SetComboOrListValue(lngFieldID, arrSelectedIDs, arrSelectedValues)
	{
		var strSelectedIDs;
		var strSelectedValues;
		
		if (lngFieldID)
		{
			var objField=opener.parent.m_objViewFields.Field(lngFieldID);

			var objFormElement=new CMqFormElement();
			objFormElement.Initialize(objField.GetBoundControl(),objField.GetControlType(),'document');
			var lngControlType=objFormElement.GetControlType();
			
			if (lngControlType == CTRL_TYPE_LARGE_COMBO)
			{
				strSelectedIDs = "";
				strSelectedValues = "";
				
				if(arrSelectedIDs && arrSelectedValues){
					strSelectedIDs = arrSelectedIDs[0];
					strSelectedValues = arrSelectedValues[0];
				}
					
				objFormElement.SetValueToLargeCombo(objFormElement.GetElement(), strSelectedIDs, strSelectedValues, lngFieldID);
			}
			else
			{
				var selectedValues="";
				for (var i=0; i < arrSelectedValues.length; i++)
				{
					if (i > 0){
						selectedValues += DEFAULT_VALUE_DELIM;
					}
					
					selectedValues += arrSelectedValues[i];
				}
				objFormElement.SetValue(selectedValues);
			}
			
			var objHTMLElement = objFormElement.GetElement();
			if (objHTMLElement && objHTMLElement.onchange)
			{
				objHTMLElement.onchange();
			}
			else
			{
				parent.OnRecordChanged(lngFieldID);
			}
		}
	}
	
	function CalcTimeDiff()
	{
		var objStartDate=document.getElementById("dt_792_792");
		var objStartTime=document.getElementById("tm_796_796");
		var objEndTime=document.getElementById("tm_797_797");
		var objTimeSpent=document.getElementById("txt_794_794");
		
		if(objStartDate && objStartTime && objEndTime && objTimeSpent){
			var strStart=objStartTime.value;
			var strEnd=objEndTime.value;
			var strDate=objStartDate.value;
			
			if(strStart!="" && strEnd!="" && strDate!=""){
				objTimeSpent.value=DateDiff(strDate, strStart, strEnd);
			}
		}
	}

	function DateDiff(strDate, strStartTime, strEndTime) 
	{
		var date1 = new Date();
		var date2 = new Date();
		var dateDiff = new Date();
		var lngHours=0;
		
		date1.setTime(new Date(strDate + " " + strStartTime).getTime());

		date2.setTime(new Date(strDate + " " + strEndTime).getTime());
		
		dateDiff.setTime(Math.abs(date1.getTime() - date2.getTime()));

		var timeDiff = dateDiff.getTime();
		
		//hours
		lngHours = Math.floor(timeDiff / (1000 * 60 * 60)); 
		timeDiff -= lngHours * (1000 * 60 * 60);

		if(timeDiff>0){
			//mins shown as a decimal amount of an hour
			lngHours+= (Math.floor(timeDiff / (1000 * 60))/60); 
		}
		
		return lngHours.toFixed(2);
	}
	
	function InitCalcTimeDiffOnBlur(strFieldName)
	{
		var oCtl=document.getElementById(strFieldName);
		if (oCtl){
			SetOnBlur(oCtl,"CalcTimeDiff()");
		}
		return true;
	}
		
	function SetOnBlur(oCtrl, strFunction)
	{
		if (oCtrl){
			var strBody="";
			if (oCtrl.onblur){
				strBody="var objFunction=" + oCtrl.onblur.valueOf() + ";"  + "objFunction();" + strFunction;
			}else{
				strBody=strFunction;
			}
			var objFunc=new Function ( strBody );
			oCtrl.onblur=objFunc;		
		}
	}
	</script>
	<style type="text/css">
	<!--
	input,textarea,select{
		font-family: tahoma, sans-serif;
		font-size:12px;
	}
	// -->
	</style>
</head>
<iframe id="ifrAutoSuggest" src="blank.htm" style="position: absolute;width: 400px; height: 170px;z-index: 16;display: none; border: 1px solid gray;overflow: none" frameborder="0" ></iframe>
<body id="frmMain" name="frmMain" class="RecordBody" 
style="margin:0; overflow:hidden;" leftmargin="0" rightmargin="0" 
onload="OnLoad();" onbeforeunload="OnBeforeUnload();" bottommargin="0" scroll="no">
	<div id="divCal" style="position:absolute;visibility:hidden;z-index:10;" onmouseover="SetMouse(true);" onmouseoff="SetMouse(false);"></div>
	<div class="TopToolBarPopup">
		<table width="98%" class="TopToolBarWizard">
			<tr>
				<td>
					<img src="../../theme/images/images/tasklist.png" />
				</td>
		        <td valign="top" style="padding-top:15px; padding-left:10px" width="100%">
		            <div class="WizardTitle"><script type="text/javascript">document.write(g_MqRef.RESX["TASK.POPUP_TITLE"]);</script></div>
		            <div class="WizardDescription"><script type="text/javascript">document.write(g_MqRef.RESX["TASK.POPUP_DESC"]);</script></div>
		        </td>
		    </tr>
		</table>
	</div>

	<!-- Start of Fields -->
	<form action="wcActItem.asp?wci=wcSaveAI&fid=<WC@FID></WC@FID>&ac=<WC@AC></WC@AC>"  
	style="display:block;position:absolute;top:2%;height:90%;width:100%;overflow:auto;margin-left:5px;"
	name="Record" id="Record" method="post" on-submit="return false;">
	<input type="hidden" id="pid" name="pid" value="<WC@PID></WC@PID>" />
	<input type="hidden" id="rid" name="rid" value="<WC@RID></WC@RID>" />
	
	<table style="position:absolute;width:100%;hei-ght:100%;top:15%; padding-left:10px;" class="RecordTab" cellspacing="0" >
		<Mq:Popup_GenFlds>
	</table>
	</form>
	
<!--/div-->		
	<!-- End of Fields -->
	
	<div style="position:absolute;bottom:0px;height:10%;width:100%">
	<!--table style="width:100%;p-osition:relative;bottom:40px;" cellpadding="0" cellspacing="0" border="0">
  	<tr>
		<td class="CommandBarBLeft" width="14" >&#160;</td>
  	<td class="CommandBarBCenter" align="center">&#160;</td>		
		<td class="CommandBarBRight" width="14" >&#160;</td>
		</tr>
	</table-->
	
	<table align="right" style="margin-right:10px; width:97%; position:absolute; bottom:5px;">
		<tr>
			<td align="right" width="50%">
				<script type="text/javascript">
					<!--
					var strHTML = "";
					//m_objMqButton.WriteButtonHTML("Cancel","window.close();","CancelT",false,m_objMqButton.STATE_1,"Cancel");
					strHTML += m_objMqButton.GetTextButtonHTML("OK", g_MqRef.RESX["BUTTON_OK"], 'OnOK()', "", 32, "display:inline-table;", g_MqRef.RESX["BUTTON_OK"], 90);
					strHTML += m_objMqButton.GetTextButtonHTML("Close", g_MqRef.RESX["BUTTON_CLOSE"], 'window.close()', "", 32, "display:inline-table;", g_MqRef.RESX["BUTTON_CLOSE"], 90);
					
					document.write(strHTML);
					//-->
				</script>				
			</td>
		</tr>
	</table>
	</div>
	
	<div id="loadingOverlay" class="ui-widget-overlay" style="width:100%;height:100%;z-index:1001;display:none"><img src="../../theme/images/images/icon_wait.gif" style="position:absolute; left:50%; top:50%;"/></div>

	<div style="visibility: hidden">
			<div id="dialog-modal" style="width:100%;height:100%;padding:0px;margin:0px;overflow:hidden">
				<iframe id="dialog-modal-url" width="100%" height="100%" marginWidth="0" marginHeight="0" frameBorder="0" scrolling="no"></iframe>
			</div>
			<div id="dialog-modal-orig-width" name="dialog-modal-orig-width" style="display:none"></div>
			<div id="dialog-modal-orig-height" name="dialog-modal-orig-height" style="display:none"></div>
		</div>
</body>	
</html>
