/********************************************************Set of Global JavaScript functions to be usedtroughout InSite!Jake Howlett, v1.0, 27/11/03********************************************************//*Remove leading and trailing spaces from a stringOriginally written by Jim Fricker */function trim(aStr) {	return aStr.replace(/^\s{1,}/, "").replace(/\s{1,}$/, "")}/*disablePassThru()Makes sure that users can't enter startor end tags for Domino PassThru HTML.Both < and > are replaced withtheir encoded values &#91;&lt; or &gt;&#93;*/function disablePassThru( fieldObject ) {	var procString = fieldObject.value; 	procString = procString.replace(/\[\</g,'&#91;&lt;');	procString = procString.replace(/>\]/g,'&gt;&#93;'); 	fieldObject.value = procString;}/*getPathNameRequired due to Opera bug where location.pathnamereturns location.search as well.*/function getPathName(){	var pth = location.pathname.split('?');	return pth[0];}/*doSearch is called from the button below simple query box on all pages */function doSearch ( query, view ) {	var regExp1 = /\bfield\b/i; //used to test for reserved word field in query string	var regExp2 = /[(,),<,>,\[,\]]/; //used to test for reserved char(s) in the query string	var str = query.value;	if ( trim(str) == "" ){		alert("Please be sure to enter something to search for.");		query.focus();		return false;	} else {		if ( typeof regExp1.source != 'undefined' ) //supports regular expression testing			if ( regExp1.test( str ) || regExp2.test( str ) ){					var alrt = "Please note that you can not include:";					alrt += "\n\nThe reserved word 'field'\nthe characters [, ], (, ), < or >";					alrt += "\n\nin your search query!\n\nIf you are confident that you know";					alrt += "\nwhat you are doing, then you can\nmanually produce the URL required."					alert( alrt );					s.focus();					return false;			}						document.location = "/" + _db_path + "/" + view + "?SearchView&Query=" + escape( str ) + "&start=1&count=10&SearchFuzzy=True";	}}/*doSearch is called from the button on the section browse page */function doSearchSection ( query, view, section ) {	var regExp1 = /\bfield\b/i; //used to test for reserved word field in query string	var regExp2 = /[(,),<,>,\[,\]]/; //used to test for reserved char(s) in the query string	var str = query.value;	if ( trim(str) == "" ){		alert("Please be sure to enter something to search for.");		query.focus();		return false;	} else {		if ( typeof regExp1.source != 'undefined' ) //supports regular expression testing			if ( regExp1.test( str ) || regExp2.test( str ) ){					var alrt = "Please note that you can not include:";					alrt += "\n\nThe reserved word 'field'\nthe characters [, ], (, ), < or >";					alrt += "\n\nin your search query!\n\nIf you are confident that you know";					alrt += "\nwhat you are doing, then you can\nmanually produce the URL required."					alert( alrt );					s.focus();					return false;			}						document.location = "/" + _db_path + "/" + view + "?SearchView&Query=" + escape( str ) + " AND [Section] CONTAINS "+section+"&start=1&count=10&SearchFuzzy=True&section="+section;	}}/* getRadioSelectedValue is an  easy way to get the value of the selected radio button */function getRadioSelectedValue( obj ){	for (var r=0; r < obj.length; r++){		if ( obj[r].checked ) return obj[r].value;	}}/*doEdit */function doEdit(){	location.search="?EditDocument";}/*doSubmit */function doSubmit(){	document.forms[0].submit();}/*doDelete */function doDelete(){	if (confirm("Do you really want to delete this document?")) 		location.search="?DeleteDocument";}/*disableStylesView*/function disableStylesView(index){	document.styleSheets[index].disabled = (document.styleSheets[index].disabled)?false:true;}
