<!--DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"-->
<?xml version="1.0" encoding="UTF-8"?>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
	<title>Mass Update Issues</title>
	<!--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/vnhtmldocinit.js" ></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/vnhtmldocinit.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--><script type="text/javascript" src="../../js/frameconstants.js" ></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/frameconstants.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/controlsss.js" ></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/controlsss.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/mqtabs.js" ></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/<VIEW_FOLDER>/js/mqtabs.js" ></script></MqAbsPath-->
	<!--MqRelPath--><script type="text/javascript" src="../../js/dependentfields.js" ></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/dependentfields.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/xml.js" ></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/xml.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/mqloaddata.js" ></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/mqloaddata.js" ></script></MqAbsPath-->
	<!--MqRelPath--><script type="text/javascript" src="../js/cmqworkflowrules.js" ></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/<VIEW_FOLDER>/js/cmqworkflowrules.js" ></script></MqAbsPath-->
	<!--MqRelPath--><script type="text/javascript" src="../../js/censusmain.js" ></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/censusmain.js" ></script></MqAbsPath-->
	<!--MqRelPath--><script type="text/javascript" src="../../js/mqlist.js"></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/mqlist.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/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/cmqhttprequest.js" ></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/cmqhttprequest.js" ></script></MqAbsPath-->
	<!--MqRelPath--><script type="text/javascript" src="../../js/mqattachments.js"></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/mqattachments.js" ></script></MqAbsPath-->
	<!--MqRelPath--><script type="text/javascript" src="../js/viewconstants.js" ></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/<VIEW_FOLDER>/js/viewconstants.js" ></script></MqAbsPath-->
	<!--MqRelPath--><script type="text/javascript" src="../../js/vnloadingui.js"></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/vnloadingui.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-->
	<!--MqRelPath--><script type="text/javascript" src="../../js/CMqRecord.js"></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/CMqRecord.js"></script></MqAbsPath-->
	

	<script type="text/javascript">
		// always define this object for the system messages
		var objSysMsg = new CMqSysMsg();
		var m_varDefVals;
		var winMain;
		if (window.dialogArguments ){
		    winMain=window.dialogArguments;
		}else{
		    winMain=window.parent;
		}
			
		if(winMain.m_objDefVals){
			m_varDefVals= winMain.m_objDefVals.GetDefVals();
		}else{	
			m_varDefVals=new Array();
		}
		var m_strTheme="../../theme/css/CensusMain.css";	
		
		var HEADER_TITLE_RES="MASS_UPDATE.HEADER";
		var HEADER_DESC_RES="MASS_UPDATE.DESCRIPTION";
		
		var strHeaderRes=g_MqRef.MqStr.GetQueryStringValue(location.search, "TRES");
		if(strHeaderRes){
			if(strHeaderRes!=""){
				HEADER_TITLE_RES=strHeaderRes;
			}
		}
		
		var strDescRes=g_MqRef.MqStr.GetQueryStringValue(location.search, "DRES");
		if(strDescRes){
			if(strDescRes!=""){
				HEADER_DESC_RES=strDescRes;
			}
		}
		
		var strHeader2=g_MqRef.MqStr.GetQueryStringValue(location.search, "H2");
		
		var blnShowHeader2=false;
		if(strHeader2!=""){
			blnShowHeader2=true;
		}
		
	</script>
	
	<script type="text/javascript">	
		var m_objMqButton ;
		var objCustomCode;
		var objRequest;
		var m_strCurrentLocation;
		var mstrCurrentLocation;
		var m_objDisplayElements;
		var objTabsMgr;		
		var objFeatures;		
		var objFrames;
		var m_objLoadDataViewActions;
		var m_objWorkFlow;
		var m_objViewFields;
		var m_objLoadDataMgr;
		var m_objLookupItemInfoColl=new Array();
		var APPLY_BUTTON_NAME ="Apply";
		var CANCEL_BUTTON_NAME ="Cancel"
		var CLOSE_BUTTON_NAME="Close";
		var m_strNumVisibleTabs="8";
		var DISABLED_FIELDS="<Mq:DisabledBatchUpdateFlds>";
		var DISABLED_WORKFLOW_POSS_VAL_FLDS="<WC@DISABLED_WORKFLOW_FLDS></WC@DISABLED_WORKFLOW_FLDS>";
		var strDisabledFields="";
		var AlreadyEditing=false;
		
		if(DISABLED_FIELDS.length>0){
			if(DISABLED_WORKFLOW_POSS_VAL_FLDS.length>0){
				strDisabledFields=DISABLED_FIELDS+";"+DISABLED_WORKFLOW_POSS_VAL_FLDS;
			}else{
				strDisabledFields=DISABLED_FIELDS;
			}
		}else{
			if(DISABLED_WORKFLOW_POSS_VAL_FLDS.length>0){
				strDisabledFields=DISABLED_WORKFLOW_POSS_VAL_FLDS;
			}
		}
		var m_arrDisabledFields=strDisabledFields.split(";");
		var HIDDEN_FIELDS="";
		var m_arrHiddenFields=HIDDEN_FIELDS.split(";");
		var CLEAR_VALUE_BUTTON_CAPTION="Clear Value";
		var m_strIssueIDs=g_MqRef.MqStr.GetQueryStringValue(location.search, "IDs");
		var m_lngSLRetryCount=0;
		var m_lngLoadIssueRetryCount=0;
		var m_oVNLoadingUI;
		
		InitVar();
		
		var m_blnEdit=false;
		var m_blnNormalUnload;
		function OnLoad(blnNoDisplay){
			HideTabComponents(false, true, true);
			LoadDefVal(g_MqRef.MqStr.GetQueryStringValue(location.search, "DV"));
			if (!blnNoDisplay){
				SetDisplay(m_objViewFields);	
			}
			DisableButtons(true);
			DisableMqReadOnlyFields(m_objViewFields);
			//DisableNonMassUpdateFlds(m_objViewFields, m_arrDisabledFields);
			HideNonMassUpdateFlds(m_objViewFields, m_arrHiddenFields);
			HideNonVisibleFlds(m_objViewFields, g_MqRef.MqStr.GetQueryStringValue(location.search, "Show"));
			HideNonVisibleTabs(g_MqRef.MqStr.GetQueryStringValue(location.search, "ShowTabs"));
			SetFrameHeights();
			
			HideSLAInfoMsg();
			m_blnEdit=false;
		}
		function Exit()
		{
			var blnExit=true;
			if (m_blnEdit){
				var strMessage=winMain.MSG_EXIT_WITHOUT_SAVE;
						
				if (!window.confirm(strMessage)) {						
					blnExit=false;
				}
			}
			if (blnExit){
				m_blnNormalUnload=true;
				OnClose();
			}
		}
		
		function OnClose()
		{
				parent.CloseModalWindow();
			if(parent.fnBatchUpdateCallbackOnClose){
				parent.fnBatchUpdateCallbackOnClose();
			}
		}
		function OnBeforeUnload(){
				
			if (!m_blnNormalUnload){
				if (m_blnEdit){
					event.returnValue = winMain.MSG_EXIT_WITHOUT_SAVE;				
				}	
			}		
		}
		function SetDisplay(objViewFields)
		{
			if(m_objLoadDataMgr){
				var objDataHTMLDocument=m_objLoadDataMgr.GetDataHTMLDocumentObject();
			
				if(parent){
					if(objDataHTMLDocument){
						parent.ShowDefaultControls(null, objDataHTMLDocument);
					}
				}
				if (objViewFields){
					var varFields=objViewFields.GetFieldCol();
					var lngFieldID;
					var oField;
					
					var oHTMLElement;
					for(lngFieldID in varFields){							
						oField=objViewFields.Field(lngFieldID);
					    if (oField){
							oHTMLElement=m_objLoadDataMgr.GetHTMLElement(oField,objDataHTMLDocument);
							m_objLoadDataMgr.DisableDtsFieldButton(oField.GetBoundControl(),true,objDataHTMLDocument,new Array("_attach"));
							//ensure they are enabled, but if there is the MqHideAssCtrls attribute, they will be disabled
							m_objLoadDataMgr.DisableDtsFieldButton(oField.GetBoundControl(),false,objDataHTMLDocument,new Array("_HTMLEdit", "_MemoEdit"),oHTMLElement);
					    }
					}
				}			
			}
		}
				
				
				
		function DisableButtons(blnDisable)
		{

			if (blnDisable){
				m_objMqButton.DisableButton(APPLY_BUTTON_NAME);
				//m_objMqButton.DisableButton(CANCEL_BUTTON_NAME);
			}else{			
				m_objMqButton.EnableButton(APPLY_BUTTON_NAME);
				//m_objMqButton.EnableButton(CANCEL_BUTTON_NAME);
			}			
		}
		function Apply()
		{
			//set busy state
			m_oVNLoadingUI.Show();
			
			window.setTimeout("DoApply()", 10);
		}
		
		function DoApply()
		{
			var strMsg=SaveBatchChanges();
			if (strMsg!=""){
				alert(strMsg);
			}else{
				m_blnEdit=false;
				
				if(winMain){
					if(winMain.IsCompletelyIdle()){
								
						/*if(IssueWasInBatchUpdate(winMain.objRecord.GetRecordId())){
							m_lngLoadIssueRetryCount=0;
							LoadIssue();									
						}*/
						
						RegenerateSummaryList();
					}
				}	
				OnClose();
			}
		}
		
		function LoadIssue()
		{
			if(m_lngLoadIssueRetryCount<20){
				if(winMain){
					if(winMain.IsCompletelyIdle()){
						winMain.objControls.View();
					}else{
						m_lngLoadIssueRetryCount++;
						window.setTimeout("LoadIssue()", 200);
					}
				}
			}
		}
		
		function RegenerateSummaryList()
		{
			
			if(m_lngSLRetryCount<50){
				if(winMain){
					if(winMain.IsCompletelyIdle()){
						winMain.LoadData.RegenerateSumList(true, GetSQEFldID(), true);
					}else{
						m_lngSLRetryCount++;
						window.setTimeout("RegenerateSummaryList()", 200);
					}
				}
			}
		}
		
		function IssueWasInBatchUpdate(lngIssueID)
		{
			if(m_strIssueIDs=="AllInQ"){
				return true;
			}else{
				var arrIDs=m_strIssueIDs.split(";");
			
				return g_MqRef.MqArr.IsValueInArray(lngIssueID, arrIDs);
			}
		}
		
		function GetSQEFldID()
		{
			var lngFldID=-1;
			
			if(winMain){
				if(winMain.parent){
					if(winMain.parent.parent){
						if (winMain.parent.parent.SQE){
							var objFldCbo=winMain.parent.parent.SQE.document.getElementById("cbofield");
							if(objFldCbo){
								if(objFldCbo.selectedIndex>0){
									lngFldID=objFldCbo.options[objFldCbo.selectedIndex].value;
								}
							}
						}
					}
				}
			}	
					
			return lngFldID;	
		}
				
		function Cancel()
		{
			OnLoad();
			DisableButtons(true);	
			m_blnEdit=false;
		}
		function LoadDefVal(strDefVals)
		{

			if ( m_objLoadDataMgr){		

				if(m_objViewFields){
					var REV_NUM_NEW_ISSUE=0;
					m_varDefVals[m_objViewFields.GetRevisionHistoryFieldID()]=REV_NUM_NEW_ISSUE;
				}
				
				for(x=0; x<m_varDefVals.length; x++){
					m_varDefVals[x]="";
				}
				
				if (m_objWorkFlow){
					m_objWorkFlow.SetOrigFldValues(m_varDefVals);
				}
				
				if(strDefVals){
					if(strDefVals!=""){
						var arrTempDefVals=strDefVals.split("&");
						
						for(var x=0; x<arrTempDefVals.length; x++){
							var arrTempDefVal=arrTempDefVals[x].split("=");
							
							m_varDefVals[arrTempDefVal[0]]=arrTempDefVal[1];
						}
					}
				}
								
				//m_varDefVals["804"]="1";
				
				m_objLoadDataMgr.Load(m_varDefVals,null,m_objDisplayElements);										
			}	
		}
		function SaveBatchChanges()
		{
			var strReturn="";
			var strDataForSave="";
						
			if (m_objLoadDataMgr && objRequest){
					
				if(objCustomCode){
					strDataForSave=objCustomCode.CommitTimestamp();	
				}

				strDataForSave= m_objLoadDataMgr.GetDataForSave(true, true);				
				
				if (strDataForSave !== "") {	
					document.body.style.cursor = "wait";
					var strUrlPath=m_strCurrentLocation+"wcCmdBar.asp?wci=wciCommand&Command=Batch";
						strPostData ="nId="+m_strIssueIDs;
						if(typeof(BATCH_SC_AS_MC)!="undefined"){
							strPostData+="&MCSC="+BATCH_SC_AS_MC;
						}
						strPostData+="&bQueryString="+escape(strDataForSave);
						
					var co=objRequest.Post(strUrlPath,strPostData);
				
					if (co!=objRequest.CANCEL_PROCESS){					
						var objResponse=objRequest.Response(co);
						if (objResponse.HasErrors()){
							objResponse.ProcessErrors("",true);
						}else{
							var objMsg=objResponse.GetContent();
							if (objMsg){
								strReturn=objMsg.GetText();					
							}				
						}
					}	
					document.body.style.cursor = "default";	
				}		
			}	
			m_oVNLoadingUI.Hide();
			return strReturn;		
		}  
				
		function OnRecordChanged(lngFieldID)
		{
			if(m_objLoadDataMgr){
				m_objLoadDataMgr.SetFieldChanged(lngFieldID);	
				m_blnEdit=true;			
				DisableButtons(false);
			}
		}
				
		
		function HideSLAInfoMsg()
		{
			var strDocRef=m_objLoadDataMgr.GetDataHTMLDocument();
			var objDoc=eval(strDocRef);
			
			if(objDoc){
				var objSLAInfoMsg=objDoc.getElementById("SLAInfoMsg");
				
				if(objSLAInfoMsg){
					objSLAInfoMsg.style.display="none";
				}
			}
		}

		function DisableMqReadOnlyFields(objViewFields)
		{
			if (objViewFields){
				var varFields=objViewFields.GetFieldCol();
				var lngFieldID;
				var oField;
				var objDataHTMLDocument=m_objLoadDataMgr.GetDataHTMLDocumentObject();
				var oHTMLElement;
				for(lngFieldID in varFields){							
					oField=objViewFields.Field(lngFieldID);
				    if (oField){
						oHTMLElement=m_objLoadDataMgr.GetHTMLElement(oField,objDataHTMLDocument);
						if (oHTMLElement)
						{
							var mqReadOnlyAttr = oHTMLElement.getAttribute("mqreadonly");
							
							if (mqReadOnlyAttr != null)
							{
								oHTMLElement.readOnly = true;
							}
						}
				    }
				}
			}			
		}

		function DisableNonMassUpdateFlds(objViewFields, arrDisabledFlds)
		{
			if (objViewFields){
				var lngFieldID;
				var oField;
				var objDataHTMLDocument=m_objLoadDataMgr.GetDataHTMLDocumentObject();
				var oHTMLElement;
				for(x=0; x<arrDisabledFlds.length; x++){	
					lngFieldID=arrDisabledFlds[x];
					if(objViewFields.Exists(lngFieldID)){
						oField=objViewFields.Field(lngFieldID);
						if (oField){
							oHTMLElement=m_objLoadDataMgr.GetHTMLElement(oField,objDataHTMLDocument);
							if (oHTMLElement)
							{
								m_objDisplayElements.DisableElement(oHTMLElement, true, null, document);
							}
						}
					}
				}
			}			
		}

		function HideNonMassUpdateFlds(objViewFields, arrDisabledFlds)
		{
			if (objViewFields){
				var lngFieldID;
				var oField;
				var objDataHTMLDocument=m_objLoadDataMgr.GetDataHTMLDocumentObject();
				for(x=0; x<arrDisabledFlds.length; x++){	
					lngFieldID=arrDisabledFlds[x];
					if(objViewFields.Exists(lngFieldID)){
						HideField(lngFieldID, objDataHTMLDocument);
					}
				}
			}			
		}
		
		function HideField(lngFieldID, objDataHTMLDocument)
		{
			var oHTMLCaption=objDataHTMLDocument.getElementById("MqFC_"+lngFieldID);
			if (oHTMLCaption)
			{
				oHTMLCaption.style.display="none";
				oHTMLCaption.setAttribute("MqHidden", "1");
			}
				
			var oHTMLElement=objDataHTMLDocument.getElementById("MqF_"+lngFieldID);
			if (oHTMLElement)
			{
				oHTMLElement.style.display="none";
				oHTMLElement.setAttribute("MqHidden", "1");
			}
		}
		
		function ShowField(lngFieldID, objDataHTMLDocument)
		{
			var oHTMLCaption=objDataHTMLDocument.getElementById("MqFC_"+lngFieldID);
			if (oHTMLCaption)
			{
				oHTMLCaption.style.display="";
				oHTMLCaption.style.visibility="visible";
				oHTMLCaption.className="fieldVisibility";
				oHTMLCaption.setAttribute("MqHidden", "0");
			}
				
			var oHTMLElement=objDataHTMLDocument.getElementById("MqF_"+lngFieldID);
			if (oHTMLElement)
			{
				oHTMLElement.style.display="";
				oHTMLElement.style.visibility="visible";
				oHTMLElement.className="fieldVisibility";
				oHTMLElement.setAttribute("MqHidden", "");
			}
		}
		
		function HideNonVisibleFlds(objViewFields, strFieldsToShow)
		{
			if (objViewFields){
				if(strFieldsToShow){
					var arrFieldsToShow=strFieldsToShow.split(",");
					
					var varFields=objViewFields.GetFieldCol();
					var lngFieldID;
					var oField;
					var objDataHTMLDocument=m_objLoadDataMgr.GetDataHTMLDocumentObject();
					
					var oHTMLElement;
					for(lngFieldID in varFields){	
						if(!g_MqRef.MqArr.IsValueInArray(lngFieldID,arrFieldsToShow)){
							HideField(lngFieldID, objDataHTMLDocument);
						}
					}
					
					for(var x=0; x<arrFieldsToShow.length; x++){
						ShowField(arrFieldsToShow[x], objDataHTMLDocument);
					}
				}
			}			
		}
		
		function HideNonVisibleTabs(strTabsToShow)
		{
			if(strTabsToShow){
				if(objTabsMgr){
					var arrAllTabs=objTabsMgr.GetAllTabIDs();
					var arrTabsToShow=strTabsToShow.split(",");
					
					for(lngTabID in arrAllTabs){	
						if(!g_MqRef.MqArr.IsValueInArray(lngTabID,arrTabsToShow)){
							objTabsMgr.HideTab(lngTabID);
						}
					}
				}
			}
		}
		
		function InitVar()
		{
			if (winMain){
				m_objMqButton = new MqButton();
				objCustomCode=winMain.objCustomCode;
				objRequest=winMain.objRequest;
				m_strCurrentLocation=winMain.mstrCurrentLocation;
				mstrCurrentLocation=winMain.mstrCurrentLocation;
				m_objDisplayElements=winMain.m_objDisplayElements;				
				objTabsMgr=new CMqTabsMgr();
				var objOpenerTabsMgr=winMain.objTabsMgr;
				if (objOpenerTabsMgr){
					objTabsMgr.SetIsSharedTabSource(objOpenerTabsMgr.GetIsSharedTabSource());
					objTabsMgr.SetDisplayExceptionTabs(objOpenerTabsMgr.GetDisplayExceptionTabs());
				}
				objFeatures=winMain.objFeatures;
				m_objViewFields=winMain.m_objViewFields;
				m_objLoadDataMgr=new CMqLoadDataMgr(m_objViewFields);
				m_objLoadDataMgr.SetUnescapeData(true);
				m_objLoadDataMgr.OnBeforeLoad=OnBeforeLoadData
				m_objLoadDataMgr.OnAfterLoad=OnAfterLoadData;
				objFrames=winMain.objFrames;
				m_objWorkFlow=new CMqWorkFlowRules(m_objViewFields,m_objLoadDataMgr, m_MqAutoList, m_objDisplayElements);
				
				var arrButtons=new Array(APPLY_BUTTON_NAME, CLOSE_BUTTON_NAME);
				m_oVNLoadingUI=new VNLoadingUI(document, m_objMqButton, arrButtons);
		
			}
		}
		function OnBeforeLoadData()
		{
			if(m_objWorkFlow && m_objLoadDataMgr){
				m_objWorkFlow.Initialize(m_objViewFields,m_objLoadDataMgr.GetDataHTMLDocument(),m_MqAutoList);
				m_objWorkFlow.LoadBizRules();
			}
			return true;
		}
		
		function OnAfterLoadData()
		{
			if(m_objWorkFlow){
				m_objWorkFlow.OnLoad();
			}
			if(m_objLoadDataMgr){
				m_objLoadDataMgr.Reset();
			}
			if(m_objLoadDataViewActions){
				m_objLoadDataViewActions.Reset();
			}
			return true;
		}
		
		function HideTabComponents(blnHideTabStrip,blnHidePagingStrip, blnHideExpandCollapse)
		{
			var blnSetTimeout=true;
				
			if(document.getElementById("Tabs")){
				blnSetTimeout=false;
				var objTabsFrame = document.getElementById("Tabs").contentWindow;
				
				if(objTabsFrame){
					var objTabStrip = objTabsFrame.document.getElementById("divTabStrip");
					var objPagingStripHidden = objTabsFrame.document.getElementById("TabsActions");
							
					if(objTabStrip && objPagingStripHidden){
						if(blnHideTabStrip){
							objTabStrip.style.display="none";
							objPagingStripHidden.className="TabsBorder_Hidden";
						}else{
							objTabStrip.style.display="";
							objPagingStripHidden.className="TabsBorder";
						}
					}
					var objPagingStrip=objTabsFrame.document.getElementById("divSLPaging");
				
					if(objPagingStrip){
						if(blnHidePagingStrip){
							objPagingStrip.style.display="none";
						}else{
							objPagingStrip.style.display="";
						}
					}
				
					var objExpClps=objTabsFrame.document.getElementById("divSLExpClps");
					if(objExpClps){
						if(blnHideExpandCollapse){
							objExpClps.style.display="none";
						}else{
							objExpClps.style.display="";
						}
					}
				}
			}
			if(blnSetTimeout){
				window.setTimeout("HideTabComponents(" + blnHideTabStrip + "," + blnHidePagingStrip + "," + blnHideExpandCollapse + ")", 100);
			}
		}
		
		function GetRelatedFieldPossibleValues(lngSrcFldID)
		{
			if(Record){
				if(Record.GetRelatedFieldPossibleValues){
					Record.GetRelatedFieldPossibleValues(lngSrcFldID);
				}
			}			
		}
		
		function SetFrameHeights()
		{
			var objRecFra=document.getElementById("Record");
			if(objRecFra){
				var intBodyHeight;
				var intPadding=200;
				intPadding+=DEFAULT_TABS;
				
				if(blnShowHeader2){
					intPadding+=130;
				}
				
				var objHeader2=document.getElementById("Header2");
				if(objHeader2){
					if(blnShowHeader2){
						objHeader2.style.display="";
					}else{
						objHeader2.style.display="none";
					}
				}

				if (document.all){
					if (document.documentElement && document.documentElement.offsetHeight){
						intBodyHeight=document.documentElement.offsetHeight;
					}else{
						intBodyHeight=document.body.offsetHeight;
					}
				}else{
					intBodyHeight=window.innerHeight;
				}
				if(intBodyHeight>intPadding){
					objRecFra.style.height=(intBodyHeight-intPadding)+"px";
				}
			}
			
			var objTabsFra=document.getElementById("Tabs");
			if(objTabsFra){
				objTabsFra.style.height=DEFAULT_TABS + "px";
			}
		}
		
	</script>
</head>
<body id="DefValMain" class="MainBackgroundPopup" leftmargin="0" rightmargin="0" height="100%" onload="OnLoad();" onbeforeunload="OnBeforeUnload();" bottommargin="0" scroll="no">
	<div style="height:5px"></div>
	<div class="TopToolBarPopup">
		<table width="98%" class="TopToolBarWizard">
			<tr>
		        <td valign="top" style="padding-top:15px; padding-left:10px" width="100%">
		            <div class="WizardTitle"><script type="text/javascript">document.write(g_MqRef.RESX[HEADER_TITLE_RES]);</script></div>
		            <div class="WizardDescription"><script type="text/javascript">document.write(g_MqRef.RESX[HEADER_DESC_RES]);</script><br /><br /></div>
		        </td>
		    </tr>
		</table>
	</div>
	
	
	<div class="TopToolBarPopup" id="Header2" style="display:none">
		<table width="98%" class="TopToolBarWizard">
			<tr>
		        <td valign="top" style="padding-top:15px; padding-left:10px" width="100%">
		            <div class="WizardDescription" style="height:85px; overflow:auto"><script type="text/javascript">document.write(g_MqRef.MqStr.FormatString(g_MqRef.RESX[strHeader2], '<WC@H2ARG></WC@H2ARG>'));</script><br /><br /></div>
		        </td>
		    </tr>
		</table>
	</div>
	
	<table width="100%" marginwidth="0" cellpadding="0" cellspacing="0" border="0">	
		<tr hei-ght="30"><td>
			<iframe name="Tabs" id="Tabs" src="tabs.htm?TabsJs=DefValTabs.js" frameBorder="0" marginWidth="0" marginHeight="0" 
				scrolling="no" style="width:98%;margin-left:10px;margin-right:10px;" height="30">
			</iframe></td>
		</tr>
		<tr height="100%"><td height="100%">
			<script type="text/javascript" >
			var sRecSrc= g_MqRef.MqStr.GetQueryStringValue(location.search, "recsrc");
			
			if (sRecSrc==="")
			{
				sRecSrc="wcRecord.asp?";
			}
			
			var sHTML='<iframe name="Record" id="Record" src="' + sRecSrc + '" frameBorder="0" ';
			sHTML+='	marginWidth="0" marginHeight="0" scrolling="yes" height="300" ';
			sHTML+='	style="width:98%;margin-bottom:10px;margin-left:10px;margin-right:10px;';
			sHTML+=' background-color:#ffffff;border-radius: 4px;border:1px solid #cccccc;border-top:1px transparent;overflow:auto;">';
			sHTML+='</iframe>';
			
			document.write(sHTML);
			</script>
			
			</td>
		</tr>
		<tr height="30">
			<td style="padding-top:10px">
				<table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0">
					<tr>
						<td cla-ss="CommandBarBLeft" width="14" >&#160;</td>
						<td cla-ss="CommandBarBCenter" align="right">				
							<table cellpadding="0" cellspacing="0" border="0">
								<tr valign="top">
									<td width="80%"></td>							
									<td style="padding-right:5px">
										<script type="text/javascript">
											m_objMqButton.WriteTextButtonHTML(APPLY_BUTTON_NAME, g_MqRef.RESX["BUTTON_OK"], 'Apply()', "", 32, "", g_MqRef.RESX["BUTTON_OK"], 90);
										</script>
									</td>
									<!--td style="padding-right:5px">
										<script type="text/javascript">
											m_objMqButton.WriteTextButtonHTML(CANCEL_BUTTON_NAME, g_MqRef.RESX["BUTTON_CANCEL"], 'Cancel()', "", 32, "", g_MqRef.RESX["BUTTON_CANCEL_CHANGES"], 90);
										</script>
									</td-->
									<td>
										<script type="text/javascript">
											m_objMqButton.WriteTextButtonHTML(CLOSE_BUTTON_NAME, g_MqRef.RESX["BUTTON_CLOSE"], 'Exit()', "", 32, "", g_MqRef.RESX["BUTTON_CLOSE"], 90);
										</script>
									</td>
								</tr>
							</table>
						</td>
						<td cla-ss="CommandBarBRight" width="14" >&#160;</td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
	<div style="visibility: hidden;display:none">
		<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="auto"></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>
