var loc = window.location.href.toLowerCase().match(/(.*)?\.nsf/gi);function trimString (str) {  return str.replace(/^\s+/g, '').replace(/\s+$/g, '');}function cancelEntry(){	if(window.location.href.toLowerCase().indexOf("opendocument")==-1)	{		if(confirm("The Document is not saved.Are you sure to cancel? "))			window.location.href=window.parent.document.forms[0].txLastViewURL.value		else return	}	else		window.location.href=window.parent.document.forms[0].txLastViewURL.value}	function formClose(){if(confirm("The Document is not saved.Are you sure to cancel? "))	self.close()else return}//This function is used to open the document in edit modefunction edit(){var loc = window.location.href.toLowerCase();if (loc.match(/(.*)?\?/gi)){	loc = RegExp.$1;}window.location.href = loc + "?editdocument&login=1";}function getFieldValue(fieldName){	field = eval('document.forms[0].'+fieldName)		switch(field.type)	{		case "text" :		case "textarea" :		case "password" :		case "hidden" :		return field.value;		case "select-one" :			var l = field.selectedIndex;			if (l == -1)   return "";			else   return (field.options[l].value == "") ? field.options[l].text : field.options[l].value;		case "select-multiple" :			var allChecked = new Array();			for(s = 0; s < field.options.length; s++)			{				if(field.options[s].selected)				allChecked[allChecked.length] = (field.options[s].value == "") ? field.options[s].text : field.options[s].value;			}			return allChecked.join(",");		case "button" :		case "reset" :		case "submit" :			return "";		case "radio" :		case "checkbox" :			if (field.checked) { return field.value; } else { return ""; }		default :			if(field[0].type == "radio")			{				for (z = 0; z < field.length; z++)					if (field[z].checked)						return field[z].value;				return "";			}			else if(field[0].type == "checkbox")			{				var allChecked = new Array();				for(y = 0; y < field.length; y++)					if(field[y].checked)						allChecked[allChecked.length] = field[y].value;				return allChecked.join(",");			}	}}function setNullFieldValue(field){	switch(field.type)	{		case "text" :		case "textarea" :		case "password" :		case "hidden" :			field.value="";			return "";		case "select-one" :			field.selectedIndex=0;			return ""	;		case "select-multiple" :			var allChecked = new Array();			if (eval(field.name)=="1")			{				field.options.length =0			}			for(s = 0; s < field.options.length; s++)			{				field.options[s].selected = false;			}			return "";		case "button" :		case "reset" :		case "submit" :			return ""		case "radio" :		case "checkbox" :			field.checked = false;			return "";		default :			if(field[0].type == "radio")			{				for (m = 0; m < field.length;m++)				{					field[m].checked = false;				}			}			else if(field[0].type == "checkbox")			{				for(w = 0;w < field.length; w++)				{					field[w].checked = false;				}			}			return "";	}}/************************** End of setNullFieldValue Function************************************/function windowOpener(url, name, args) {	if (typeof(popupWin) != "object")	{		popupWin = window.open(url,name,args);	}	else	{		if (!popupWin.closed)		{ 			popupWin.location.href = url;		}		else		{			popupWin = window.open(url, name,args);		}	}	popupWin.focus();} function validateNotEmpty( strValue ) {/************************************************DESCRIPTION: Validates that a string is not all  blank (whitespace) characters.    PARAMETERS:   strValue - String to be tested for validity   RETURNS:   True if valid, otherwise false.*************************************************/   var strTemp = strValue;   strTemp = trimAll(strTemp);   if(strTemp.length > 0){     return true;   }     return false;}function trimAll( strValue ) {/************************************************DESCRIPTION: Removes leading and trailing spaces.PARAMETERS: Source string from which spaces will  be removed;RETURNS: Source string with whitespaces removed.*************************************************/  var objRegExp = /^(\s*)$/;    //check for all spaces    if(objRegExp.test(strValue)) {       strValue = strValue.replace(objRegExp, '');       if( strValue.length == 0)          return strValue;    }       //check for leading & trailing spaces   objRegExp = /^(\s*)([\W\w]*)(\b\s*$)/;   if(objRegExp.test(strValue)) {       //remove leading and trailing whitespace characters       strValue = strValue.replace(objRegExp, '$2');    }	return strValue }/************************** Start of setFieldValue Function************************************/function setFieldValue(fieldName, fieldValue){	field = eval('document.forms[0].'+fieldName)	fieldValue = trimAll(fieldValue)	switch(field.type)	{		case "text" :		case "textarea" :		case "password" :		case "hidden" :			field.value = fieldValue;			return ""		case "select-one" :						for(l=0;l<field.options.length;l++)			{				if ( trimAll(field.options[l].value) == fieldValue )				{					field.options[l].selected = true;					break;				}			}			return "";		case "select-multiple" :			var multiArrayVal = fieldValue.split("<br>")						if (field.options.length ==0)			{				field.options.length =  multiArrayVal.length				for (b =0;b<multiArrayVal.length;b++)				{					field[b].text=multiArrayVal[b]					field[b].value=multiArrayVal[b]				}			}			for ( r=0;r<multiArrayVal.length;r++)			{				for ( u=0;u<field.options.length;u++)				{					if ( trimAll(field.options[u].value) == trimAll (multiArrayVal[r]) )					{						field.options[u].selected = true;						break;					} 				}			}			return ""		case "button" :		case "reset" :		case "submit" :			return "";		case "radio" :		case "checkbox" :			if (fieldValue.length==0)			{				field.checked = false			}				else			{				field.checked = true			}					return ""		default :			if(field[0].type == "radio")			{				for (z = 0; z < field.length; z++)					if (field[z].value ==  fieldValue)						field[z].checked = true;			}			else if(field[0].type == "checkbox")			{				var multiArrayVal = fieldValue.split(",")				for ( e=0;e<multiArrayVal.length;e++)				{					for ( v=0;v<field.length;v++)					{						if ( trimAll(field[v].value) == trimAll (multiArrayVal[e]) )						{							field[v].checked = true;							break;						} 					}				}			}			return ""	}}/************************** End of setFieldValue Function************************************//* The Following 3 functions used to set the Iframe Height Dynamically  */function goSetHeight(FrameId){	parent.setIframeHeight(FrameId)}function setIframeHeight(FrameId) {  var iframeWin = window.frames[FrameId];  var iframeEl = document.getElementById? document.getElementById(FrameId): document.all? document.all[FrameId]: null;  if ( iframeEl && iframeWin ) {    iframeEl.style.height = "auto"; // helps resize (for some) if new doc shorter than previous      var docHt = getDocHeight(iframeWin.document);    // need to add to height to be sure it will all show    if (docHt) iframeEl.style.height = docHt + 30 + "px";  }}function getDocHeight(doc) {  var docHt = 0, sh, oh;  if (doc.height)  docHt = doc.height;  	else if (doc.body) 	{    		if (doc.body.scrollHeight) docHt = sh = doc.body.scrollHeight;		    		if (doc.body.offsetHeight)  docHt = oh = doc.body.offsetHeight;    		if (sh && oh) docHt = Math.max(sh, oh); 	 }  return docHt;}// To give focus to popup window called in form 04. Image \01.Image | ImageLibrary | Imagefunction windowOpener(url, name, args) {if (typeof(popupWin) != "object"){popupWin = window.open(url,name,args);} else {if (!popupWin.closed){ popupWin.location.href = url;} else {popupWin = window.open(url, name,args);}}popupWin.focus();}//The below functions are used for multiple value picker and pop up//------------Start---------------var doc="";var dburl=getCurdbUrl();function getCurdbUrl(){var loc = window.location.href.toLowerCase();getCurdbUrl = loc.match(/(.*)?\.nsf/gi);return getCurdbUrl;}function Popup(fldname,Label){	strURL='frmSingleValuePicker?Openform&amp;returnfield='+fldname+'&LabelName='+Label;	ht= 500;	wh=700;	strURL="/"+dbPath+"/"+strURL;	setTimeout("window.open('"+strURL+"', 'popupWindow' ,'toolbar=no,directories=no,status=no,scrollbars=yes, resizable=yes,resize=yes, menubar=no, height=" + ht + ",width=" + wh + "')", 1);}function MultivaluePopup(fldname){strURL='dlgMultiValuePicker?Openform&amp;returnfield='+fldname+'&amp;LabelName=Approvers';	wh=800;	ht= 500;	strURL="/"+dbPath+"/"+strURL;	setTimeout("window.open('"+strURL + "', 'popupWindow', 'toolbar=no,directories=no,status=no,scrollbars=yes,resizable=yes,resize=yes,menubar=no,height=" + ht + ",width=" + wh + "')", 1);}function MultivalueNames(fldname){strURL='dlgMultiValuePicker?Openform&amp;returnfield='+fldname+'&amp;LabelName=Approvers&amp;form=ApproverConfig';	wh=800;	ht= 550;	strURL="/"+dbPath+"/"+strURL;//	setTimeout("window.open('"+strURL + "', 'popupWindow', 'toolbar=no,directories=no,status=no,scrollbars=yes,resizable=yes,resize=yes,menubar=no,height=" + ht + ",width=" + wh + "')", 1);newwin=window.open(strURL, 'popupWindow', 'toolbar=no,directories=no,status=no,scrollbars=yes,resizable=yes,resize=yes,menubar=no,height=' + ht + ',width=' + wh + '')newwin.focus();return newwin}//-This function is used for Pop upfunction ShowValuePicker(LabelName,PickerForm,DbPath,FieldName,ViewName,DisplayCol,GetValCol,RestrictToCategory){		if (RestrictToCategory=="") 	{		strURL=PickerForm+'?openform&amp;returnfield='+FieldName+'&amp;db='+DbPath+'&amp;view='+ViewName+'&amp;columns='+DisplayCol+'&amp;returncol='+GetValCol+'&LabelName='+LabelName;	}	else	{		strURL=PickerForm+'?openform&amp;returnfield='+FieldName+'&RestrictToCategory='+RestrictToCategory+'&amp;db='+DbPath+'&amp;view='+ViewName+'&amp;columns='+DisplayCol+'&amp;returncol='+GetValCol+'&LabelName='+LabelName;		}	strURL="/"+dbPath+"/"+strURL	newwin=window.open(strURL, 'popupwindow', 'toolbar=no,directories=no,status=no,scrollbars=yes, resizable=yes, resize=yes, menubar=no,top =100,left =180,height=500,width=800');		newwin.focus()     return newwin}//function ShowDocsPicker(LabelName,PickerForm,DbPath,FieldName,ViewName,DisplayCol,GetValCol,RestrictToCategory){		if (RestrictToCategory=="") 	{		strURL=PickerForm+"?openform&amp;returnfield="+FieldName+"&amp;db="+DbPath+"&amp;view="+ViewName+"&amp;columns="+DisplayCol+"&amp;returncol="+GetValCol+"&LabelName="+LabelName+"&DocType=NonDDA";	}	else	{		strURL=PickerForm+"?openform&amp;returnfield="+FieldName+"&RestrictToCategory="+RestrictToCategory+"&amp;db="+DbPath+"&amp;view="+ViewName+"&amp;columns="+DisplayCol+"&amp;returncol="+GetValCol+"&LabelName="+LabelName+"&DocType=NonDDA";	}	strURL="/"+dbPath+"/"+strURL	newwin=window.open(strURL, "popupwindow", "toolbar=no,directories=no,status=no,scrollbars=yes, resizable=yes, resize=yes, menubar=no,top =100,left =180,height=500,width=800");		newwin.focus()     return newwin}////-This function is used to remove empty space from list boxfunction setListBoxLength(){	var OptionObjs=document.getElementsByTagName('select')	for(i=0;i<OptionObjs.length;i++)	{		if (OptionObjs[i].length==1 && (OptionObjs[i])[0].text=="")		{			OptionObjs[i].length=0		}	}}function dominoFormRefresh() { 		if( window.document.forms[0].name == "" ) { 	// read mode		window.location.reload(true); 		return false;	}	else{	// edit mode		_doClick('$Refresh', this, null, null);       		return false;	}	}//--------------End of function---------------function showMenuDiv(SnippetName){  	SnippetName=SnippetName.replace(/ /gi,"")	var menuDiv = document.getElementById(SnippetName).childNodes[0]     cleanWhitespace(menuDiv)	//Removing  whitespaces from the all childnodes	if (QS == '')	{		for(i=0;i<menuDiv.childNodes.length;i++)		{			if (menuDiv.childNodes[i].id.split('.').length==2)			{				menuDiv.childNodes[i].style.display='none'			}			}		return	}	QS = QS.replace(/^[A-Z]|[a-z]*.^[A-Z]|[a-z]/gi,"M")	var x = QS.split('.')	if (x.length>=1)	{		for(i=0;i<menuDiv.childNodes.length;i++)		{			if (menuDiv.childNodes[i].id.split('.').length==2)			{				menuDiv.childNodes[i].style.display='none'			}				if (menuDiv.childNodes[i].id==x[0])			{				menuDiv.childNodes[i].getElementsByTagName("a")[0].className+='selected'			}						if(menuDiv.childNodes[i].id.split('.').length==2 && menuDiv.childNodes[i].id.split('.')[0]==x[0])			{				menuDiv.childNodes[i].style.display='block'			}		}	}	if(x.length>=2)	{		for(i=0;i<menuDiv.childNodes.length;i++)		{			if (menuDiv.childNodes[i].id==x[0]+"."+x[1])			{				menuDiv.childNodes[i].getElementsByTagName("a")[0].className+='selected'			}			if(menuDiv.childNodes[i].id.split('.').length==3 && menuDiv.childNodes[i].idsplit('.')[0]+"."+menuDiv.childNodes[i].id.split('.')[1]==x[0]+"."+x[1])			{				menuDiv.childNodes[i].style.display='block'			}		}	}	if(x.length==3)	{		for(i=0;i<menuDiv.childNodes.length;i++)		{			if (menuDiv.childNodes[i].id==QS)			{				menuDiv.childNodes[i].getElementsByTagName("a")[0].className+='selected'			}		}	}}//----------------------------------- To Move Websnippets Up or down ---------------------------------------------------------------//------------------------------------End of function to move Websnippet up or down---------------------------------------function MoveUp(obj){if(obj.options.length==0){	alert("List Should not be empty, Select the Websnippet list And click here")	return false}var count=0;var selectedIndex = 0;for (i=obj.length-1;i>=0;i--){	if(obj.options[i].selected == true) 	{		count =count +1		selectedIndex = i;	}	}if(count >1){	alert("You can not select more than one value")	return false}if(selectedIndex==0){		alert("You cant Move Up the first Value, Select some other value")		return false}				if (document.forms[0].name=="_frmHomePageSetup")	{		var tempText=obj.options[selectedIndex].text.substr(obj.options[selectedIndex].text.indexOf(".")+1)		obj.options[selectedIndex].text =obj.options[selectedIndex].text .charAt(0)+"."+obj.options[selectedIndex-1].text.substr(obj.options[selectedIndex-1].text.indexOf(".")+1)		obj.options[selectedIndex-1].text =obj.options[selectedIndex-1].text .charAt(0)+"."+tempText				var tempValue=obj.options[selectedIndex].value.substr(obj.options[selectedIndex].value.indexOf(".")+1)		obj.options[selectedIndex].value =obj.options[selectedIndex].value .charAt(0)+"."+obj.options[selectedIndex-1].value.substr(obj.options[selectedIndex-1].value.indexOf(".")+1)		obj.options[selectedIndex-1].value =obj.options[selectedIndex-1].value .charAt(0)+"."+tempValue	}	else	{		var tempText=obj.options[selectedIndex].text		obj.options[selectedIndex].text =obj.options[selectedIndex-1].text		obj.options[selectedIndex-1].text =tempText				var tempValue=obj.options[selectedIndex].value		obj.options[selectedIndex].value =obj.options[selectedIndex-1].value		obj.options[selectedIndex-1].value =tempValue	}				obj.options[selectedIndex].selected = false	obj.options[selectedIndex-1].selected = true}function MoveDown(obj){if(obj.options.length==0){	alert("List Should not be empty, Select the Websnippet list And click here")	return false}var count=0;var selectedIndex = 0;for (i=obj.length-1;i>=0;i--){	if(obj.options[i].selected == true) 	{		count =count +1		selectedIndex = i;	}	}if(count >1){	alert("You can not select more than one value")	return false}if(selectedIndex==obj.options.length-1){		alert("You cant Move Down the last Value, Select some other value")		return false}		if (document.forms[0].name=="_frmHomePageSetup")	{		var tempText=obj.options[selectedIndex].text.substr(obj.options[selectedIndex].text.indexOf(".")+1)		obj.options[selectedIndex].text =obj.options[selectedIndex].text .charAt(0)+"."+obj.options[selectedIndex+1].text.substr(obj.options[selectedIndex+1].text.indexOf(".")+1)		obj.options[selectedIndex+1].text =obj.options[selectedIndex+1].text .charAt(0)+"."+tempText				var tempValue=obj.options[selectedIndex].value.substr(obj.options[selectedIndex].value.indexOf(".")+1)		obj.options[selectedIndex].value =obj.options[selectedIndex].value .charAt(0)+"."+obj.options[selectedIndex+1].value.substr(obj.options[selectedIndex+1].value.indexOf(".")+1)		obj.options[selectedIndex+1].value =obj.options[selectedIndex+1].value .charAt(0)+"."+tempValue	}	else	{			var tempText=obj.options[selectedIndex].text		obj.options[selectedIndex].text =obj.options[selectedIndex+1].text		obj.options[selectedIndex+1].text =tempText				var tempValue=obj.options[selectedIndex].value		obj.options[selectedIndex].value =obj.options[selectedIndex+1].value		obj.options[selectedIndex+1].value =tempValue	}		obj.options[selectedIndex].selected = false	obj.options[selectedIndex+1].selected = true}function ListAdd(val){var strLoc = location.hrefvar newwinstrURL=strLoc.split('.nsf')[0]+'.nsf/dlgMultiValuePicker?openform&amp;returnfield='+val+'&amp;db=' + dbPath +'&amp;view=LookupWebSnippets&amp;columns=0~^1&amp;returncol=0&amp;frm=Content'; wh=800;ht= 500;newwin=window.open( strURL ,"popupWindow","toolbar=no,directories=no,status=no,scrollbars=yes, resizable=yes,resize=yes, menubar=no,top=150,left=200, height=" + ht + ",width=" + wh)newwin.focus()return newwin}function ListRemove(obj){	if(obj.options.length==0)	{		alert("List Should not be empty, Select the Websnippet list And click here")		return false	}	if (document.forms[0].name=="_frmHomePageSetup")	{		for (i=obj.length-1;i>=0;i--)		{			if(obj.options[i].selected == true) 				obj.options[i]= null		}		for (i=obj.length-1;i>=0;i--)		{		obj.options[i].text = obj.options[i].text.substr(obj.options[i].text.indexOf(".")+1)		obj.options[i].value= obj.options[i].text		}		for (j=1;j<=obj.length;j++)		{		obj.options[j-1].text = j +"."+obj.options[j-1].text 		obj.options[j-1].value = j +"."+obj.options[j-1].value		}			}	else	{		for (i=obj.length-1;i>=0;i--)		{			if(obj.options[i].selected == true) 				obj.options[i]= null		}	}}function highlightTopMenu(){	if(typeof AppTitle != "undefined")	{		AppTitle = AppTitle.replace(/ /g, "")		if(AppTitle!="")		{		if(document.getElementById(AppTitle))	     	document.getElementById(AppTitle).className += "selected"	     }		}}	function closePopupsOnParentUnload() {      try	{		if (newwin && newwin.open && !newwin.closed) 		{					newwin.close();  		}  	}	catch(e){ }	}//------------------------------------------------------------------------------------//This function will call an Ajax Agentfunction ProcessUserRequest(Arguments,AgentName){	var loc = window.location.href.toLowerCase().match(/(.*)?\.nsf/gi);    	var objHTTP = "";	var strURL = "";	if (window.XMLHttpRequest) 	{        	objHTTP = new XMLHttpRequest();	 }	else	{		objHTTP = new ActiveXObject("Microsoft.XMLHTTP");	}	strURL = loc+ "/"+AgentName+"?OpenAgent";		objHTTP.open("POST", strURL, false, "", "");	objHTTP.setRequestHeader("Content-type", "application/x-www-form-urlencoded");	objHTTP.send(Arguments)		resp = objHTTP.responseText; 	objHTTP = null;	return resp;         }//-------------------------------------------------------------------------------------------function OpenColorPicker(filedname){    	var loc= location.href.toLowerCase().split(".nsf")[0]+".nsf"	var frmurl=loc+"/frmColorPicker?OpenForm&filedname="+filedname	newwin = window.open(frmurl,"dialog","width=230, top = 150, left = 100, height=290, location=no, menubar=no, status=no, toolbar=no, scrollbars=no, resizable=no")	newwin.focus()     return newwin}function cleanHTML( strHTML ){	strHTML = strHTML.replace(/color="?[^" >]*"?/gi, '')	strHTML = strHTML.replace(/([^-])color:[^;}"']+;?/gi, '$1')	strHTML = strHTML.replace(/size="?[^" >]*"?/gi, '')	strHTML = strHTML.replace(/font-size:[^;}"']+;?/gi, '')	strHTML = strHTML.replace(/face="?[^" >]*"?/gi, '')	strHTML = strHTML.replace(/font-family:[^;}"']+;?/gi, '')	strHTML = strHTML.replace(/style="[^"]*"/gi, '')	strHTML = strHTML.replace(/<font[^>]*>/gi, '')	strHTML = strHTML.replace(/<\/font>/gi, '')	return strHTML}//To see the Websnippet outputfunction snippetPreview(obj){	if(obj.options.length==0)	{		alert("List Should not be empty, Select the Websnippet list And click here")		return false	}var count=0;var selectedIndex = 0;for (i=obj.length-1;i>=0;i--){	if(obj.options[i].selected == true) 	{		count =count +1		selectedIndex = i;	}	}if(count >1){	alert("You can not select more than one value")	return false}var tempText=obj.options[selectedIndex].textif(document.forms[0].name=="_frmContent")	var varloc=window.location.href.toLowerCase().match(/(.*)?\.nsf/gi) +"/Lookupcontentbysubject/"+tempText+"?OpenDocument"else if(document.forms[0].name=="_frmHomePageSetup")	var varloc=window.location.href.toLowerCase().match(/(.*)?\.nsf/gi) +"/LookupWebSnippets/"+tempText.substr(tempText.indexOf(".")+1)+"?OpenDocument"else	var varloc=window.location.href.toLowerCase().match(/(.*)?\.nsf/gi) +"/LookupWebSnippets/"+tempText+"?OpenDocument"windowOpener(varloc, "WebsnippetPreview", 'toolbar=no,directories=no,status=no,scrollbars=yes, resizable=yes, menubar=no,top=200,left=400, height=450,width=450')}/*********************************************************************************Field Configuration: Values for Select box :Enter values here */function SelectOptions(Link){retStr=Link.split('~')if(retStr[0]!=""){window.location.href=document.getElementsByTagName("base")[0].href+retStr[0]	}else	alert("Please select the value")}function DDASelectOptions(Link){retStr=Link.split('~')if(retStr[0]!=""){window.location.href=document.getElementsByTagName("base")[0].href+"/"+retStr[0]+"&mode=DDA"}else	alert("Please select the value")}/*********************************************************************************Field Configuration: Values for Select box :Take values from View Column */function SelectOptionsLookup(ComboValue,ViewName){if (document.forms[0].NoOfDocs)		var noofdocs=getFieldValue("NoOfDocs")	else 		noofdocs=10		if(noofdocs !="" && noofdocs!=undefined)	 	noofdocs=parseInt(noofdocs)	 else 		 noofdocs =10if(ViewName=="LookupPersonByService"){	SelectOptionsLookupPerson(ComboValue,ViewName)	return}var ViewToSearch=ViewNameif( ComboValue=="--Select--"){	alert("Please select the value")	return}if(ComboValue!="All"){	pathsearch = "/" +DBpath +"/"+ViewToSearch+"?SearchView&ViewTitle="+ViewToSearch+"&searchfuzzy=false&Query="+ComboValue}else{	pathsearch = "/" +DBpath +"/"+ViewToSearch+"?SearchView&ViewTitle="+ViewToSearch+"&searchfuzzy=false&Query=[contentType] CONTAINS CASE STUDY OR [contentType] CONTAINS PERSON"}	var strID = '&id=' + QSwindow.location.href = pathsearch +"&start=1&count="+noofdocs+ strID}function DDASelectOptionsLookup(ComboValue,ViewName){	if (document.forms[0].NoOfDocs)		var noofdocs=getFieldValue("NoOfDocs")	else 		noofdocs=10		if(noofdocs !="" && noofdocs!=undefined)	 	noofdocs=parseInt(noofdocs)	 else 		 noofdocs =10if(ViewName=="LookupPersonByService"){	DDASelectOptionsLookupPerson(ComboValue,ViewName)	return}var ViewToSearch=ViewNameif( ComboValue=="--Select--"){	alert("Please select the value")	return}if(ComboValue!="All"){	pathsearch = "/" +DBpath +"/"+ViewToSearch+"?SearchView&ViewTitle="+ViewToSearch+"&searchfuzzy=false&mode=DDA&Query="+ComboValue}else{	pathsearch = "/" +DBpath +"/"+ViewToSearch+"?SearchView&ViewTitle="+ViewToSearch+"&searchfuzzy=false&mode=DDA&Query=[contentType] CONTAINS CASE STUDY OR [contentType] CONTAINS PERSON"}	var strID = '&id=' + QSwindow.location.href = pathsearch +"&start=1&count="+noofdocs+ strID+"&mode=DDA"}/*This fuction is used for "Find a Member of staff : By service combo" */function SelectOptionsLookupPerson(ComboValue,ViewName){if (document.forms[0].NoOfDocs)var noofdocs=getFieldValue("NoOfDocs")else 	noofdocs=5	if(noofdocs !="" && noofdocs!=undefined)	 	noofdocs=parseInt(noofdocs)	 else 		 noofdocs =5 		 var ViewToSearch=ViewNameif( ComboValue=="--Select--"){	alert("Please select the value")	return}if (document.implementation && document.implementation.createDocument)     {				var xmlDoc =document.implementation.createDocument("","",null); // For FireForx	     }     else     {		var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");  // For IE     }       	 xmlDoc.async=false; xmlDoc.load("/" +DBpath +"/"+ViewToSearch+"?Readviewentries&RestrictToCategory="+ComboValue);   if(!xmlDoc) return ""  var nodeResult = xmlDoc.getElementsByTagName("entrydata")  if(ComboValue!="All"){var person=nodeResult[0].getElementsByTagName("text")pathsearch = "/" +DBpath +"/vwPersonDisplay?SearchView&ViewTitle=vwPersonDisplay&searchfuzzy=false&Query=[Subject] CONTAINS "+person[0].text}else{pathsearch = "/" +DBpath +"/vwPersonDisplay?SearchView&ViewTitle=vwPersonDisplay&searchfuzzy=false&Query=[contentType] CONTAINS PERSON &start=1&count="+noofdocs}var strID = '&id=' + QSwindow.location.href = pathsearch + strID}function DDASelectOptionsLookupPerson(ComboValue,ViewName){if (document.forms[0].NoOfDocs)		var noofdocs=getFieldValue("NoOfDocs")	else 		noofdocs=5		if(noofdocs !="" && noofdocs!=undefined)	 	noofdocs=parseInt(noofdocs)	 else 		 noofdocs =5var ViewToSearch=ViewNameif( ComboValue=="--Select--"){	alert("Please select the value")	return}if (document.implementation && document.implementation.createDocument)     {				var xmlDoc =document.implementation.createDocument("","",null); // For FireForx	     }     else     {		var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");  // For IE     }       	 xmlDoc.async=false; xmlDoc.load("/" +DBpath +"/"+ViewToSearch+"?Readviewentries&RestrictToCategory="+ComboValue);   if(!xmlDoc) return ""  var nodeResult = xmlDoc.getElementsByTagName("entrydata")  if(ComboValue!="All"){var person=nodeResult[0].getElementsByTagName("text")pathsearch = "/" +DBpath +"/vwPersonDisplay?SearchView&ViewTitle=vwPersonDisplay&searchfuzzy=false&mode=DDA&Query=[Subject] CONTAINS "+person[0].text}else{pathsearch = "/" +DBpath +"/vwPersonDisplay?SearchView&ViewTitle=vwPersonDisplay&searchfuzzy=false&mode=DDA&Query=[contentType] CONTAINS PERSON"}var strID = '&id=' + QSwindow.location.href = pathsearch +"&start=1&count="+noofdocs+ strID}//-------End combo-----------------------------------------------------------------//-----------------------------------------TextBox-------------------------------------------------------------------------------------function TextBoxClick(Name,ViewToSearch){if (document.forms[0].NoOfDocs)		var noofdocs=getFieldValue("NoOfDocs")	else 		noofdocs=10		if(noofdocs !="" && noofdocs!=undefined)	 	noofdocs=parseInt(noofdocs)	 else 		 noofdocs =10if (ViewToSearch.toLowerCase()=="vwpersondisplay")	pathsearch = "/" +DBpath +"/"+ViewToSearch+"?SearchView&ViewTitle="+ViewToSearch+"&searchfuzzy=false&Query=[PersonName] contains "+Name+"*";else		pathsearch = "/" +DBpath +"/"+ViewToSearch+"?SearchView&ViewTitle="+ViewToSearch+"&searchfuzzy=false&Query="+Name;var strID = '&id=' + QSwindow.location.href = pathsearch +"&start=1&count="+noofdocs+ strID}function DDATextBoxClick(Name,ViewToSearch){if (document.forms[0].NoOfDocs)		var noofdocs=getFieldValue("NoOfDocs")	else 		noofdocs=10		if(noofdocs !="" && noofdocs!=undefined)	 	noofdocs=parseInt(noofdocs)	 else 		 noofdocs =10if (ViewToSearch.toLowerCase()=="vwpersondisplay")	pathsearch = "/" +DBpath +"/"+ViewToSearch+"?SearchView&ViewTitle="+ViewToSearch+"&searchfuzzy=false&Query=[PersonName] contains "+Name+"*&mode=DDA";else		pathsearch = "/" +DBpath +"/"+ViewToSearch+"?SearchView&ViewTitle="+ViewToSearch+"&searchfuzzy=false&Query="+Name+"&mode=DDA";var strID = '&id=' + QSwindow.location.href = pathsearch +"&start=1&count="+noofdocs+ strID}//----------------------------------------Check box-------------------------------------------------------------------------// This function is used when a check box is used without a TextBoxfunction CheckOptions(val){	for(i=0;i<val.length;i++)	{		if(val[i].checked)		{			alert(val[i].value)		}	}}// This function is used when a check box is used with ashow a TextBox Optionfunction CheckOptionsWithText(text,val,ViewName){if (document.forms[0].NoOfDocs)		var noofdocs=getFieldValue("NoOfDocs")	else 		noofdocs=10		if(noofdocs !="" && noofdocs!=undefined)	 	noofdocs=parseInt(noofdocs)	 else 		 noofdocs =10var ViewToSearch=ViewName;searchParticular="";searchAll="";	for(i=0;i<val.length;i++)		{			if(val[i].checked)				{				//To form the search query based on contentType				if(val[i].value=="All Categories")					{					searchAll ="[contentType] CONTAINS News OR [contentType] CONTAINS Events OR [contentType] CONTAINS Publications OR [contentType] CONTAINS Live Wire "					}				if (searchParticular=="")					{					searchParticular="[contentType] CONTAINS "+val[i].value 					}				else					{					searchParticular=searchParticular +" OR "+"[contentType] CONTAINS "+val[i].value					}				}		}			if(searchAll=="")			{				searchstring=searchParticular;			}			else			{				searchstring=searchAll;			 }var strID = '&id=' + QSif(searchstring==""){pathsearch = "/" +DBpath +"/"+ViewToSearch+"?SearchView&ViewTitle="+ViewToSearch+"&searchfuzzy=false&Query="+text}else{pathsearch = "/" +DBpath +"/"+ViewToSearch+"?SearchView&ViewTitle="+ViewToSearch+"&searchfuzzy=false&Query="+text+" AND "+searchstring}window.location.href=pathsearch +"&start=1&count="+noofdocs+ strID}function DDACheckOptionsWithText(text,val,ViewName){if (document.forms[0].NoOfDocs)		var noofdocs=getFieldValue("NoOfDocs")	else 		noofdocs=10		if(noofdocs !="" && noofdocs!=undefined)	 	noofdocs=parseInt(noofdocs)	 else 		 noofdocs =10var ViewToSearch=ViewName;searchParticular="";searchAll="";	for(i=0;i<val.length;i++)		{			if(val[i].checked)				{				//To form the search query based on contentType				if(val[i].value=="All Categories")					{					searchAll ="[contentType] CONTAINS News OR [contentType] CONTAINS Events OR [contentType] CONTAINS Publications OR [contentType] CONTAINS Live Wire "					}				if (searchParticular=="")					{					searchParticular="[contentType] CONTAINS "+val[i].value					}				else					{					searchParticular=searchParticular +" OR "+"[contentType] CONTAINS "+val[i].value					}				}		}			if(searchAll=="")			{				searchstring=searchParticular;			}			else			{				searchstring=searchAll;			 }var strID = '&id=' + QSif(searchstring==""){pathsearch = "/" +DBpath +"/"+ViewToSearch+"?SearchView&ViewTitle="+ViewToSearch+"&searchfuzzy=false&Query="+text;}else{pathsearch = "/" +DBpath +"/"+ViewToSearch+"?SearchView&ViewTitle="+ViewToSearch+"&searchfuzzy=false&Query="+text+" AND "+searchstring}window.location.href=pathsearch +"&mode=DDA&start=1&count="+noofdocs+ strID}//-----------------------------------END REMOVE----------------------------/*------------------------------------------------------------------------------   Function to remove the whitespaces from a all childnoded of a node  ---------------------------------------------------------------------------------*/function cleanWhitespace(node) {     notWhitespace =/\S/   for (var x = 0; x < node.childNodes.length; x++) {    var childNode = node.childNodes[x]    if ((childNode.nodeType == 3)&&(!notWhitespace.test(childNode.nodeValue))) {   // that is, if it's a whitespace text node      node.removeChild(node.childNodes[x])      x--    }    if (childNode.nodeType == 1) {    // elements can have text child nodes of their own      cleanWhitespace(childNode)    }  }}/* Author : NancyDescription : Called from the Delete Image onclick in all the dispaly views. Delete the current document.*/function DeleteDoc(Arguments,AgentName){		var objHTTP = "";	var strURL = "";	if (window.XMLHttpRequest) 	{        	objHTTP = new XMLHttpRequest();	 }	else	{		objHTTP = new ActiveXObject("Microsoft.XMLHTTP");	}			if (confirm("Do you want to delete this document?"))	{		strURL = loc+ "/"+AgentName+"?OpenAgent";		objHTTP.open("POST", strURL, false, "", "");	objHTTP.setRequestHeader("Content-type", "application/x-www-form-urlencoded");	objHTTP.send("single~@~"+Arguments)	}		else 	return;	resp = objHTTP.responseText	if (resp)	{		alert("Document Deleted Successfully")		if(ViewName=="LookupImageMapDetails")			document.frames.location.href=location.href.toLowerCase().split(".nsf")[0]+".nsf/"+ViewName+"?openview&RestrictToCategory="+uniqueValImgMap+"&count=-1"		else		{			var strCategory=location.search.split("RestrictToCategory=")[1]			if(strCategory!=undefined)              		 document.frames.location.href=location.href.toLowerCase().split(".nsf")[0]+".nsf/"+ViewName+"?openview&Category="+strCategory+"&RestrictToCategory="+strCategory              	else				document.frames.location.href=location.href.toLowerCase().split(".nsf")[0]+".nsf/"+ViewName+"?openview&Category="+strCategory          }     	}}function OpenSnippetDialogBox( ){  strURL=dburl+"/dlgSnippetSelection?openform"  ReturnValue = window.showModalDialog(strURL,'','dialogWidth:460px;dialogHeight:300px;status:no'); if(ReturnValue!=undefined)       {            window.location.href =  "/" +DBPath +"/frmWebSnippet?openform&snippetType="+trimString(ReturnValue)       }                                                        }function OpenContentDialogBox( ){  strURL=dburl+"/dlgTemplateSelection?openform"  ReturnValue = window.showModalDialog(strURL,'','dialogWidth:460px;dialogHeight:300px;status:no'); if(ReturnValue!=undefined)       {           window.location.href =  "/" +DBPath +"/frmContent?openform&template="+trimString(ReturnValue)       }                                                        }//Excel Exportfunction ExportToExcel() {  var var2 = 'web-Excel View Export?OpenAgent&ExportView=LookUpContactUs' window.status='Exporting Data...';  window.open(var2)}/* Author : NancyDescription : Find out all the selected documents and update those documents with the new person In charge */function changePI( ){ findSelected()	if(document.forms[0].DocIds.value=="")	{		alert("Please select at least one document to change")	}	else	{		var varloc=window.location.href.toLowerCase().match(/(.*)?\.nsf/gi) +"/dlgPIselection?OpenForm&DocIDList="+document.forms[0].DocIds.value		windowOpener(varloc, "PersonIncharge", 'toolbar=no,directories=no,status=no,scrollbars=yes, resizable=yes, menubar=no,top=200,left=400, height=170,width=400')	}}function findSelected(){var frm=document.forms[0];frm.DocIds.value = "";if(frm.chkcontent.value!="" &&  frm.chkcontent.value!=undefined && frm.chkcontent.length==undefined) 	frm.DocIds.value = frm.chkcontent.value	for(i=0;i<frm.chkcontent.length;i++)	{		if(frm.chkcontent[i].checked)		{			if(frm.DocIds.value=="")			{				frm.DocIds.value = frm.chkcontent[i].value			}			else			{				frm.DocIds.value = frm.DocIds.value + "~" +frm.chkcontent[i].value				}		}		}}/*Author : Anencia NancyPurpose : To delete group of documents*/function DeleteSelectedDocs( ){	if(document.forms[0].DocIds.value=="")	{		alert("Please select at least one document to delete")	}	else	{			if (confirm("Do you want to delete the selected documents?"))		{		var result=ProcessUserRequest("multiple~@~"+document.forms[0].DocIds.value,"DeleteDocument")			if (result)			{				alert("Documents Deleted Successfully")          		          		var strCategory=location.search.split("RestrictToCategory=")[1]				if(strCategory!=undefined)              		 	document.frames.location.href=location.href.toLowerCase().split(".nsf")[0]+".nsf/"+ViewName+"?openview&Category="+strCategory+"&RestrictToCategory="+strCategory            		else					document.frames.location.href=location.href.toLowerCase().split(".nsf")[0]+".nsf/"+ViewName+"?openview&Category="+strCategory          	}     		}	}	}/*Call tha Agent to update all the special content pages*/function updateHomePage(){    	var result=ProcessUserRequest("","AgtTriggerUpdateHomepage")	if(result==1)		alert("All Special Content Pages have been updated successfully.")	else		alert(result)	}/*Call tha Agent to update all the content templates*/function updateTemplates(){    	var result=ProcessUserRequest("","AgtUpdateAllTemplates")	if(result==1)		alert("All Content Templates have been updated successfully.")	else		alert(result)	}function updateSublink(){	var result=ProcessUserRequest("","UpdateSublinks")	if(result==1)	{		alert("All menu documents have been updated with the no.of sublinks.")			}		else	{		alert(result)      }          document.getElementById("Reminder").style.display="none"		    }function updateNews(){	var result=ProcessUserRequest("","AgtUpdNewsSnippets")	if(result==1)	{		alert("All Websnippets related to News are updated")			}		else	{		alert(result)      }        document.getElementById("ReminderNews").style.display="none"		    }function showOffices(arg){			intCount++;		if(intCount %2 == 1)		document.write("<tr>")			document.write(arg.replace(/&lt;/gi,"<").replace(/&gt;/gi,">"))		if(intCount %2 == 0)		document.write("</tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>")	}// Starts with functionality in $$Viewtemplatefunction retrieveStartData(objField){		var loc = location.href		loc = loc.match(/(.*?)\.nsf/gi)			      if(trimString(objField.value) != "")	{	    if(ViewAliasTitle=="")		{			viewaliasname=ViewName		}		else		{			viewaliasname=ViewAliasTitle		}		SearchQuery = loc+"/" +viewaliasname+"?Openview&StartKey="+objField.value          		location.href = SearchQuery	}			else	{		alert("Enter the starts with string")	}	}//