//////////////////////////////////////////////////////////////////////////////////////////
// dbnetedit.js
// copyright DbNetLink Ltd 2006
//////////////////////////////////////////////////////////////////////////////////////////
window.DbNetEditArray = new Object();

DbNetEdit.prototype = new Component();

DbNetEdit.prototype.activeControl = null;	
DbNetEdit.prototype.allowLinkedDeletion = false;
DbNetEdit.prototype.apply = true;	
DbNetEdit.prototype.applyButton = null;	
DbNetEdit.prototype.autoSequence = false;	
DbNetEdit.prototype.browseColumns = null;	
DbNetEdit.prototype.browseContainer = null;	
DbNetEdit.prototype.browser = null;	
DbNetEdit.prototype.browseTable = null;	
DbNetEdit.prototype.browseTableContent = null;	
DbNetEdit.prototype.browseTitles = null;	
DbNetEdit.prototype.browseToolbar = null;	
DbNetEdit.prototype.browseWin = null;	
DbNetEdit.prototype.buttonStyle = "glyphOnly";	
DbNetEdit.prototype.cancel = true;	
DbNetEdit.prototype.cancelButton = null;	
DbNetEdit.prototype.caseSensitiveNames = false;	
DbNetEdit.prototype.columns = null;	
DbNetEdit.prototype.confirmDeletion = true;	
DbNetEdit.prototype.connectionString = null;	
DbNetEdit.prototype.container = null;	
DbNetEdit.prototype.currentFilterPart = '';	
DbNetEdit.prototype.dateFormat = "d";	
DbNetEdit.prototype.DBMSName = null;	
DbNetEdit.prototype.dbNetFileConfig = undefined; // used for passing dbNetFile configuration settings into a field that uses a tinyMCE HTML editor
DbNetEdit.prototype.dbNetGrid = null;	
DbNetEdit.prototype.dbNetSpellVirtualDir = '';	
DbNetEdit.prototype.deleteButton = null;
DbNetEdit.prototype.deleteError = '';	
DbNetEdit.prototype.deletePageValidation = '';	
DbNetEdit.prototype.deleteRow = true;	
DbNetEdit.prototype.deleteValidation = '';	
DbNetEdit.prototype.detailFormArray = null;	
DbNetEdit.prototype.edit = true;	
DbNetEdit.prototype.editError = ''; 	
DbNetEdit.prototype.editLookupSelectionType = ''; 	
DbNetEdit.prototype.editNavigation = null;	
DbNetEdit.prototype.editorPicker = null;	
DbNetEdit.prototype.editorSelector = false;	
DbNetEdit.prototype.encoding = "windows-1252";	
DbNetEdit.prototype.fieldBackgroundColorFocus = "Khaki";	
DbNetEdit.prototype.fieldProperties = null;	
DbNetEdit.prototype.fields = null;	
DbNetEdit.prototype.filterPart = "";	
DbNetEdit.prototype.fixedFilterPart = "";	
DbNetEdit.prototype.focusField = null;	
DbNetEdit.prototype.foreignKey = null;	
DbNetEdit.prototype.formTemplatePath = "";	
DbNetEdit.prototype.HTMLEditor = 'tinymce';	
DbNetEdit.prototype.HTMLPreviewFields = new Array();
DbNetEdit.prototype.imageWindow = null;	
DbNetEdit.prototype.initialised = false;	
DbNetEdit.prototype.insert = true;	
DbNetEdit.prototype.insertButton = null;	
DbNetEdit.prototype.insertionStyle = 'row';	
DbNetEdit.prototype.linkStyle = null;	
DbNetEdit.prototype.mceEditorFrames = new Array();
DbNetEdit.prototype.mode = null;	
DbNetEdit.prototype.msg = '';	
DbNetEdit.prototype.multipleInsert = false;	
DbNetEdit.prototype.multipleSelect = false;	
DbNetEdit.prototype.navigationStyle = 'page';	
DbNetEdit.prototype.navigator = null;	
DbNetEdit.prototype.navigatorButtons = ["first", "prev", "next", "last", "search", "sort", "browse", "profile"];	
DbNetEdit.prototype.navigatorData = null;
DbNetEdit.prototype.navigatorInfo = null;	
DbNetEdit.prototype.navigatorPageLength = 300;	
DbNetEdit.prototype.navigatorStatus = null;	
DbNetEdit.prototype.optimisticLocking = true;	
DbNetEdit.prototype.orderBy = '';	
DbNetEdit.prototype.originalNavigatorIndex = null;	
DbNetEdit.prototype.pageDataRowCount = null;	
DbNetEdit.prototype.pageIndex = 0;	
DbNetEdit.prototype.pageSelector = null;	
DbNetEdit.prototype.pageRowCount = null;	
DbNetEdit.prototype.pageValidation = '';	
DbNetEdit.prototype.parentForm = null;	
DbNetEdit.prototype.pendingSearchCriteria = null;	
DbNetEdit.prototype.primaryKeyArray = null;	
DbNetEdit.prototype.primaryKeyAutoincrement = false;	
DbNetEdit.prototype.primaryKeyDataType = '';	
DbNetEdit.prototype.primaryKeyName = '';	
DbNetEdit.prototype.primaryKeyType = '';	
DbNetEdit.prototype.primaryKeyValue = "";
DbNetEdit.prototype.profile = false;
DbNetEdit.prototype.profileSelect = false;
DbNetEdit.prototype.promptUncommittedChanges = true;	
DbNetEdit.prototype.requiredProperties = ['connectionString','dateFormat','timeFormat','encoding','registrationKey','msg','DBMSName', 'tableName', 'simpleSearchToken'];	
DbNetEdit.prototype.rowContainers = null;	
DbNetEdit.prototype.rowInitialisation = '';	
DbNetEdit.prototype.rowSelectorPosition = "right";	
DbNetEdit.prototype.rowValidation = '';	
DbNetEdit.prototype.searchControl = null;	
DbNetEdit.prototype.searchDialogCloseOnApply = false;	
DbNetEdit.prototype.searchDialogContent = '';	
DbNetEdit.prototype.searchDialogHeight = null;	
DbNetEdit.prototype.searchDialogInitialisation = '';	
DbNetEdit.prototype.searchDialogJoinOperator = 'and';	
DbNetEdit.prototype.searchFieldProperties = null;	
DbNetEdit.prototype.searchFields = null;	
DbNetEdit.prototype.searchLabels = null;	
DbNetEdit.prototype.searchLookupSelectionType = ''; 	
DbNetEdit.prototype.searchType = '';	
DbNetEdit.prototype.searchTypeFixed = false;	
DbNetEdit.prototype.searchWin = null;	
DbNetEdit.prototype.searchWithinResults = true;	
DbNetEdit.prototype.selectedRow = null;	
DbNetEdit.prototype.selectInsertedRecord = false;	
DbNetEdit.prototype.sequenceName = "";	
DbNetEdit.prototype.server = 'dbnetedit.aspx';	
DbNetEdit.prototype.simpleSearchDialogContent = '';	
DbNetEdit.prototype.simpleSearchFilter = '';
DbNetEdit.prototype.simpleSearchToken = "";				
DbNetEdit.prototype.sortColumns = null;	
DbNetEdit.prototype.sortFields = null;	
DbNetEdit.prototype.sortHeadings = null;	
DbNetEdit.prototype.sortLabels = null;	
DbNetEdit.prototype.sortSequence = null;	
DbNetEdit.prototype.sortWin = null;
DbNetEdit.prototype.spellCheck = false;
DbNetEdit.prototype.spellCheckAllFields = true;
DbNetEdit.prototype.tableName = '';	
DbNetEdit.prototype.tabular = false;	
DbNetEdit.prototype.timeFormat = "t";	
DbNetEdit.prototype.toolbarButtons = ["insert", "apply", "cancel", "delete", "spell"];	
DbNetEdit.prototype.toolbuttonStyle = 'image';
DbNetEdit.prototype.userProfileProperties = ["searchDialogContent","orderBy","filterPart","fixedFilterPart",  "sortColumns", "sortFields", "sortHeadings", "sortLabels", "sortSequence", "simpleSearchDialogContent","filterText"];
DbNetEdit.prototype.version = '3.0';	
DbNetEdit.prototype.virtualDir = "/dbnetsia/";	
DbNetEdit.prototype.XmlData = null;	
DbNetEdit.prototype.XmlSelectData = null;

	

var DbNetLinkBrowserDetect={init:function(){this.browser=this.searchString(this.dataBrowser)||"An unknown browser";this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||"an unknown version";this.OS=this.searchString(this.dataOS)||"an unknown OS";},searchString:function(data){for(var i=0;i<data.length;i++){var dataString=data[i].string;var dataProp=data[i].prop;this.versionSearchString=data[i].versionSearch||data[i].identity;if(dataString){if(dataString.indexOf(data[i].subString)!=-1)
return data[i].identity;}
else if(dataProp)
return data[i].identity;}},searchVersion:function(dataString){var index=dataString.indexOf(this.versionSearchString);if(index==-1)return;return parseFloat(dataString.substring(index+this.versionSearchString.length+1));},dataBrowser:[{string:navigator.vendor,subString:"Apple",identity:"Safari"},{prop:window.opera,identity:"Opera"},{string:navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:navigator.userAgent,subString:"MSIE",identity:"Explorer",versionSearch:"MSIE"}],dataOS:[{string:navigator.platform,subString:"Win",identity:"Windows"},{string:navigator.platform,subString:"Mac",identity:"Mac"},{string:navigator.platform,subString:"Linux",identity:"Linux"}]};DbNetLinkBrowserDetect.init();HttpRequest.prototype.xmlHttpProgIds='MSXML2.XMLHTTP,Microsoft.XMLHTTP';HttpRequest.prototype.xmlRequest=null;HttpRequest.prototype.get=HttpRequest_get;function HttpRequest()
{if(window.XMLHttpRequest)
this.xmlRequest=new XMLHttpRequest();else
if(window.ActiveXObject)
{var arr=this.xmlHttpProgIds.split(",");for(var i=0;i<arr.length;i++)
{try
{this.xmlRequest=new ActiveXObject(arr[i]);}
catch(e)
{continue;}
break;}}}
function HttpRequest_get(url)
{this.xmlRequest.open("GET",url,false);this.xmlRequest.setRequestHeader("Content-Type","text/XML");this.xmlRequest.send("");}
DbNetLink.prototype.isIE='';DbNetLink.prototype.isSafari=false;DbNetLink.prototype.isFirefox=false;DbNetLink.prototype.IEVersion=-1;DbNetLink.prototype.FFVersion=-1;DbNetLink.prototype.xmlDocProgIds='MSXML2.XMLDOM,Microsoft.XMLDOM';DbNetLink.prototype.assignHandler=DbNetLink_assignHandler;DbNetLink.prototype.sizeDialog=DbNetLink_sizeDialog;DbNetLink.prototype.windowOpen=DbNetLink_windowOpen;DbNetLink.prototype.addClassName=DbNetLink_addClassName;DbNetLink.prototype.removeClassName=DbNetLink_removeClassName;DbNetLink.prototype.textFromNode=DbNetLink_textFromNode;DbNetLink.prototype.getElementById=DbNetLink_getElementById;DbNetLink.prototype.getNode=DbNetLink_getNode;DbNetLink.prototype.getNodeValue=DbNetLink_getNodeValue;DbNetLink.prototype.init=DbNetLink_init;DbNetLink.prototype.insertAdjacentHTML=DbNetLink_insertAdjacentHTML;DbNetLink.prototype.createXmlDocument=DbNetLink_createXmlDocument;DbNetLink.prototype.createXmlNode=DbNetLink_createXmlNode;DbNetLink.prototype.showMessage=DbNetLink_showMessage;DbNetLink.prototype.clearMessage=DbNetLink_clearMessage;DbNetLink.prototype.elementAttribute=DbNetLink_elementAttribute;DbNetLink.prototype.addStyleSheet=DbNetLink_addStyleSheet;DbNetLink.prototype.standardDateFormat=DbNetLink_standardDateFormat;DbNetLink.prototype.addToObjectPool=DbNetLink_addToObjectPool;DbNetLink.prototype.testArray=DbNetLink_testArray;DbNetLink.prototype.openHTMLEditor=DbNetLink_openHTMLEditor;DbNetLink.prototype.openModalDialog=DbNetLink_openModalDialog;DbNetLink.prototype.openDialog=DbNetLink_openDialog;DbNetLink.prototype.openNonModalDialog=DbNetLink_openNonModalDialog;DbNetLink.prototype.setCookie=DbNetLink_setCookie;DbNetLink.prototype.getCookie=DbNetLink_getCookie;DbNetLink.prototype.deleteCookie=DbNetLink_deleteCookie;function DbNetLink()
{this.isIE=false;if(document.all)
this.isIE=true;switch(DbNetLinkBrowserDetect.browser)
{case"Safari":this.isSafari=true;break;case"Firefox":this.isFirefox=true;this.FFVersion=parseFloat(DbNetLinkBrowserDetect.version);break;case"Explorer":this.isIE=true;this.IEVersion=parseFloat(DbNetLinkBrowserDetect.version);break;}}
function DbNetLink_assignHandler(methodName,noSrcElement,returnValue,o)
{if(!o)
o=window;if(typeof(methodName)=="function")
{var fn=arguments[0].toString().split("(")[0].replace("function ","");if(fn=="function")
return methodName;else
methodName=fn;}
if(methodName=="")
return function(){};var call="o."+methodName+"("+((noSrcElement)?"":"getCoords(event)")+")";if(returnValue)
return function(event){return(eval(call))};else
return function(event){eval(call)};}
function DbNetLink_sizeDialog(centre)
{if(typeof(centre)=='undefined')
centre=true;if(this.isFirefox)
{window.sizeToContent();}
else
{var layout=document.getElementById('layout');if(!layout)
layout=document.body.childNodes[0];var xpad=0;var ypad=0;if(this.IEVersion<7&&!this.isSafari)
{xpad=this.elementAttribute(layout,"xpad",10);ypad=this.elementAttribute(layout,"ypad",30);}
var h=(parseInt(layout.offsetHeight)+parseInt(ypad));var w=(parseInt(layout.offsetWidth)+parseInt(xpad));if(this.isSafari)
{h+=50;w+=20;window.resizeTo(w,h);}
else
{window.dialogHeight=h+"px";window.dialogWidth=w+"px";}}
if(centre)
centreDialog();}
function DbNetLink_windowOpen(w)
{if(w)
if(!w.closed)
return true;return false;}
function DbNetLink_addClassName(e,className)
{if(e.className.indexOf(className)==-1)
e.className+=" "+className;}
function DbNetLink_removeClassName(e,className)
{var a=e.className.split(" ");var b=new Array();for(var i=0;i<a.length;i++)
if(a[i]!=className)
b[b.length]=a[i];e.className=b.join(" ").replace("  ","");}
function DbNetLink_textFromNode(n)
{if(n==null)
return'';if(n.text)
return n.text;if(n.childNodes.length>0)
{var returnText='';for(var i=0;i<n.childNodes.length;i++)
returnText+=n.childNodes[i].nodeValue;return(returnText);}
return'';}
function DbNetLink_addToObjectPool(obj)
{if(!document.__ObjectPool)
{document.__ObjectPool=new Object;document.__ObjectPool.Objects=new Array();document.__ObjectPool.length=0;}
obj.objectId=document.__ObjectPool.length++;document.__ObjectPool.Objects[obj.objectId]=obj;obj.toString=new Function("return 'document.__ObjectPool.Objects["+obj.objectId+"]'");}
function DbNetLink_getElementById(rootNode,id)
{if(rootNode==null)alert("root node is null "+id)
if(rootNode.all)
return rootNode.all[id];else
{if(rootNode.getElementsByTagName)
{var all=rootNode.getElementsByTagName('*');for(i=0;i<all.length;i++)
{if(all[i].getAttribute)
if(all[i].getAttribute('id'))
if(all[i].getAttribute('id').toLowerCase()==id.toLowerCase())
return all[i];}}}
return null;}
function DbNetLink_createXmlDocument()
{if(document.implementation&&document.implementation.createDocument)
return document.implementation.createDocument("","",null);var o=null;if(window.ActiveXObject)
{var arr=this.xmlDocProgIds.split(",");for(var i in arr)
{try
{o=new ActiveXObject(arr[i]);}
catch(e)
{continue;}
break;}}
return o;}
function DbNetLink_createXmlNode(nodeName,nodeValue,attributes)
{if(nodeValue==null)
nodeValue="";if(typeof(nodeName)!="string"||nodeName=="")
return"";var xml="<"+nodeName;if(attributes)
for(a in attributes)
{var attributeValue=attributes[a];switch(typeof(attributeValue))
{case"string":attributeValue=attributeValue.replace(/\&/g,'&amp;').replace(/\"/g,'&quot;').replace(/\>/g,'&gt;').replace(/\</g,'&lt;');break;}
xml+=" "+a+"=\""+attributeValue+"\"";}
xml+=">";switch(typeof(nodeValue))
{case"object":if(testArray(nodeValue))
{for(var i=0;i<nodeValue.length;i++)
xml+=this.createXmlNode("item",nodeValue[i]);}
else
{for(var p in nodeValue)
xml+=this.createXmlNode(p,nodeValue[p]);}
break;case"string":xml+=(nodeValue.indexOf("<![CDATA[")>-1)?nodeValue:"<![CDATA["+nodeValue+"]]>";break;default:xml+=nodeValue;break;}
xml+="</"+nodeName+">";return xml;}
function DbNetLink_showMessage(str)
{if(!$('messageLine'))
{alert(str);return;}
$('messageLine').innerHTML=str;addClassName($('messageLine'),'activeMessage');window.setTimeout('clearMessage()',3000);}
function DbNetLink_clearMessage()
{$('messageLine').innerHTML='&nbsp;';removeClassName($('messageLine'),'activeMessage');}
function DbNetLink_elementAttribute(e,id,v)
{if(e[id])
return e[id];else if(e.getAttribute(id))
return e.getAttribute(id);else
return(v)?v:null;}
function DbNetLink_insertAdjacentHTML(elem,sWhere,html)
{if(dbNetLink.isSafari)
{var node=document.createElement("SPAN");node.innerHTML=html;switch(sWhere)
{case"beforeEnd":elem.insertBefore(node,null);break;case"beforeBegin":elem.parentNode.insertBefore(node,elem);break;case"afterEnd":elem.parentNode.insertBefore(node,elem.nextSibling);break;}}
else
{elem.insertAdjacentHTML(sWhere,html);}}
function DbNetLink_addStyleSheet(url,doc)
{var addStyleSheet=true;for(var i=0;i<doc.styleSheets.length;i++)
{var tmp=doc.styleSheets[i].href;if(tmp)
if(tmp.toLowerCase().indexOf(url.toLowerCase())>-1)
addStyleSheet=false;}
if(addStyleSheet)
{if(this.isIE)
doc.createStyleSheet(url,0);else
{var sheet=doc.createElement('link');sheet.rel='stylesheet';sheet.href=url;var head=doc.getElementsByTagName("head")[0];head.insertBefore(sheet,head.firstChild);}}}
function DbNetLink_standardDateFormat(formatString)
{if(typeof(formatString)!='string')
return true;if(formatString=='')
return true;if(formatString.length!=1)
return false;var re=/^[dGgTt]$/;return re.test(formatString);}
function DbNetLink_testArray(obj)
{if(obj)
if(obj.constructor)
return obj.constructor.toString().indexOf("function Array()")>=0?true:false;return false;}
function DbNetLink_openHTMLEditor(params)
{var comp;if(params.component.component)
comp=params.component.component;else
comp=params.component;var editor=comp.HTMLEditor;if(editor.toLowerCase().indexOf("tinymce")>-1)
{params.tinyMCEConfig=comp.tinyMCEConfig;editor="tinymce/tinymce_window.aspx";}
openModalDialog(params.component.virtualDir+'/common/editor/'+editor,'htmleditor',params,"resizable=yes");}
function DbNetLink_getNodeValue(doc,pattern)
{return dbNetLink.textFromNode(dbNetLink.getNode(doc,pattern));}
function DbNetLink_getNode(doc,pattern)
{if(pattern.indexOf("/")!=0)
pattern="//"+pattern;return doc.selectSingleNode(pattern);}
function DbNetLink_init(f)
{if(window.attachEvent)
window.attachEvent("onload",f)
else
document.addEventListener("DOMContentLoaded",f)}
function DbNetLink_setCookie(name,value,expires,path,domain,secure)
{var today=new Date();today.setTime(today.getTime());if(expires)
{expires=expires*1000*60*60*24;}
var expires_date=new Date(today.getTime()+(expires));document.cookie=name+"="+escape(value)+
((expires)?";expires="+expires_date.toGMTString():"")+
((path)?";path="+path:"")+
((domain)?";domain="+domain:"")+
((secure)?";secure":"");}
function DbNetLink_getCookie(check_name)
{var a_all_cookies=document.cookie.split(';');var a_temp_cookie='';var cookie_name='';var cookie_value='';var b_cookie_found=false;for(i=0;i<a_all_cookies.length;i++)
{a_temp_cookie=a_all_cookies[i].split('=');cookie_name=a_temp_cookie[0].replace(/^\s+|\s+$/g,'');if(cookie_name==check_name)
{b_cookie_found=true;if(a_temp_cookie.length>1)
{cookie_value=unescape(a_temp_cookie[1].replace(/^\s+|\s+$/g,''));}
return cookie_value;break;}
a_temp_cookie=null;cookie_name='';}
if(!b_cookie_found)
{return null;}}
function DbNetLink_deleteCookie(name,path,domain)
{if(this.getCookie(name))document.cookie=name+"="+
((path)?";path="+path:"")+
((domain)?";domain="+domain:"")+";expires=Thu, 01-Jan-1970 00:00:01 GMT";}
var dbNetLink=new DbNetLink();Component.prototype.clearTextTokens=null;Component.prototype.configLang='';Component.prototype.culture=null;Component.prototype.currentProfileId="";Component.prototype.isIE=null;Component.prototype.encryptedTokens=null;Component.prototype.filterText="";Component.prototype.filterTextObjectArray=null;Component.prototype.httpRequest=null;Component.prototype.messageLine=null;Component.prototype.profileCombo=null;Component.prototype.profileKey="";Component.prototype.profileRestore=true;Component.prototype.profileSelect=false;Component.prototype.profileSelectText="";Component.prototype.profileUser="";Component.prototype.profileWindow=null;Component.prototype.requiredProperties=null;Component.prototype.text=null;Component.prototype.trace=false;Component.prototype.traceArray=null;Component.prototype.traceArea=null;Component.prototype.xmlDocument=null;Component.prototype.xmlRequest=null;Component.prototype.xmlResponse=null;Component.prototype.instances=null;Component.prototype.instanceIndex=null;Component.prototype.callbackFunction=null;Component.prototype.toolButtonStyle='image';Component.prototype.openWindows=null;Component.prototype.tinyMCEConfig=null;Component.prototype.addUserProfileProperties=Component_addUserProfileProperties;Component.prototype.assignHandler=Component_assignHandler;Component.prototype.assignButtonHint=Component_assignButtonHint;Component.prototype.addCSSRule=Component_addCSSRule;Component.prototype.buttonContent=Component_buttonContent;Component.prototype.callService=Component_callService;Component.prototype.checkDOM=Component_checkDOM;Component.prototype.clearMessage=Component_clearMessage;Component.prototype.clearText=Component_clearText;Component.prototype.createXmlNode=Component_createXmlNode;Component.prototype.createXmlDocument=Component_createXmlDocument;Component.prototype.deleteUserProfile=Component_deleteUserProfile;Component.prototype.encrypt=Component_encrypt;Component.prototype.evaluate=Component_evaluate;Component.prototype.fireCustomEvent=Component_fireCustomEvent;Component.prototype.formatNumber=Component_formatNumber;Component.prototype.getChildNodes=Component_getChildNodes;Component.prototype.getDataType=Component_getDataType;Component.prototype.getNode=Component_getNode;Component.prototype.getNodeValue=Component_getNodeValue;Component.prototype.getText=Component_getText;Component.prototype.initialiseStyleSheet=Component_initialiseStyleSheet;Component.prototype.inspectCSSRule=Component_inspectCSSRule;Component.prototype.loadDocument=Component_loadDocument;Component.prototype.loadText=Component_loadText;Component.prototype.loadProfileCombo=Component_loadProfileCombo;Component.prototype.loadUserProfiles=Component_loadUserProfiles;Component.prototype.logTrace=Component_logTrace;Component.prototype.makeImageButton=Component_makeImageButton;Component.prototype.message=Component_message;Component.prototype.MSDB=Component_MSDB;Component.prototype.openDialog=Component_openDialog;Component.prototype.openNonModalDialog=Component_openNonModalDialog;Component.prototype.openModalDialog=Component_openModalDialog;Component.prototype.readOnlyDataType=Component_readOnlyDataType;Component.prototype.recordExists=Component_recordExists;Component.prototype.saveUserProfile=Component_saveUserProfile;Component.prototype.selectData=Component_selectData;Component.prototype.selectDate=Component_selectDate;Component.prototype.selectProfile=Component_selectProfile;Component.prototype.selectUserProfile=Component_selectUserProfile;Component.prototype.suggestData=Component_suggestData;Component.prototype.makeRequest=Component_makeRequest;Component.prototype.serialise=Component_serialize;Component.prototype.serialize=Component_serialize;Component.prototype.serialiseRequiredProperties=Component_serialiseRequiredProperties;Component.prototype.showError=Component_showError;Component.prototype.checkRequestState=Component_checkRequestState;Component.prototype.processResponse=Component_processResponse;Component.prototype.convertDateTimeFormat=Component_convertDateTimeFormat;Component.prototype.userProfileDialog=Component_userProfileDialog;Component.prototype.setAccessKey=Component_setAccessKey;Component.prototype.isEncrypted=Component_isEncrypted;Component.prototype.isMethodAssigned=Component_isMethodAssigned;Component.prototype.escape=Component_escape;Component.prototype.configureSimpleSearchFilter=Component_configureSimpleSearchFilter;Component.prototype.onBeforeProfileSaved=null;Component.prototype.onProfileSelected=null;Component.prototype.onProfileSaved=null;Component.prototype.onProfileDeleted=null;function Component()
{this.isIE=false;if(document.all)
this.isIE=true;this.requiredProperties=new Array();this.instances=new Array();this.openWindows=new Object();this.encryptedTokens=new Object();this.clearTextTokens=new Object();this.tinyMCEConfig=new Object();this.tinyMCEConfig.fileSelection=new Object();}
function initialiseComponent(o)
{if(window[o.componentName+"VirtualFolder"])
{o.virtualDir=window[o.componentName+"VirtualFolder"]+"/";o.virtualDir=o.virtualDir.replace("//","/");}
o.httpRequest=new HttpRequest();o.xmlRequest=o.httpRequest.xmlRequest;o.instanceIndex=o.instances.length;o.instances[o.instances.length]=o;dbNetLink.addToObjectPool(o);}
function Component_callService(xml,method,doc)
{xml+=this.serialiseRequiredProperties();var url=this.virtualDir+"/"+this.server+"?mode="+method;this.xmlDocument=doc;if(!this.makeRequest(url,xml))
return false;return true;}
function Component_checkDOM(id)
{if(document.readyState)
if(document.readyState!="complete")
{alert("Element with ID ["+id+"] not available. Use the window.onload event to create "+this.componentName);return;}
alert("The element with ID ["+id+"] not available. Check element has been defined or you are creating or use the window.onload event to create "+this.componentName);}
function Component_serialiseRequiredProperties()
{var xml="";for(var i=0;i<this.requiredProperties.length;i++)
xml+=this.serialize(this.requiredProperties[i]);return xml;}
function Component_makeRequest(url,xml)
{if(xml.indexOf('<root>')!=0)
xml='<root>'+xml+'</root>';url=url.replace(/\/\//g,'\/');try
{this.xmlRequest.open("POST",url,(this.callbackFunction)?true:false);}
catch(e)
{this.xmlRequest=new HttpRequest().xmlRequest;this.xmlRequest.open("POST",url,(this.callbackFunction)?true:false);}
this.xmlRequest.setRequestHeader("Content-Type","text/XML");if(this.callbackFunction)
this.xmlRequest.onreadystatechange=this.checkRequestState(this);else
this.xmlRequest.onreadystatechange=function(){};this.logTrace('out',url,xml);this.xmlRequest.send(xml);if(this.callbackFunction)
return true;if(this.xmlRequest.status!=200||this.xmlRequest.responseXML==null)
{this.showError(this.xmlRequest.responseText);return false;}
if(url)
this.logTrace('in',url,this.xmlRequest.responseXML.xml);return this.processResponse(url);}
function Component_processResponse(url)
{if(this.xmlRequest.status!=200||((this.xmlRequest.responseXML==null)||(this.xmlRequest.responseXML.xml=="")))
{this.showError(this.xmlRequest.responseText);return false;}
if(url)
this.logTrace('in',url,this.xmlRequest.responseXML.xml);if(typeof(this.xmlDocument)=='undefined')
this.xmlResponse=this.xmlRequest.responseXML;else
this.loadDocument(this.xmlDocument);return true;}
function Component_checkRequestState(component)
{return function()
{if(component.xmlRequest.readyState!=4)
return;if(component.processResponse())
if(component.callbackFunction)
component.callbackFunction();}}
function Component_logTrace(direction,url,xml)
{if(!this.trace)
return;if(!this.traceArray)
this.traceArray=new Array();if(this.traceArray.length==100)
this.traceArray=new Array();if(this.traceArea)
this.traceArea.value+=direction+":"+url+":"+xml;this.traceArray[this.traceArray.length]=direction+":"+url+":"+xml;}
function Component_loadDocument(doc,xml)
{if(document.implementation&&document.implementation.createDocument)
{if(typeof(xml)=='undefined')
{var objXMLSerializer=new XMLSerializer();xml=objXMLSerializer.serializeToString(this.xmlRequest.responseXML);}
if(xml=="")
xml="<root></root>";var objDOMParser=new DOMParser();var objDoc=objDOMParser.parseFromString(xml,"text/xml");while(doc.hasChildNodes())
doc.removeChild(doc.lastChild);for(var i=0;i<objDoc.childNodes.length;i++)
{var objImportedNode=doc.importNode(objDoc.childNodes[i],true);doc.appendChild(objImportedNode);}}
else
{if(typeof(xml)=='undefined')
xml=this.xmlRequest.responseXML.xml;doc.loadXML(xml);}}
function Component_createXmlDocument()
{return dbNetLink.createXmlDocument();}
function Component_getNode(pattern,doc)
{if(doc==null)
return dbNetLink.getNode(this.xmlResponse,pattern);return dbNetLink.getNode(doc,pattern);}
function Component_getNodeValue(pattern,doc)
{if(doc==null)
return dbNetLink.getNodeValue(this.xmlResponse,pattern);return dbNetLink.getNodeValue(doc,pattern);}
function Component_getChildNodes(pattern,doc)
{var n=this.getNode(pattern,doc);if(!n)
return null;return n.childNodes;}
function Component_showError(text)
{var leftPos=(screen.availWidth-500)/2;var topPos=(screen.availHeight-500)/2;var posStr=('left='+leftPos+',top='+topPos+',width=500,height=500,toolbars=no,scrollbars=yes,resizable=yes');var win=window.open("about:blank",null,posStr);if(!win)
alert("A popup-blocker has prevented the error window from opening\nPlease adjust the settings to allow popups from this site");else
{try
{win.document.open();}
catch(e)
{win.close();win=window.open("about:blank",null,posStr);win.document.open();}
win.document.write(text);win.document.close();}}
function Component_serialize(propertyName,nodeName)
{if(!nodeName)
nodeName=propertyName;var xml="";switch(typeof(this[propertyName]))
{case"undefined":break;case"object":xml=this.createXmlNode(nodeName,this[propertyName]);break;case"boolean":xml=this.createXmlNode(nodeName,this[propertyName].toString().toLowerCase());break;default:xml=this.createXmlNode(nodeName,this[propertyName]);break;}
return xml;}
function Component_createXmlNode(nodeName,nodeValue,attributes)
{return dbNetLink.createXmlNode(nodeName,nodeValue,attributes);}
function Component_loadText()
{if(!this.text)
this.text=new Object();else
if(typeof(this.text['true'])=='string')
return;var doc=this.createXmlDocument();var xml=this.serialise('configLang');if(!this.callService(xml,"loadtext",doc))
return;var nodeList=doc.documentElement.childNodes;for(var i=0;i<nodeList.length;i++)
this.text[nodeList[i].nodeName]=dbNetLink.textFromNode(nodeList[i]);}
function Component_getText(id)
{if(this.text[id])
return this.text[id];else
return id;}
function Component_message(messageText)
{if((this.messageLine)&&(messageText.length<100))
{this.messageLine.innerHTML=messageText;var color='gold';if(this.messageLine.backgroundColor)
color=this.messageLine.backgroundColor;this.messageLine.style.backgroundColor=color;if(this.isIE)
window.setTimeout('Component_clearMessage('+this.instanceIndex+',"'+this.componentName+'")',3000);else
window.setTimeout(this.clearMessage,3000,this);}
else
alert(messageText);}
function Component_clearMessage(objectReference)
{var o;if(!isNaN(objectReference))
{var index=arguments[0];var componentName=arguments[1];o=eval(componentName+'.prototype.instances['+index+']');}
else
o=arguments[0];o.messageLine.innerHTML='&nbsp;';o.messageLine.style.backgroundColor='';}
function Component_clearText(token)
{if(this.clearTextTokens[token])
return this.clearTextTokens[token];var xmlResponseSave=this.xmlResponse;var xml=this.createXmlNode("token",token);if(!this.callService(xml,"cleartext"))
return token;eToken=this.getNodeValue("token");this.clearTextTokens[token]=eToken;this.xmlResponse=xmlResponseSave;return eToken;}
function Component_assignHandler(methodName,noSrcElement,returnValue)
{return dbNetLink.assignHandler(methodName,noSrcElement,returnValue,this);}
function Component_formatNumber(expr,decplaces)
{if(isNaN(expr)||expr=='')
return expr;if(!decplaces)
decplaces=2;var str=""+Math.round(eval(expr)*Math.pow(10,decplaces));while(str.length<=decplaces)
{str="0"+str;}
var decpoint=str.length-decplaces;var decimalSeparator=this.decimalSymbol;if(this.culture)
if(this.culture.numberDecimalSeparator)
decimalSeparator=this.culture.numberDecimalSeparator;return str.substring(0,decpoint)+decimalSeparator+str.substring(decpoint,str.length);}
function Component_fireCustomEvent()
{switch(typeof(arguments[0]))
{case'string':functionName=arguments[0];break;case'function':var arr=arguments[0].toString().split("(");functionName=arr[0].replace("function ","");if(functionName=="function")
{arguments[0].apply();return;}
break;default:functionName='';break;}
if(functionName!='')
{if(typeof(eval("window."+functionName))!='undefined')
{var args=new Array();for(var i=1;i<arguments.length;i++)
args[args.length]=arguments[i];return(eval(functionName+".apply(this, args)"));}
else
alert("Handler '"+functionName+"' is undefined");}
return null;}
function Component_evaluate(value,defaultValue)
{if(typeof(value)=="boolean")
return value;else if(typeof(defaultValue)=="boolean")
return defaultValue;return true;}
function Component_selectDate(field,x,y,callback)
{if(field.disabled||field.readOnly)
return;var params=new Object();params.field=field;params.monthNames='';params.dayNames='';params.x=x;params.y=y;params.callback=callback;params.component=this;for(var i=1;i<=12;i++)
{if(i>1)
params.monthNames+=',';params.monthNames+=this.getText('month'+i);}
for(var i=1;i<=7;i++)
{if(i>1)
params.dayNames+=',';params.dayNames+=this.getText('day'+i);}
this.openModalDialog(this.virtualDir+'common/calendar.htm','calendar',params);}
function Component_MSDB()
{var MS=false;switch(this.DBMSName)
{case'MySQL':case'DB2/NT':case'Oracle':case'InterSystems Cache':case'Sybase SQL Server':case'Adaptive Server Anywhere':case'Microsoft Visual FoxPro':case'SAS':case'Informix':case'Advantage':case'Pervasive.SQL':case'OpenRDA DAM':case'Firebird':MS=false;break;default:MS=true;break;}
return MS;}
function Component_suggestData(sql,parameters,allRows,format,dbColumn,dbTable)
{var xmlResponseSave=this.xmlResponse;var data=new Array();var xml=this.createXmlNode("sql",sql);xml+=this.createXmlNode("parameters",parameters);xml+=this.createXmlNode("format",format);xml+=this.createXmlNode("column",dbColumn);xml+=this.createXmlNode("table",dbTable);if(!this.callService(xml,"suggestdata"))
return null;var rows=this.xmlResponse.documentElement.childNodes;for(var r=0;r<rows.length;r++)
{data[r]=new Object();var fields=rows[r].childNodes;for(var i=0;i<fields.length;i++)
data[r][fields[i].nodeName]=dbNetLink.textFromNode(fields[i]);}
this.xmlResponse=xmlResponseSave;if(allRows)
return data;else
return data[0];}
function Component_selectData(sql,parameters,allRows,format)
{var xmlResponseSave=this.xmlResponse;var data=new Array();var xml=this.createXmlNode("sql",sql);xml+=this.createXmlNode("parameters",parameters);xml+=this.createXmlNode("format",format);if(!this.callService(xml,"selectdata"))
return null;var rows=this.xmlResponse.documentElement.childNodes;for(var r=0;r<rows.length;r++)
{data[r]=new Object();var fields=rows[r].childNodes;for(var i=0;i<fields.length;i++)
data[r][fields[i].nodeName]=dbNetLink.textFromNode(fields[i]);}
this.xmlResponse=xmlResponseSave;if(allRows)
return data;else
return data[0];}
function Component_recordExists(sql,parameters)
{var xmlResponseSave=this.xmlResponse;var xml=this.createXmlNode("sql",sql);xml+=this.createXmlNode("parameters",parameters);if(!this.callService(xml,"recordexists"))
return false;var exists=(eval(this.getNodeValue("eof").toLowerCase())==false);this.xmlResponse=xmlResponseSave;return exists;}
function Component_encrypt(token)
{if(this.encryptedTokens[token])
return this.encryptedTokens[token];var xmlResponseSave=this.xmlResponse;var xml=this.createXmlNode("token",token);if(!this.callService(xml,"encrypttoken"))
return token;eToken=this.getNodeValue("token");this.encryptedTokens[token]=eToken;this.xmlResponse=xmlResponseSave;return eToken;}
function Component_makeImageButton(image,label,common,hint,e)
{var template='<table title="{title}" cellpadding=0 cellspacing=0><tr><td><img src="{file}"></td><td>&nbsp;{text}</td></tr></table>'
if(typeof(hint)!='string')
hint='';var filepath=this.virtualDir+'/'+(common?'common':'')+'/images/'+image+'.gif';filepath=filepath.replace(/\/\//g,'\/');str=template.replace('{title}',hint).replace('{file}',filepath).replace('{text}',label);if(e)
{e.innerHTML=str;e.childNodes[0].rows[0].cells[0].childNodes[0].src=filepath;}
else
{return str;}}
function Component_initialiseStyleSheet()
{var styleSheetUrl=this.virtualDir+"css/"+this.componentName+".css";dbNetLink.addStyleSheet(styleSheetUrl,window.document);}
function Component_buttonContent(id,img,text,style)
{if(!img)
img=this.virtualDir+"images/"+id.replace(/Row/,'')+".gif";if(!text)
text="";if(!style)
style=this.toolButtonStyle;var imgCell="<td id=buttonImg style=\"text-align:center;display:"+((style=="text")?"none":"")+"\"><img id="+id+"Img src=\""+img+"\"></img><td>";var textCell="<td id=buttonText style=\"text-align:center;display:"+((style=="image")?"none":"")+"\">"+text+"</td>";var html="<table cellpadding=0 cellspacing=0><tr>";html+=imgCell;switch(style)
{case"vertical":html+="</tr><tr>";break;case"horizontal":html+="<td>&nbsp;</td>";break;}
html+=textCell;html+="</tr></table>";return html;}
function Component_addCSSRule(ruleName,rule)
{var qualifiedName=ruleName;if(ruleName.indexOf('#')!=0)
qualifiedName='.'+ruleName;var found=false;for(var s=0;s<document.styleSheets.length;s++)
{var rules=(this.isIE)?document.styleSheets[s].rules:document.styleSheets[s].cssRules;for(var r=0;r<rules.length;r++)
{if(("#"+this.container.id+" "+qualifiedName==rules[r].selectorText)||(qualifiedName==rules[r].selectorText));{found=true;break;}}}
if(!found)
{var tmp="#"+this.container.id+" "+qualifiedName;if(this.isIE)
document.styleSheets[0].addRule(tmp,rule);else
document.styleSheets[0].insertRule(tmp+"{"+rule+"}",0);}}
function Component_inspectCSSRule(ruleName,property)
{var found=false;for(var s=0;s<document.styleSheets.length;s++)
{var rules=(this.isIE)?document.styleSheets[s].rules:document.styleSheets[s].cssRules;for(var r=0;r<rules.length;r++)
{if(("#"+this.container.id+" ."+ruleName==rules[r].selectorText)||("."+ruleName==rules[r].selectorText));{return(rules[r].style[property]);}}}
return(null);}
function Component_isMethodAssigned(p)
{switch(typeof(p))
{case"function":case"string":return true;}
return false;}
function Component_convertDateTimeFormat(f)
{if(f.match(/^[ymd].[ymd].[ymd] h:mi:s$/))
return"G";if(f.match(/^[ymd].[ymd].[ymd] h:mi$/))
return"g";if(f.match(/^[ymd].[ymd].[ymd]$/))
return"d";if(f.match(/^h:mi:s$/))
return"T";if(f.match(/^h:mi$/))
return"t";return f;}
function Component_readOnlyDataType(dataType)
{switch(dataType.toLowerCase())
{case"varbinary":case"binary":case"dbtype_binary":case"dbtype_longvarchar":case"dbtype_longvarbinary":case"dbtype_varbinary":case"image":case"blob":case"bytea":case"sql_variant":case"longbinary":return true;}
return false;}
function Component_getDataType(dbDataType)
{if(typeof(dbDataType)!="string")
return null;var dataType;switch(dbDataType.toLowerCase())
{case"dbtype_bool":case"bit":case"11":case"boolean":case"bool":dataType="boolean";break;case"dbtype_dbtime":case"time":case"134":dataType="time";break;case"dbtype_date":case"dbtype_dbdate":case"dbtype_dbtimestamp":case"date":case"datetime":case"smalldatetime":case"timestamp":case"133":case"135":case"7":dataType="date";break;case"dbtype_dbtimestamp":case"dbtype_wvarchar":case"dbtype_wlongvarchar":case"dbtype_varchar":case"dbtype_char":case"dbtype_longvarchar":case"dbtype_wchar":case"char":case"wchar":case"nchar":case"longchar":case"unichar":case"varchar":case"nvarchar":case"wvarchar":case"univarchar":case"long varchar":case"varchar2":case"nvarchar2":case"wvarchar2":case"text":case"ntext":case"memo":case"sysname":case"129":case"200":case"130":case"201":case"202":case"203":case"clob":case"bpchar":case"longtext":dataType="string";break;case"72":case"uniqueidentifier":dataType="guid";break;case"128":case"varbinary":case"blob":case"bytea":dataType="blob";break;default:if(dbDataType.toLowerCase().indexOf("time ")==0)
dataType="time";else if(dbDataType.toLowerCase().indexOf("timestamp ")==0)
dataType="date";else
dataType="numeric";}
return dataType;}
function Component_openModalDialog(url,winName,args,features)
{return this.openDialog(url,winName,args,true,features);}
function Component_openNonModalDialog(url,winName,args,features)
{return(this.openDialog(url,winName,args,false,features));}
function Component_openDialog(url,winName,args,modal,optFeatures)
{if(window.showModalDialog)
{return openDialog(url,winName,args,modal,optFeatures);}
else
{var w=this.openWindows[winName];if(dbNetLink.windowOpen(w))
{window.dialogArguments[winName]=args;w.focus();}
else
{w=dbNetLink.openDialog(url,winName,args,modal,optFeatures);this.openWindows[winName]=w;}
return w;}}
function Component_assignButtonHint(btn,t)
{if(this.isIE)
btn.childNodes[0].title=this.getText(t);else
btn.title=this.getText(t);}
function Component_userProfileDialog()
{if(windowOpen(this.profileWindow))
{this.profileWindow.focus();return;}
var o=new Object();o.grid=this;this.profileWindow=this.openNonModalDialog(this.virtualDir+'common/profile.aspx','profile_window',o);}
function Component_saveUserProfile(title,id)
{this.fireCustomEvent(this.onBeforeProfileSaved,this);var a=new Array();for(var i=0;i<this.userProfileProperties.length;i++)
{var p=this.userProfileProperties[i];if(typeof(this[p])=="undefined")
{var e;if(this.componentName=="DbNetGrid")
e=this.toolbarElement(p);if(typeof(e)=="undefined"||e==null)
e=document.getElementById(p);if(e)
if(e.tagName=="INPUT"&&e.type=="checkbox")
a[a.length]=this.createXmlNode(p,e.checked.toString().toLowerCase());else
a[a.length]=this.createXmlNode(p,e.value);else if(typeof(window[p])!="undefined")
a[a.length]=this.createXmlNode(p,window[p]);}
else
a[a.length]=this.serialize(p);}
var xml=this.createXmlNode("profileTitle",title);xml+=this.createXmlNode("profileId",id);xml+=this.serialize("profileKey");xml+=this.serialize("profileUser");xml+="<profile>"+a.join("")+"</profile>";if(!this.callService(xml,'saveuserprofile'))
return
this.currentProfileId=this.getNodeValue('id');this.loadProfileCombo();this.fireCustomEvent(this.onProfileSaved,this);return this.getNodeValue('html');}
function Component_deleteUserProfile(id)
{var xml=this.createXmlNode("profileId",id);xml+=this.serialize("profileKey");xml+=this.serialize("profileUser");if(!this.callService(xml,'deleteuserprofile'))
return"";this.currentProfileId="";this.loadProfileCombo();this.fireCustomEvent(this.onProfileDeleted,this);return this.getNodeValue('html');}
function Component_loadProfileCombo()
{if(this.profileCombo!=null)
{this.loadUserProfiles(this.profileCombo,this.profileSelectText);this.profileCombo.value=this.currentProfileId;}}
function Component_selectUserProfile(id)
{if(this.profileRestore)
dbNetLink.setCookie(this.profileKey,id);var xml=this.createXmlNode("profileId",id);if(!this.callService(xml,'selectuserprofile'))
return;for(var i=0;i<this.userProfileProperties.length;i++)
{var p=this.userProfileProperties[i];if(!this.getNode(p))
continue;if(typeof(this[p])!="undefined")
{switch(p)
{case"searchDialogContent":case"simpleSearchDialogContent":this[p]=xmlFromNode(this.getNode(p));break;case"filterPart":this[p]=this.getNodeValue("/root/profile/"+p);break;default:if(dbNetLink.testArray(this[p]))
{var nl=this.getNode(p).childNodes;var a=new Array();for(var n=0;n<nl.length;n++)
a[a.length]=dbNetLink.textFromNode(nl[n]);this[p]=a;}
else
this[p]=this.getNodeValue(p);break;}}
else
{var e;if(this.componentName=="DbNetGrid")
e=this.toolbarElement(p);if(typeof(e)=="undefined"||e==null)
e=document.getElementById(p);if(e)
if(e.tagName=="INPUT"&&e.type=="checkbox")
e.checked=eval(this.getNodeValue(p));else
e.value=this.getNodeValue(p)
else if(typeof(window[p])!="undefined")
window[p]=this.getNodeValue(p);}}
this.currentProfileId=id;this.fireCustomEvent(this.onProfileSelected,this);if(this.componentName=="DbNetGrid")
this.loadData();else
this.initialiseNavigator();if(this.profileCombo!=null)
this.profileCombo.value=this.currentProfileId;}
function Component_loadUserProfiles(e,emptyOption)
{var xml=this.serialize("profileKey");xml+=this.serialize("profileUser");if(!this.callService(xml,'loaduserprofiles'))
return"";if(e!=null)
{e.innerHTML="";var onchange=e.onchange;var p=e.parentNode;var tags=e.parentNode.innerHTML.split('><');p.innerHTML=tags[0]+">"+((typeof(emptyOption)=="string")?"<option value=\"\">"+emptyOption:"")+this.getNodeValue('html')+"</select>";p.childNodes[0].onchange=onchange;this.profileCombo=p.childNodes[0];}
return this.getNodeValue('html');}
function Component_addUserProfileProperties(p)
{if(!dbNetLink.testArray(p))
p=p.split(",");this.userProfileProperties=this.userProfileProperties.concat(p);}
function Component_setAccessKey(el)
{var txt=el.innerHTML;var accessKey=txt.toLowerCase().match(/<u>(.*)<\/u>/);if(accessKey)
el.accessKey=accessKey[1];}
function Component_isEncrypted(s)
{if(typeof(s)=="string")
return(s.indexOf("___")==0);else
return false;}
function Component_escape(s)
{return escape(s).replace(/\+/g,"%2B");}
function Component_selectProfile()
{if(this.profileCombo.value!="")
this.selectUserProfile(this.profileCombo.value);else if(this.profileRestore)
dbNetLink.deleteCookie(this.profileKey);}
function Component_configureSimpleSearchFilter()
{var f=this.simpleSearchFilter;if(typeof(f)=="string")
f=new Array(new Array("",f));if(typeof(f[0])=="string")
f=new Array(new Array(f[0],f[1]));this.simpleSearchFilter=f;}
cultureInfo.prototype.dpRE=null;cultureInfo.prototype.dateTimeSeparator=' ';cultureInfo.prototype.numberDecimalSeparator='.';cultureInfo.prototype.formattedDate=cultureInfo_formattedDate;cultureInfo.prototype.formatHint=cultureInfo_formatHint;cultureInfo.prototype.isDate=cultureInfo_isDate;cultureInfo.prototype.isDateTime=cultureInfo_isDateTime;cultureInfo.prototype.isNumeric=cultureInfo_isNumeric;cultureInfo.prototype.isTime=cultureInfo_isTime;cultureInfo.prototype.sizeDateTimeField=cultureInfo_sizeDateTimeField;cultureInfo.prototype.stringToJavascriptDateObject=cultureInfo_stringToJavascriptDateObject;cultureInfo.prototype.stringToDate=cultureInfo_stringToJavascriptDateObject;cultureInfo.prototype.javascriptDateObjectToString=cultureInfo_javascriptDateObjectToString;cultureInfo.prototype.dateToString=cultureInfo_javascriptDateObjectToString;function cultureInfo(comp,doc)
{var cultureInfoNode=comp.getNode('CultureInfo',doc);if(cultureInfoNode)
{for(var i=0;i<cultureInfoNode.childNodes.length;i++)
{var node=cultureInfoNode.childNodes[i];this[node.nodeName]=dbNetLink.textFromNode(node);}}
this.dpRE=new RegExp('\\'+((this.numberDecimalSeparator=='')?'.':this.numberDecimalSeparator));}
function cultureInfo_formatHint(format)
{var hint='';switch(format)
{case'd':hint=this.shortDatePattern;break;case'g':hint=this.shortDatePattern+' '+this.shortTimePattern;break;case'G':hint=this.shortDatePattern+' '+this.longTimePattern;break;case't':hint=this.shortTimePattern;break;case'T':hint=this.longTimePattern;break;default:hint=this.shortDatePattern;break;}
return hint.toLowerCase();}
function cultureInfo_stringToJavascriptDateObject(str,format)
{if(!format)
format="d";var d=null;var o=this.isDateTime(str,format,true);if(o)
{switch(format)
{case'G':var d=new Date(o.year,o.month-1,o.day,o.hour,o.mins,o.secs);break;case'g':var d=new Date(o.year,o.month-1,o.day,o.hour,o.mins,0);break;default:var d=new Date(o.year,o.month-1,o.day);break;}}
return d;}
function cultureInfo_javascriptDateObjectToString(o,format)
{if(!format)
format="d";return this.formattedDate(format,o.getFullYear(),o.getMonth()+1,o.getDate(),o.getHours(),o.getMinutes());}
function cultureInfo_isNumeric(str)
{if(this.numberDecimalSeparator!='.')
if(str.indexOf('.')>=0)
return false;return!isNaN(str.replace(this.dpRE,'.'));}
function cultureInfo_isDateTime(dateTimeValue,format,returnObject)
{if(typeof(returnObject)=='undefined')
returnObject=false;if(dateTimeValue=='')
return(returnObject)?null:false;if(typeof(format)=='undefined')
format='d';else
{var validFormats="dgGtT";if(format==''||validFormats.indexOf(format)<0)
format='d';}
var dateTimeParts=dateTimeValue.split(this.dateTimeSeparator);var rv;switch(format.toLowerCase())
{case'g':if(dateTimeParts.length==2)
{if(returnObject)
{rv=this.isDate(dateTimeParts[0],format,true);if(rv!=null)
{var o=this.isTime(dateTimeParts[1],format,true);if(o!=null)
for(var i in o)
rv[i]=o[i];}}
else
{rv=false;if(this.isDate(dateTimeParts[0],format,false))
if(this.isTime(dateTimeParts[1],format,false))
rv=true;}}
break;case'd':rv=this.isDate(dateTimeParts[0],format,returnObject);break;case't':rv=this.isTime(dateTimeParts[0],format,returnObject);break;}
return rv;}
function cultureInfo_isDate(dateValue,format,returnObject)
{if(typeof(returnObject)=='undefined')
returnObject=false;var formatParts=this.shortDatePattern.split(this.dateSeparator);var dateParts=dateValue.split(this.dateSeparator);for(var i=0;i<dateParts.length;i++)
{if(isNaN(dateParts[i]))
return(returnObject)?null:false;dateParts[i]=parseInt(dateParts[i],10);}
var obj=new Object();if(dateParts.length!=formatParts.length)
return(returnObject)?null:false;var d1=new Date();obj.month=d1.getMonth()+1;obj.year=d1.getFullYear();obj.day=d1.getDate();for(var i=0;i<formatParts.length;i++)
{switch(formatParts[i].toLowerCase())
{case'd':case'dd':obj.day=dateParts[i];break;case'y':case'yy':case'yyyy':obj.year=dateParts[i];break;case'm':case'mm':obj.month=dateParts[i];break;}}
var d2=new Date(obj.year,obj.month-1,obj.day);if(d2.getFullYear()!=obj.year||d2.getMonth()!=(obj.month-1)||d2.getDate()!=obj.day)
return(returnObject)?null:false;return(returnObject)?obj:true;}
function cultureInfo_isTime(timeValue,format,returnObject)
{if(typeof(returnObject)=='undefined')
returnObject=false;var obj=new Object();var formatParts;if(format=='g'||format=='t')
formatParts=this.shortTimePattern.split(this.timeSeparator);else
formatParts=this.longTimePattern.split(this.timeSeparator);var timeParts=timeValue.split(this.timeSeparator);for(var i=0;i<timeParts.length;i++)
{if(isNaN(timeParts[i]))
return(returnObject)?null:false;timeParts[i]=parseInt(timeParts[i],10);}
if(timeParts.length!=formatParts.length)
return(returnObject)?null:false;obj.hour=0;obj.mins=0;obj.secs=0;for(var i=0;i<formatParts.length;i++)
{switch(formatParts[i].toLowerCase())
{case'h':case'hh':obj.hour=timeParts[i];break;case'm':case'mm':obj.mins=timeParts[i];break;case's':case'ss':obj.secs=timeParts[i];break;}}
if(obj.hour>23||obj.hour<0||obj.mins>59||obj.mins<0||obj.secs>59||obj.secs<0)
return(returnObject)?null:false;return(returnObject)?obj:true;}
function cultureInfo_formattedDate(format,year,month,day,hour,min)
{var datePart='';var timePart='';if(format=='d'||format=='g'||format=='G')
{var formatParts=this.shortDatePattern.split(this.dateSeparator);var arr=new Array();for(var i=0;i<formatParts.length;i++)
{switch(formatParts[i].toLowerCase())
{case'd':case'dd':arr[arr.length]=day;break;case'm':case'mm':arr[arr.length]=month;break;case'y':case'yy':case'yyyy':arr[arr.length]=year;break;}}
datePart=arr.join(this.dateSeparator);}
if(format.toLowerCase()=='g'||format.toLowerCase()=='t')
{arr=new Array();if(format=='g'||format=='t')
formatParts=this.shortTimePattern.split(this.timeSeparator);else
formatParts=this.longTimePattern.split(this.timeSeparator);for(var i=0;i<formatParts.length;i++)
{switch(formatParts[i].toLowerCase())
{case'h':case'hh':arr[arr.length]=lz(hour);break;case'm':case'mm':arr[arr.length]=lz(min);break;case's':case'ss':arr[arr.length]='00';break;}}
timePart=arr.join(this.timeSeparator);}
if(datePart!='')
return datePart+' '+timePart;return timePart;}
function cultureInfo_sizeDateTimeField(field)
{var format='d';if(typeof(field.format!='undefined'))
if(field.format!='')
format=field.format;switch(format)
{case'd':l=10;break;case'g':l=16;break;case'G':l=19;break;case't':l=5;break;case'T':l=8;break;default:l=20;break;}
field.size=l;field.maxLength=20;}
function getElementById(rootNode,id)
{return dbNetLink.getElementById(rootNode,id);}
function disableElementById(rootNode,id,disabled)
{var el=dbNetLink.getElementById(rootNode,id);if(el)
el.disabled=disabled;}
function hideElementById(rootNode,id,visible)
{var el=dbNetLink.getElementById(rootNode,id);if(el)
el.style.display=(visible)?'block':'none';}
function setElementStyleById(rootNode,id,styleName,styleValue)
{var el=dbNetLink.getElementById(rootNode,id);if(el)
el.style[styleName]=styleValue;}
function getElementsByClassName(node,className,tagName)
{if(tagName==undefined||tagName==null)
tagName="*";var arr=node.getElementsByTagName(tagName);var ret=new Array();for(var i=0;i<arr.length;i++)
if(arr[i].className.toLowerCase()==className.toLowerCase())
ret[ret.length]=arr[i];return ret;}
function textFromNode(n)
{return dbNetLink.textFromNode(n);}
function xmlFromNode(n)
{if(n==null)
return'';if(typeof(n.xml)=='string')
return n.xml;var s=new XMLSerializer();return(s.serializeToString(n));}
function getNodeValue(doc,pattern)
{return dbNetLink.getNodeValue(doc,pattern);}
function getNode(doc,pattern)
{return dbNetLink.getNode(doc,pattern);}
function addOption(select,text,value)
{var opt=document.createElement("OPTION");opt.value=value;if(document.all)
opt.text=text;else
opt.innerHTML=text;select.options.add(opt);}
function setAccessKey(el)
{var txt=el.innerHTML;var accessKey=txt.toLowerCase().match(/<u>(.*)<\/u>/);if(accessKey)
el.accessKey=accessKey[1];}
function lz(num)
{if(num<10)
return'0'+num.toString();else
return num.toString();}
function testArray(obj)
{return dbNetLink.testArray(obj);}
function sizeDialog(centre)
{dbNetLink.sizeDialog(centre);}
function windowOpen(w)
{return dbNetLink.windowOpen(w);}
function DbNetLink_openModalDialog(url,winName,args,features)
{return dbNetLink.openDialog(url,winName,args,true,features);}
function DbNetLink_openNonModalDialog(url,winName,args,features)
{return(dbNetLink.openDialog(url,winName,args,false,features));}
function openModalDialog(url,winName,args,features)
{return dbNetLink.openDialog(url,winName,args,true,features);}
function openNonModalDialog(url,winName,args,features)
{return(dbNetLink.openDialog(url,winName,args,false,features));}
function openDialog(url,winName,args,modal,optFeatures)
{return dbNetLink.openDialog(url,winName,args,modal,optFeatures);}
function DbNetLink_openDialog(url,winName,args,modal,optFeatures)
{var top=(parseInt(window.screen.availHeight)-100)/2;var left=(parseInt(window.screen.availWidth)-100)/2;winName=winName+dbNetLink.isIE?"":"_"+new Date().valueOf();var features;if(typeof(optFeatures)=='undefined')
optFeatures='';var standardWindow=false;if(args)
standardWindow=eval(args.standardWindow)
if(window.showModalDialog&&!standardWindow)
{features="dialogHeight=200px;dialogWidth=200px;status=yes;help=no;resizable=yes";if(optFeatures!='')
features+=';'+optFeatures.replace(/\,/g,';');if(modal)
return window.showModalDialog(url,args,features);else
return window.showModelessDialog(url,args,features);}
else
{features="top="+top+",left="+left+",toolbar=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=yes,dependent=yes,modal=yes,dialog=yes";if(optFeatures!='')
features+=','+optFeatures.replace(/\;/g,',').replace('dialogHeight','height').replace('dialogWidth','width');if(features.indexOf('height='<0))
features+=',height=100px';if(features.indexOf('width='<0))
features+=',width=100px';if(!window.dialogArguments)
window.dialogArguments=new Object();window.dialogArguments[winName]=args;return window.open(url,winName,features);}}
function centreDialog()
{var h=parseInt(window.screen.availHeight);var w=parseInt(window.screen.availWidth);if(window.dialogTop)
{var left=(w-parseInt(window.dialogWidth))/2;var top=(h-parseInt(window.dialogHeight))/2;window.dialogTop=top+"px";window.dialogLeft=left+"px";}
else
{var left=(w-window.outerWidth)/2;var top=(h-window.outerHeight)/2;window.moveTo(left,top);}}
function repositionDialog(args)
{if(args==null)
return;if(window.dialogTop)
{window.dialogTop=args.y;window.dialogLeft=args.x;}
else
window.moveTo(args.x,args.y);}
function viewSource()
{var o=new Component();initialiseComponent(o);o.xmlRequest.open("GET",document.location.href,false);o.xmlRequest.setRequestHeader("Content-Type","text/XML");o.xmlRequest.send(null);var params=new Object();params.source=o.xmlRequest.responseText;openModalDialog('../common/viewsource.htm','viewsource',params);}
function getCoords(event)
{var o=new Object();if(!event)
{o.srcElement=window.event.srcElement;o.x=window.event.screenX;o.y=window.event.screenY;o.event=window.event;}
else
{o.srcElement=event.target||event.srcElement;o.x=event.screenX;o.y=event.screenY;o.event=event;}
return o;}
function getWindowArguments()
{try
{if(opener)
if(opener.dialogArguments)
return opener.dialogArguments[window.name];}
catch(e){}
if(window.dialogArguments)
return window.dialogArguments;return null;}
function addClassName(e,className)
{dbNetLink.addClassName(e,className);}
function removeClassName(e,className)
{dbNetLink.removeClassName(e,className);}
function $(id)
{return document.getElementById(id);}
function sleep(millisecs)
{if(window.showModalDialog)
{}
else
java.lang.Thread.sleep(millisecs);}
function arrayToOptions(str)
{var arr=eval(str);var html=new Array();for(var i=0;i<arr.length;i++)
{if(arr[i].length<2)
continue;var option="<option value='"+arr[i][0]+"'>"+arr[i][1];html[html.length]=option;}
return html.join("");}
function showMessage(str)
{dbNetLink.showMessage(str);}
function clearMessage()
{dbNetLink.clearMessage();}
function createChildNodeObject(node)
{var nodeObj=new Object();for(var j=0;j<node.childNodes.length;j++)
nodeObj[node.childNodes[j].nodeName]=dbNetLink.textFromNode(node.childNodes[j]);return(nodeObj);}
function getParentElement(e,tagName)
{while(e.tagName!=tagName.toUpperCase())
{if(e.parentNode)
e=e.parentNode;else
break;}
return e;}
if(typeof(DOMParser)!="undefined")
_loadMozillaCompatLayer();function _loadMozillaCompatLayer()
{if(typeof HTMLElement!="undefined"&&!HTMLElement.prototype.insertAdjacentElement)
{HTMLElement.prototype.insertAdjacentElement=function(where,parsedNode)
{switch(where)
{case'beforeBegin':this.parentNode.insertBefore(parsedNode,this);break;case'afterBegin':this.insertBefore(parsedNode,this.firstChild);break;case'beforeEnd':this.appendChild(parsedNode);break;case'afterEnd':if(this.nextSibling)
this.parentNode.insertBefore(parsedNode,this.nextSibling);else
this.parentNode.appendChild(parsedNode);break;}}
HTMLElement.prototype.insertAdjacentHTML=function(where,htmlStr)
{var r=this.ownerDocument.createRange();r.setStartBefore(this);var parsedHTML=r.createContextualFragment(htmlStr);this.insertAdjacentElement(where,parsedHTML);}
HTMLElement.prototype.insertAdjacentText=function(where,txtStr)
{var parsedText=document.createTextNode(txtStr);this.insertAdjacentElement(where,parsedText);}}
if(document.implementation&&document.implementation.createDocument)
{XMLDocument.prototype.selectNodes=function(sExpr,contextNode)
{var oResult=this.evaluate(sExpr,(contextNode?contextNode:this),this.createNSResolver(this.documentElement),XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);var nodeList=new Array(oResult.snapshotLength);nodeList.expr=sExpr;for(i=0;i<nodeList.length;i++)
nodeList[i]=oResult.snapshotItem(i);return nodeList;};Element.prototype.selectNodes=function(sExpr)
{var doc=this.ownerDocument;if(doc.selectNodes)
return doc.selectNodes(sExpr,this);else
throw"Method selectNodes is only supported by XML Nodes";};XMLDocument.prototype.selectSingleNode=function(sExpr,contextNode)
{var ctx=contextNode?contextNode:null;sExpr+="[1]";var nodeList=this.selectNodes(sExpr,ctx);if(nodeList.length>0)
return nodeList[0];else
return null;};Element.prototype.selectSingleNode=function(sExpr)
{var doc=this.ownerDocument;if(doc.selectSingleNode)
return doc.selectSingleNode(sExpr,this);else
throw"Method selectSingleNode is only supported by XML Nodes";};HTMLElement.prototype.__defineGetter__("parentElement",function()
{return(this.parentNode==this.ownerDocument)?null:this.parentNode;});var _emptyTags={"IMG":true,"BR":true,"INPUT":true,"META":true,"LINK":true,"PARAM":true,"HR":true};HTMLElement.prototype.__defineGetter__("outerHTML",function(){var attrs=this.attributes;var str="<"+this.tagName;for(var i=0;i<attrs.length;i++)
str+=" "+attrs[i].name+"=\""+attrs[i].value+"\"";if(_emptyTags[this.tagName])
return str+">";return str+">"+this.innerHTML+"</"+this.tagName+">";});HTMLElement.prototype.__defineSetter__("outerHTML",function(sHTML){var r=this.ownerDocument.createRange();r.setStartBefore(this);var df=r.createContextualFragment(sHTML);this.parentNode.replaceChild(df,this);});HTMLElement.prototype.__defineGetter__("innerText",function(){var tmp=this.innerHTML.replace(/<br>/gi,"\n");return tmp.replace(/<[^>]+>/g,"");});HTMLElement.prototype.__defineSetter__("innerText",function(txtStr){var parsedText=document.createTextNode(txtStr);this.innerHTML="";this.appendChild(parsedText);});HTMLElement.prototype.click=function(){var evt=this.ownerDocument.createEvent('MouseEvents');evt.initMouseEvent('click',true,true,this.ownerDocument.defaultView,1,0,0,0,0,false,false,false,false,0,null);this.dispatchEvent(evt);}}}
DbNetEdit.prototype.componentName='DbNetEdit';DbNetEdit.prototype.configLang='default';DbNetEdit.prototype.addButton=DbNetEdit_addButton;DbNetEdit.prototype.addLinkedEditForm=DbNetEdit_addLinkedEditForm;DbNetEdit.prototype.addSuggestField=DbNetEdit_addSuggestField;DbNetEdit.prototype.appendHtml=DbNetEdit_appendHtml;DbNetEdit.prototype.applyChanges=DbNetEdit_applyChanges;DbNetEdit.prototype.applyFieldChange=DbNetEdit_applyFieldChange;DbNetEdit.prototype.applySearchCriteria=DbNetEdit_doSearch;DbNetEdit.prototype.assignButtonAction=DbNetEdit_assignButtonAction;DbNetEdit.prototype.assignColumnData=DbNetEdit_assignColumnData;DbNetEdit.prototype.browsePaneToolbar=DbNetEdit_browsePaneToolbar;DbNetEdit.prototype.buildEditNavigator=DbNetEdit_buildEditNavigator;DbNetEdit.prototype.buildToolbar=DbNetEdit_buildToolbar;DbNetEdit.prototype.cancelChanges=DbNetEdit_cancelChanges;DbNetEdit.prototype.checkForChanges=DbNetEdit_checkForChanges;DbNetEdit.prototype.clearImage=DbNetEdit_clearImage;DbNetEdit.prototype.clearSelectedRows=DbNetEdit_clearSelectedRows;DbNetEdit.prototype.commitChanges=DbNetEdit_commitChanges;DbNetEdit.prototype.commonDataStructure=DbNetEdit_commonDataStructure;DbNetEdit.prototype.configureField=DbNetEdit_configureField;DbNetEdit.prototype.createMceEditor=DbNetEdit_createMceEditor;DbNetEdit.prototype.createPreviewField=DbNetEdit_createPreviewField;DbNetEdit.prototype.createSimpleSearch=DbNetEdit_createSimpleSearch;DbNetEdit.prototype.deleteRecord=DbNetEdit_deleteRecord;DbNetEdit.prototype.disable=DbNetEdit_disable;DbNetEdit.prototype.disableRow=DbNetEdit_disableRow;DbNetEdit.prototype.displayPageData=DbNetEdit_displayPageData;DbNetEdit.prototype.doAfterUpload=DbNetEdit_doAfterUpload;DbNetEdit.prototype.doBeforeUpload=DbNetEdit_doBeforeUpload;DbNetEdit.prototype.doSearch=DbNetEdit_doSearch;DbNetEdit.prototype.doSort=DbNetEdit_doSort;DbNetEdit.prototype.editor=DbNetEdit_editor;DbNetEdit.prototype.openEditor=DbNetEdit_openEditor;DbNetEdit.prototype.editRowInitialisation=DbNetEdit_editRowInitialisation;DbNetEdit.prototype.error=DbNetEdit_error;DbNetEdit.prototype.fieldChange=DbNetEdit_fieldChange;DbNetEdit.prototype.fieldPropertyValue=DbNetEdit_fieldPropertyValue;DbNetEdit.prototype.findControlByName=DbNetEdit_findControlByName;DbNetEdit.prototype.getChanges=DbNetEdit_getChanges;DbNetEdit.prototype.getField=DbNetEdit_getField;DbNetEdit.prototype.getLookupSql=DbNetEdit_getLookupSql;DbNetEdit.prototype.getModifiedRowCount=DbNetEdit_getModifiedRowCount;DbNetEdit.prototype.getNextRow=DbNetEdit_getNextRow;DbNetEdit.prototype.getPageRequestXml=DbNetEdit_getPageRequestXml;DbNetEdit.prototype.getPrevRow=DbNetEdit_getPrevRow;DbNetEdit.prototype.getPrimaryKeyValue=DbNetEdit_getPrimaryKeyValue;DbNetEdit.prototype.getSelectedRows=DbNetEdit_getSelectedRows;DbNetEdit.prototype.getSelectOptions=DbNetEdit_getSelectOptions;DbNetEdit.prototype.highlightRow=DbNetEdit_highlightRow;DbNetEdit.prototype.initialise=DbNetEdit_initialise;DbNetEdit.prototype.initialiseLinkedForm=DbNetEdit_initialiseLinkedForm;DbNetEdit.prototype.initialiseMasterForm=DbNetEdit_initialiseMasterForm;DbNetEdit.prototype.initialiseNavigator=DbNetEdit_initialiseNavigator;DbNetEdit.prototype.initialiseSidebar=DbNetEdit_initialiseSidebar;DbNetEdit.prototype.initialiseSpellChecking=DbNetEdit_initialiseSpellChecking;DbNetEdit.prototype.inputControl=DbNetEdit_inputControl;DbNetEdit.prototype.insertRecord=DbNetEdit_insertRecord;DbNetEdit.prototype.isSearchField=DbNetEdit_isSearchField;DbNetEdit.prototype.loadDbNetGridPage=DbNetEdit_loadDbNetGridPage;DbNetEdit.prototype.loadFormTemplate=DbNetEdit_loadFormTemplate;DbNetEdit.prototype.loadHtmlPreviewContent=DbNetEdit_loadHtmlPreviewContent;DbNetEdit.prototype.loadMceEditorContent=DbNetEdit_loadMceEditorContent;DbNetEdit.prototype.loadSelectOptions=DbNetEdit_loadSelectOptions;DbNetEdit.prototype.locateKeyValue=DbNetEdit_locateKeyValue;DbNetEdit.prototype.lookupTextKeyPress=DbNetEdit_lookupTextKeyPress;DbNetEdit.prototype.makeButton=DbNetEdit_makeButton;DbNetEdit.prototype.navigateToKeyValue=DbNetEdit_navigateToKeyValue;DbNetEdit.prototype.navigatorMoveFirst=DbNetEdit_navigatorMoveFirst;DbNetEdit.prototype.navigatorMoveLast=DbNetEdit_navigatorMoveLast;DbNetEdit.prototype.navigatorMoveNext=DbNetEdit_navigatorMoveNext;DbNetEdit.prototype.navigatorMovePrevious=DbNetEdit_navigatorMovePrevious;DbNetEdit.prototype.navigatorSelectCurrent=DbNetEdit_navigatorSelectCurrent;DbNetEdit.prototype.openEditLookup=DbNetEdit_openEditLookup;DbNetEdit.prototype.pageNavigator=DbNetEdit_pageNavigator;DbNetEdit.prototype.parseNavigatorResponse=DbNetEdit_parseNavigatorResponse;DbNetEdit.prototype.populatedLinkedForm=DbNetEdit_populatedLinkedForm;DbNetEdit.prototype.positionBrowseHeading=DbNetEdit_positionBrowseHeading;DbNetEdit.prototype.propertiesComplete=DbNetEdit_propertiesComplete;DbNetEdit.prototype.qualifyColumnName=DbNetEdit_qualifyColumnName;DbNetEdit.prototype.registerDbNetGrid=DbNetEdit_registerDbNetGrid;DbNetEdit.prototype.repeatRows=DbNetEdit_repeatRows;DbNetEdit.prototype.repopulateLookup=DbNetEdit_repopulateLookup;DbNetEdit.prototype.retrieve=DbNetEdit_retrieve;DbNetEdit.prototype.retrieveMceEditorContent=DbNetEdit_retrieveMceEditorContent;DbNetEdit.prototype.searchAction=DbNetEdit_defaultSearchAction;DbNetEdit.prototype.selectContainer=DbNetEdit_selectContainer;DbNetEdit.prototype.selectDbNetGridRow=DbNetEdit_selectDbNetGridRow;DbNetEdit.prototype.selectedDate=DbNetEdit_selectedDate;DbNetEdit.prototype.selectFirst=DbNetEdit_selectFirst;DbNetEdit.prototype.selectLast=DbNetEdit_selectLast;DbNetEdit.prototype.selectNext=DbNetEdit_selectNext;DbNetEdit.prototype.selectPage=DbNetEdit_selectPage;DbNetEdit.prototype.selectPrior=DbNetEdit_selectPrior;DbNetEdit.prototype.selectRow=DbNetEdit_selectRow;DbNetEdit.prototype.setButtonStatus=DbNetEdit_setButtonStatus;DbNetEdit.prototype.setFieldProperty=DbNetEdit_setFieldProperty;DbNetEdit.prototype.setFieldFocus=DbNetEdit_setFieldFocus;DbNetEdit.prototype.setFocus=DbNetEdit_setFocus;DbNetEdit.prototype.setParentFormDeleteButtonStatus=DbNetEdit_setParentFormDeleteButtonStatus;DbNetEdit.prototype.setScrollButtonState=DbNetEdit_setScrollButtonState;DbNetEdit.prototype.setSearchFieldProperty=DbNetEdit_setSearchFieldProperty;DbNetEdit.prototype.setSearchResult=DbNetEdit_setSearchResult;DbNetEdit.prototype.showBrowseWindow=DbNetEdit_showBrowseWindow;DbNetEdit.prototype.showImageWindow=DbNetEdit_showImageWindow;DbNetEdit.prototype.showSearchWindow=DbNetEdit_showSearchWindow;DbNetEdit.prototype.simpleSearchIsValid=DbNetEdit_simpleSearchIsValid;DbNetEdit.prototype.sortData=DbNetEdit_sortData;DbNetEdit.prototype.spell=DbNetEdit_spell;DbNetEdit.prototype.synchroniseSidebar=DbNetEdit_synchroniseSidebar;DbNetEdit.prototype.unappliedChanges=DbNetEdit_unappliedChanges;DbNetEdit.prototype.unhighlightActiveControl=DbNetEdit_unhighlightActiveControl;DbNetEdit.prototype.unhighlightRow=DbNetEdit_unhighlightRow;DbNetEdit.prototype.updateBrowsePaneToolbar=DbNetEdit_updateBrowsePaneToolbar;DbNetEdit.prototype.updateImageWindow=DbNetEdit_updateImageWindow;DbNetEdit.prototype.updateLookupText=DbNetEdit_updateLookupText;DbNetEdit.prototype.upload=DbNetEdit_upload;DbNetEdit.prototype.uploadCallback=DbNetEdit_uploadCallback;DbNetEdit.prototype.validateFields=DbNetEdit_validateFields;DbNetEdit.prototype.onAfterGridUpdated=null;DbNetEdit.prototype.onAfterUpload=null;DbNetEdit.prototype.onBeforeUpload=null;DbNetEdit.prototype.onDeleteApply=null;DbNetEdit.prototype.onEditApply=null;DbNetEdit.prototype.onEditCancel=null;DbNetEdit.prototype.onBeforeInitialised=null;DbNetEdit.prototype.onInitialised=null;DbNetEdit.prototype.onPageLoaded=null;DbNetEdit.prototype.onValidationFailed=null;DbNetEdit.prototype.onDeleteError=null;DbNetEdit.prototype.onEditError=null;function DbNetEdit(id)
{var e=id
initialiseComponent(this);switch(typeof(id))
{case"string":e=$(e);break;}
if(!e)
{this.checkDOM(id);return;}
this.trace=true
this.container=e;if(this.container.getAttribute("formTemplatePath")!=null)
this.loadFormTemplate(this.container.getAttribute("formTemplatePath"));if(this.container.getAttribute("configLang")!=null&&this.container.getAttribute("configLang")!="")
this.configLang=this.container.getAttribute("configLang");this.initialiseStyleSheet();this.XmlData=this.createXmlDocument();this.XmlSelectData=this.createXmlDocument();this.navigatorInfo=new Object()
this.navigatorInfo.data=null;this.navigatorInfo.index=null;this.navigatorInfo.startIndex=null;this.navigatorInfo.endIndex=null;this.navigatorInfo.recordSetLength=null;this.navigatorInfo.currentPage=null;this.navigatorData=new Object();this.navigatorData.length=null;this.fieldProperties=new Array();this.searchFieldProperties=new Array();this.fields=new Array();this.detailFormArray=new Array();this.rowContainers=new Array();this.sortFields=new Array();this.sortLabels=new Array();this.searchLabels=new Array();this.searchFields=new Array();this.browseColumns=new Array();this.browseTitles=new Array();this.imageWindow=new Object();this.searchDialogContent=new Object();window.DbNetEditArray[e.id]=this;this.profileKey=window.location.pathname.replace(/\W/g,"_")+"_"+this.id
var tags=getElementsByClassName(this.container,'dbneteditrow','TR');for(var i=0;i<tags.length;i++)
this.rowContainers[this.rowContainers.length]=tags[i];if(this.rowContainers.length==0)
{this.tabular=false;this.rowContainers[0]=this.container;}
else
{var repeat=this.rowContainers[0].getAttribute('repeat');this.tabular=true;if(this.rowContainers.length==1)
if(!isNaN(repeat))
this.repeatRows(this.rowContainers[0],repeat);var el=this.rowContainers[0];while(el&&el.tagName!='TABLE')
el=el.parentElement;if(el.tagName=='TABLE')
{this.columns=new Array();var cg=el.getElementsByTagName('COLGROUP');if(!cg.length)
{cg=el.insertBefore(document.createElement("COLGROUP"),el.childNodes[0]);for(var i=0;i<el.rows[0].cells.length;i++)
this.columns[this.columns.length]=cg.appendChild(document.createElement("COL"));}
else
for(var i=0;i<cg.length;i++)
this.columns[this.columns.length]=cg[i];}}
this.pageRowCount=this.rowContainers.length;for(var r=0;r<this.rowContainers.length;r++)
{this.rowContainers[r].multiRowIndex=r;var fieldElements=getElementsByClassName(this.rowContainers[r],"dbnetedit");this.fields[r]=new Array();for(var i=0;i<fieldElements.length;i++)
{if(fieldElements[i].id!='')
{this.fields[r][this.fields[r].length]=fieldElements[i];fieldElements[i].multiRowIndex=r;}}}}
function DbNetEdit_repeatRows(row,repeatCount)
{var table=row.parentElement;for(var i=0;i<repeatCount-1;i++)
{newRow=row.cloneNode(true);row.insertAdjacentElement("afterEnd",newRow);this.rowContainers[this.rowContainers.length]=newRow;row=newRow;}}
function DbNetEdit_propertiesComplete()
{if(this.container==null)
{this.error("the container element is not defined")
return false}
var error=0;var mandatoryProperties=['primaryKeyName','tableName'];for(var i=0;i<mandatoryProperties.length;i++)
{if(this[mandatoryProperties[i]]==''||this[mandatoryProperties[i]]==null)
{this.error("the '"+mandatoryProperties[i]+"' property is not defined")
error++;}}
if(error>0)
return false;var fieldIds=new Object();for(var i=0;i<this.fields[0].length;i++)
{if(fieldIds[this.fields[0][i].id])
{this.error("The field '"+this.fields[0][i].id+"' is duplicated");error++;break;}
fieldIds[this.fields[0][i].id]=true;}
if(error>0)
return false;if(this.browseColumns.length!=this.browseTitles.length)
{this.error("the properties browseColumns and browseTitles do not have the same # of elements")
return false;}
var browsePaneId=this.container.id+".browsePane";if($(browsePaneId))
this.browseContainer=$(browsePaneId);if(this.browseContainer!=null)
{if(typeof(this.browseContainer)=='string')
this.browseContainer=$(this.browseContainer)
if(typeof(this.browseContainer.innerHTML)!='string')
{this.error('browseContainer does not indicate a valid container element')
return false}}
return true}
function DbNetEdit_error(msg)
{alert("Error in form "+((this.container==null)?'':this.container.id)+"\n\n"+msg);}
function DbNetEdit_initialiseMasterForm()
{this.initialise();}
function DbNetEdit_initialiseLinkedForm()
{}
function DbNetEdit_registerDbNetGrid(params)
{if(typeof(params)=="string")
params=window[params];if(typeof(params.componentName)=='string')
{this.linkStyle='singlepane';this.dbNetGrid=params;}
else
{this.linkStyle='dialog';this.dbNetGrid=params.component;}
this.dbNetGrid.recordsAdded=0;this.dbNetGrid.dbNetEdit=this;this.dbNetGrid.addedRecordIds=new Array();this.dbNetGrid.editControl=this;if(!this.primaryKeyName||this.primaryKeyName=='')
{this.primaryKeyName=this.dbNetGrid.primaryKeyColumn;this.primaryKeyAutoincrement=this.dbNetGrid.primaryKeyAutoincrement;}
if(!this.tableName||this.tableName=='')
this.tableName=this.dbNetGrid.fromPart;if(!this.sequenceName||this.sequenceName=='')
this.sequenceName=this.dbNetGrid.sequenceName;this.initialise(true);if(typeof(params.componentName)=='string')
{if(this.dbNetGrid.currentRow)
{this.primaryKeyValue=this.dbNetGrid.currentRow.id
this.retrieve();}}
else
if(params.primaryKeyValue!='')
{this.primaryKeyValue=params.primaryKeyValue
this.retrieve()}
else
this.insertRecord();}
function DbNetEdit_initialise(deferNavigator)
{this.fireCustomEvent(this.onBeforeInitialised,this);if(!this.propertiesComplete())
return false;for(var i=0;i<this.detailFormArray.length;i++)
if(!this.detailFormArray[i][0].initialised)
this.detailFormArray[i][0].initialise(true);var nodeName,fieldProperty;var xml=new Array();this.sortSequence=new Array();this.sortColumns=new Array();this.sortHeadings=new Array();this.primaryKeyArray=new Array();this.primaryKeyArray=this.primaryKeyName.split(',');for(var i=0;i<this.primaryKeyArray.length;i++)
this.primaryKeyArray[i]=this.primaryKeyArray[i].replace(/^\s+|\s+$/g,"");xml[xml.length]=this.commonDataStructure();xml[xml.length]='<lookups>';for(var i=0;i<this.fields[0].length;i++)
xml[xml.length]="<col"+i+">"+
this.createXmlNode('sql',this.fieldPropertyValue(this.fields[0][i].id,'lookup',''))+'</col'+i+'>';xml[xml.length]='</lookups>';if(!deferNavigator)
xml[xml.length]='<navigator></navigator>';if(this.browseColumns.length>0)
{xml[xml.length]=this.serialise('browseColumns');xml[xml.length]=this.serialise('browseTitles');}
xml[xml.length]=this.serialise('primaryKeyName')+
this.serialise('primaryKeyAutoincrement')+
this.serialise('sequenceName')+
this.serialise('configLang')+
this.serialise('pageRowCount')+
this.serialise('filterPart')+
this.serialise('fixedFilterPart')+
this.serialise('orderBy')+
this.serialise('navigatorPageLength')+'<sortColumns></sortColumns>'+
dbNetLink.createXmlNode('direction','first')+
dbNetLink.createXmlNode('scanFromRow','')+
dbNetLink.createXmlNode('scanToRow','');if(!this.callService(xml.join(''),"initialise"))
return;this.culture=new cultureInfo(this);this.DBMSName=this.getNodeValue("DBMSName");this.primaryKeyName=this.getNodeValue("primaryKeyName");this.primaryKeyType=this.getNodeValue("primaryKeyType");this.primaryKeyDataType=this.getNodeValue("primaryKeyDataType");this.dbNetSpellVirtualDir=this.getNodeValue("dbNetSpellVirtualDir");if(this.text==null)
{this.text=new Object();var languages=this.getChildNodes('text');if(languages!=null)
{for(var i=0;i<languages[0].childNodes.length;i++)
{var node=languages[0].childNodes[i];this.text[node.nodeName]=textFromNode(node);}}}
var nodeList=this.getNode('fields').childNodes;for(var j=0;j<this.pageRowCount;j++)
{var textarea=false;for(var i=0;i<nodeList.length;i++)
{node=nodeList[i];nodeName=textFromNode(node);var e=this.fields[j][i];var lookup='';var required=false;editLookup='';var qNodeName=this.qualifyColumnName(nodeName);for(var fieldProperty in this.fieldProperties[qNodeName])
switch(fieldProperty)
{case'lookup':lookup=this.fieldProperties[qNodeName][fieldProperty][0][0];break;case'required':required=eval(this.fieldProperties[qNodeName][fieldProperty][0][0]);break;case'editLookup':editLookup=this.fieldProperties[qNodeName][fieldProperty][0][0];break;}
var html="";var dataType=node.getAttribute("type");if(e.tagName=="IMG")
{e.onclick=this.assignHandler("showImageWindow");e.style.cursor="pointer";}
if(this.readOnlyDataType(dataType))
{this.setFieldProperty(e.id,"editReadOnly:true");continue;}
if(e.tagName=='SELECT')
e.lookup=lookup;e.originalValue='';}}
if(this.dbNetGrid&&this.linkStyle=='dialog')
{if(!this.editNavigation)
this.editNavigation=getElementById(this.container,'editNavigation');if(!this.editNavigation)
{this.appendHtml('<button id=prevRow type=button><img id=prevRowImg src="'+this.virtualDir+'/images/prev.gif"></button>'+'<button id=nextRow type=button><img id=nextRowImg src="'+this.virtualDir+'/images/next.gif"></button>');getElementById(this.container,'nextRow').onclick=this.assignHandler("getNextRow");getElementById(this.container,'prevRow').onclick=this.assignHandler("getPrevRow");}
else
{this.editNavigation.innerHTML='<button id=prevRow type=button><img id=prevRowImg src="'+this.virtualDir+'/images/prev.gif"></button>'+'<button id=nextRow type=button><img id=nextRowImg src="'+this.virtualDir+'/images/next.gif"></button>';getElementById(this.editNavigation,'nextRow').onclick=this.assignHandler("getNextRow");getElementById(this.editNavigation,'prevRow').onclick=this.assignHandler("getPrevRow");}}
else
{if(getElementById(this.container,'editNavigation'))
{this.navigator=getElementById(this.container,'editNavigation');this.buildEditNavigator(this.navigator);}
if(getElementById(this.container,'navigatorStatus'))
this.navigatorStatus=getElementById(this.container,'navigatorStatus');}
if(this.toolbar)
this.buildToolbar(this.toolbar);else
{if(getElementById(this.container,'toolbar'))
{this.toolbar=getElementById(this.container,'toolbar');this.buildToolbar(this.toolbar);}}
var editorPickerHtml="<select id=editorSelect title=\""+this.getText('editorSelectorTitle')+"\" style='display:block'>"+"<option value=html>"+this.getText('html')+"<option value=text>"+this.getText('text')+"</select>";if(this.editorPicker)
this.editorPicker.innerHTML=editorPickerHtml;else
{var e=getElementById(this.container,'editor');if(e)
{e.innerHTML=editorPickerHtml;}
else
this.appendHtml("<div id=editor>"+editorPickerHtml.replace("block","none")+"</div>");this.editorPicker=getElementById(this.container,'editor');}
if(!this.editorSelector)
this.editorPicker.style.display="none";this.assignButtonAction("insertButton","insertBtn","insertRecord");this.assignButtonAction("applyButton","applyBtn","applyChanges");this.assignButtonAction("cancelButton","cancelBtn","cancelChanges");this.assignButtonAction("deleteButton","deleteBtn","deleteRecord");if(!this.messageLine)
{var e=getElementById(this.container,'messageLine');if(!e)
this.appendHtml("<DIV id=messageLine></DIV>");this.messageLine=getElementById(this.container,'messageLine');}
this.messageLine.innerHTML="&nbsp;";this.disable();if(this.rowContainers.length>1&&eval(this.deleteRow)!=false)
{for(var j=0;j<this.rowContainers.length;j++)
{if(this.rowSelectorPosition.toLowerCase()=='left')
var cell=this.rowContainers[j].insertCell(0);else
var cell=this.rowContainers[j].insertCell(-1);cell.className='dbneteditrowselectorcell';cell.innerHTML="<INPUT id=dbneteditrowselector TYPE=checkbox index="+j+" title='"+this.getText('selectorTitle')+"'>";cell.onclick=this.assignHandler("selectContainer")}}
for(var j=0;j<this.rowContainers.length;j++)
this.assignColumnData(j);this.initialiseSpellChecking();this.initialised=true;if(!deferNavigator)
deferNavigator=false;if(this.navigator!=null&&!deferNavigator)
{this.initialiseNavigator(!deferNavigator);this.navigatorSelectCurrent(!deferNavigator);}
this.createSimpleSearch();this.loadProfileCombo();if(this.profile&&this.profileRestore)
{var cachedProfileId=dbNetLink.getCookie(this.profileKey);if(cachedProfileId!=null)
{if(this.profileCombo)
this.profileCombo.value=cachedProfileId;this.selectUserProfile(cachedProfileId)}}
this.fireCustomEvent(this.onInitialised,this);return true;}
function DbNetEdit_getNextRow()
{var rowIndex=this.dbNetGrid.currentRow.rowIndex+1;var row=this.dbNetGrid.table.rows[rowIndex];if(row)
if(row.className=="evenRow"||row.className=="oddRow")
{if(!this.checkForChanges())
return;this.dbNetGrid.selectRow(null,rowIndex,true);}}
function DbNetEdit_getPrevRow()
{if(this.dbNetGrid.currentRow.rowIndex>1)
{if(!this.checkForChanges())
return;this.dbNetGrid.selectRow(null,this.dbNetGrid.currentRow.rowIndex-1,true);}}
function DbNetEdit_selectDbNetGridRow()
{if(this.dbNetGrid.currentRow.id)
{this.primaryKeyValue=this.dbNetGrid.currentRow.id;this.retrieve();}}
function DbNetEdit_loadDbNetGridPage()
{if(this.dbNetGrid.rowCount>0)
return;this.disable();}
function DbNetEdit_initialiseNavigator(keyValuesInResponse)
{if(typeof(keyValuesInResponse)=='undefined')
keyValuesInResponse=false;this.navigator.dbNetEdit=this;getElementById(this.navigator,'firstToolButton').onclick=this.assignHandler("navigatorMoveFirst");getElementById(this.navigator,'prevToolButton').onclick=this.assignHandler("navigatorMovePrevious");getElementById(this.navigator,'nextToolButton').onclick=this.assignHandler("navigatorMoveNext");getElementById(this.navigator,'lastToolButton').onclick=this.assignHandler("navigatorMoveLast");getElementById(this.navigator,'sortToolButton').onclick=this.assignHandler("sortData");getElementById(this.navigator,'searchToolButton').onclick=this.assignHandler("showSearchWindow");getElementById(this.navigator,'browseToolButton').onclick=this.assignHandler("showBrowseWindow");getElementById(this.navigator,'profileToolButton').onclick=this.assignHandler("userProfileDialog");getElementById(this.navigator,'profileSelect').onchange=this.assignHandler("selectProfile");if(!this.profile)
hideElementById(this.navigator,'profileToolButton',false);if(!this.profileSelect)
hideElementById(this.navigator,'profileSelect',false);else
this.profileCombo=getElementById(this.navigator,'profileSelect');if(this.profileCombo)
if(this.profileCombo.onchange==null)
this.profileCombo.onchange=this.assignHandler("selectProfile");if(this.searchFields.length==0)
hideElementById(this.navigator,'searchToolButton',false);if(this.sortFields.length==0)
hideElementById(this.navigator,'sortToolButton',false);if(this.browseColumns.length==0||this.browseContainer!=null)
hideElementById(this.navigator,'browseToolButton',false);this.navigatorInfo.index=-1;if(!keyValuesInResponse)
this.pageNavigator("first");else
this.parseNavigatorResponse();if(this.navigatorInfo.data)
if(this.navigatorInfo.data.length>0)
this.navigatorInfo.index=0;}
function DbNetEdit_parseNavigatorResponse()
{this.navigatorInfo.data=new Array();var keyValues=this.xmlResponse.selectSingleNode("//navigator").childNodes;for(var i=0;i<keyValues.length;i++)
{var o=new Object();o.dbnetedit_id=textFromNode(keyValues[i])
this.navigatorInfo.data[this.navigatorInfo.data.length]=o;}
this.navigatorInfo.startIndex=parseInt(this.getNodeValue("startIndex"));this.navigatorInfo.endIndex=parseInt(this.getNodeValue("endIndex"));this.navigatorInfo.recordSetLength=parseInt(this.getNodeValue("recordSetLength"));this.navigatorInfo.currentPage=parseInt(this.getNodeValue("currentPage"));this.navigatorInfo.pageCount=parseInt(this.getNodeValue("pageCount"));this.navigatorData.length=this.navigatorInfo.recordSetLength;if(this.browseColumns.length>0)
{this.browseTableContent=this.getNodeValue("browseTable");this.initialiseSidebar()}}
function DbNetEdit_initialiseSidebar()
{if(this.browseWin)
if(!this.browseWin.closed)
{this.browseWin.initialise();return;}
if(this.browseContainer==null)
return;addClassName(this.browseContainer,"tableContainer");this.browseContainer.innerHTML=this.browseTableContent;this.browseTable=getElementById(this.browseContainer,'dbnetbrowse');if(this.isIE)
{var cells=this.browseTable.tHead.rows[0].cells
for(var i=0;i<cells.length;i++)
cells[i].style.setExpression("top",this.toString()+".positionBrowseHeading()")
document.recalc(true);}
else
{var body=getElementById(this.browseTable,'browsebody')
body.style.height=(this.browseContainer.offsetHeight-36)+"px"}
if(this.navigatorInfo.recordSetLength>this.navigatorInfo.data.length)
{var scrollButtonsId=this.browseContainer.id+".scrollbuttons";if(!$(scrollButtonsId))
{dbNetLink.insertAdjacentHTML(this.browseContainer,"afterEnd","<div id=\""+scrollButtonsId+"\"></div>");this.browseToolbar=getElementById(this.browseContainer.nextSibling,scrollButtonsId);}
else
{this.browseToolbar=$(scrollButtonsId);}
this.browseToolbar.innerHTML=this.browsePaneToolbar();getElementById(this.browseToolbar,'firstBtn').onclick=this.assignHandler('selectFirst');getElementById(this.browseToolbar,'prevBtn').onclick=this.assignHandler('selectPrior');getElementById(this.browseToolbar,'nextBtn').onclick=this.assignHandler('selectNext');getElementById(this.browseToolbar,'lastBtn').onclick=this.assignHandler('selectLast');}
this.updateBrowsePaneToolbar()
for(var i=0;i<this.browseTable.rows.length;i++)
{var row=this.browseTable.rows[i];if(row.className.indexOf("Row")>0)
{row.onclick=this.assignHandler('selectRow');row.onmouseover=this.assignHandler('highlightRow');row.onmouseout=this.assignHandler('unhighlightRow');}}}
function DbNetEdit_positionBrowseHeading()
{return document.getElementById(this.browseContainer.id).scrollTop-2}
function DbNetEdit_setScrollButtonState()
{if(!this.browseToolbar)
return;getElementById(this.browseToolbar,'prevBtn').disabled=(this.pageSelector.selectedIndex==0)
getElementById(this.browseToolbar,'nextBtn').disabled=(this.pageSelector.value==this.navigatorInfo.pageCount)
getElementById(this.browseToolbar,'firstBtn').disabled=getElementById(this.browseToolbar,'prevBtn').disabled;getElementById(this.browseToolbar,'lastBtn').disabled=getElementById(this.browseToolbar,'nextBtn').disabled;}
function DbNetEdit_selectPage()
{if(!this.checkForChanges())
return;this.pageNavigator('page',this.pageSelector.value);this.setScrollButtonState();}
function DbNetEdit_selectFirst()
{if(!this.checkForChanges())
return;this.pageNavigator('page',1);this.setScrollButtonState();}
function DbNetEdit_selectPrior()
{if(!this.checkForChanges())
return;var scrollButtonContainer=$(this.browseContainer.id+'.scrollbuttons')
if(!scrollButtonContainer)
return;var pageSelector=getElementById(scrollButtonContainer,'pageSelector')
var pageNumber=parseInt(this.pageSelector.value);this.pageNavigator('page',pageNumber-1);this.setScrollButtonState();}
function DbNetEdit_selectNext()
{if(!this.checkForChanges())
return;var scrollButtonContainer=$(this.browseContainer.id+'.scrollbuttons')
if(!scrollButtonContainer)
return;var pageSelector=getElementById(scrollButtonContainer,'pageSelector')
var pageNumber=parseInt(pageSelector.value);this.pageNavigator('page',pageNumber+1);this.setScrollButtonState();}
function DbNetEdit_selectLast()
{if(!this.checkForChanges())
return;this.pageNavigator('page',this.navigatorInfo.pageCount);this.setScrollButtonState();}
function DbNetEdit_synchroniseSidebar()
{if(this.browseColumns.length==0)
return;if(this.browseWin)
if(!this.browseWin.closed)
{this.browseWin.synchronise(this.navigatorInfo.index)
return;}
if(this.browseContainer!=null)
{if(this.selectedRow)
this.selectedRow.className=this.selectedRow.getAttribute("originalClassName")
var row=this.browseTable.rows[this.navigatorInfo.index+1]
row.setAttribute("originalClassName",row.className.replace(" highlight",""))
row.className="selectedRow"
if(this.isIE)
var scrollElement=this.browseTable.parentElement
else
var scrollElement=dbNetLink.getElementById(this.browseTable,"browsebody")
if(row.offsetTop<(scrollElement.scrollTop+row.offsetHeight)||row.offsetTop>(scrollElement.scrollTop+scrollElement.offsetHeight-row.offsetHeight))
{scrollElement.scrollTop=(row.offsetTop-row.offsetHeight-2)}
this.selectedRow=row}}
function DbNetEdit_selectRow(event)
{if(!this.checkForChanges())
return;var row=getParentElement(event.srcElement,"tr")
var table=row.parentElement;if(this.selectedRow)
this.selectedRow.className=this.selectedRow.getAttribute("originalClassName")
row.setAttribute("originalClassName",row.className.replace(" highlight",""))
row.className="selectedRow"
this.selectedRow=row;this.navigatorInfo.index=row.rowIndex-1;this.navigatorSelectCurrent();}
function DbNetEdit_highlightRow(event)
{row=getParentElement(event.srcElement,"tr")
if(row.className=="selectedRow")
return
row.setAttribute("originalClassName",row.className)
row.className+=" highlight"}
function DbNetEdit_unhighlightRow(event)
{row=getParentElement(event.srcElement,"tr")
if(row.className=="selectedRow")
return
row.className=row.getAttribute("originalClassName")}
function DbNetEdit_checkForChanges()
{this.retrieveMceEditorContent();if(!eval(this.promptUncommittedChanges))
return true;if(this.unappliedChanges())
if(eval(this.confirmDeletion))
if(!confirm(this.getText('unappliedChanges')))
return false;return true;}
function DbNetEdit_unappliedChanges()
{if(this.getChanges(true).join('')=='')
return false;return true;}
function DbNetEdit_getChanges(ignoreReadonly)
{var field,xml='',fieldValue;var changes=new Array();for(var j=0;j<this.fields.length;j++)
{var rowXml='';for(var i=0;i<this.fields[j].length;i++)
{field=this.fields[j][i];if(field.getAttribute("blob")=="true")
{if(field.getAttribute("blobStatus")!="")
rowXml+='<col format="'+(field.type=='checkbox'?'checkbox':field.format)+'">'+
this.createXmlNode('name',field.id)+
this.createXmlNode('value',fieldValue)+
this.createXmlNode('originalvalue',field.originalValue)+
this.createXmlNode('blobStatus',field.getAttribute("blobStatus"))+'</col>';continue}
if(typeof(field.originalValue)=="undefined")
continue;if(field.type=='checkbox')
if(field.checked.toString().toLowerCase()==field.originalValue.toString().toLowerCase())
continue;if(field.value==field.originalValue)
continue;if(ignoreReadonly)
if(field.readOnly&&field.uploadRootFolder=='')
continue;fieldValue=null;if(field.type=='checkbox')
{if(field.checked!=field.originalValue)
fieldValue=field.checked;}
else
{if(ignoreReadonly)
{if(field.value.replace(/\s/g,'')!=field.originalValue.replace(/\s/g,''))
fieldValue=field.value.replace(/\s/g,'');}
else
{if(field.value!=field.originalValue)
fieldValue=field.value;}}
if(fieldValue!=null)
rowXml+='<col format="'+(field.type=='checkbox'?'checkbox':field.format)+'">'+
this.createXmlNode('name',field.id)+
this.createXmlNode('value',fieldValue)+
this.createXmlNode('originalvalue',field.originalValue)+'</col>';}
changes[changes.length]=rowXml;}
return changes;}
function DbNetEdit_validateFields(rowIndex)
{var e,msg='';if(rowIndex==null)
rowIndex=0;for(var i=0;i<this.fields[rowIndex].length;i++)
{e=this.fields[rowIndex][i];if(e.dataType=="guid")
continue;if(e.type=="select-one")
if(e.value=="")
if(e.required==true)
msg=this.getText('valueRequired');if((e.type=="text")||(e.type=="textarea"))
{if(e.style.textTransform.toLowerCase()=='uppercase')
e.value=e.value.toString().toUpperCase();if(e.style.textTransform.toLowerCase()=='lowercase')
e.value=e.value.toString().toLowerCase();if(e.value=="")
{if(e.required==true)
msg=this.getText('valueRequired');}
else
{switch(e.dataType)
{case'numeric':if(!e.format)
{if(!this.culture.isNumeric(e.value))
msg=this.getText('notNumeric');}
break;case'date':if(dbNetLink.standardDateFormat(e.format))
if(!this.culture.isDateTime(e.value,e.format))
msg=this.getText('notDate').replace('{DATEFORMAT}',this.culture.formatHint(e.format));break;case'time':if(dbNetLink.standardDateFormat(e.format))
if(!this.culture.isDateTime(e.value,e.format))
msg=this.getText('notTime').replace('{TIMEFORMAT}',this.culture.formatHint(e.format));break;}}}
if(msg=='')
{e.msg="";var result=this.fireCustomEvent(e.validation,e);if(result!=null)
if(result==false)
{msg=e.msg;if(msg=="")
msg="&nbsp;";}}
if(msg!="")
break;}
if(msg=='')
{e=null;this.activeControl=null;this.msg="Row validation failed";var result=this.fireCustomEvent(this.rowValidation,this,rowIndex);if(result!=null)
if(!result)
{msg=this.msg;e=this.activeControl;}}
if(msg!='')
{if(e==null)
this.setFocus();else
{var attr=e.getAttribute("lookupTextId");if(attr)
this.activeControl=getElementById(e.parentElement,attr)
else
this.activeControl=e;this.fireCustomEvent(this.onValidationFailed,this);try
{this.activeControl.focus();if(!this.activeControl.onfocus)
{dbNetLink.addClassName(this.activeControl,'focused');window.setTimeout(this.toString()+'.unhighlightActiveControl()',2000);}}
catch(ex){}}
this.message(msg);return false;}
else
return true;}
function DbNetEdit_inputControl(controlName,rowIndex)
{var e=null;if(rowIndex==null)
rowIndex=0;e=this.findControlByName(controlName,rowIndex)
if(e==null&&!this.isEncrypted(controlName))
e=this.findControlByName(this.encrypt(controlName),rowIndex);if(e==null)
alert("Input control '"+controlName+"' not found.");return e;}
function DbNetEdit_findControlByName(controlName,rowIndex,preserveCase)
{var e=null
for(var i=0;i<this.fields[rowIndex].length;i++)
{if(this.fields[rowIndex][i].id.toLowerCase()==controlName.toLowerCase())
{e=this.fields[rowIndex][i];break;}}
return e}
function DbNetEdit_navigatorSelectCurrent(valuesInResponse)
{if(typeof(valuesInResponse)=='undefined')
valuesInResponse=false;this.clearSelectedRows();var buttons=['first','next','last','prev'];var topOfPage=parseInt(this.navigatorInfo.index/this.rowContainers.length)*this.rowContainers.length;if(this.navigationStyle=='row')
topOfPage=this.navigatorInfo.index
if(this.navigatorInfo.index>=0&&this.navigatorInfo.index<this.navigatorInfo.data.length)
{this.primaryKeyValue=new Array();for(var p=0;p<this.rowContainers.length;p++)
{if((topOfPage+p)<this.navigatorInfo.data.length)
{var id=this.navigatorInfo.data[topOfPage+p].dbnetedit_id;this.primaryKeyValue[this.primaryKeyValue.length]=id;}}
this.retrieve(valuesInResponse);for(var i=0;i<buttons.length;i++)
{var btn=getElementById(this.navigator,buttons[i]+'ToolButton');if(buttons[i]=='first'||buttons[i]=='prev')
btn.disabled=((this.navigatorInfo.startIndex+topOfPage)==0);else
btn.disabled=((this.navigatorInfo.startIndex+topOfPage+this.rowContainers.length)>=this.navigatorInfo.recordSetLength);var img=getElementById(btn,buttons[i]+'Img');if(img)
{var imgPath=this.virtualDir+'/images/'+buttons[i]+(btn.disabled?'off':'')+'.gif';img.src=imgPath.replace(/\/\//g,'\/');}}
if(this.navigatorStatus)
{var pos=this.navigatorInfo.startIndex+topOfPage+1;if(this.rowContainers.length>1)
{var max=this.navigatorInfo.startIndex+topOfPage+this.rowContainers.length;if(max>this.navigatorInfo.recordSetLength)
max=this.navigatorInfo.recordSetLength;pos+='-'+max;}
this.navigatorStatus.innerHTML=this.getText('navigatorStatus').replace('{POS}',pos).replace('{COUNT}',this.navigatorInfo.recordSetLength);}
this.setFocus(this.navigatorInfo.index-topOfPage);this.synchroniseSidebar()}
else
{for(var i=0;i<buttons.length;i++)
{var btn=getElementById(this.navigator,buttons[i]+'ToolButton');btn.disabled=true;var img=getElementById(btn,buttons[i]+'Img');if(img)
img.src=this.virtualDir+'/images/'+buttons[i]+'off.gif';}
this.disable();for(var i=0;i<this.detailFormArray.length;i++)
{var form=this.detailFormArray[i];with(form[0])
{fixedFilterPart=" 1=2";initialiseNavigator();navigatorSelectCurrent();disable();setButtonStatus("insert",true);}}
if(this.navigatorStatus)
this.navigatorStatus.innerText='';}}
function DbNetEdit_locateKeyValue(keyValue)
{var index=-1;for(var i=0;i<this.navigatorInfo.data.length;i++)
{if(this.navigatorInfo.data[i].dbnetedit_id.toLowerCase()==keyValue.toLowerCase())
{index=i;break;}}
if(index!=-1)
{this.navigatorInfo.index=i;this.navigatorSelectCurrent();return true}}
function DbNetEdit_navigateToKeyValue(keyValue)
{if(!this.locateKeyValue(keyValue))
{var xml=this.getPageRequestXml('key')+'<keyValue>'+keyValue+'</keyValue>';if(!this.callService(xml,"page"))
return false;this.parseNavigatorResponse();if(!this.locateKeyValue(keyValue))
return false;}
return true;}
function DbNetEdit_navigatorMoveFirst()
{if(this.checkForChanges())
{if(this.navigatorInfo.startIndex!=0)
this.pageNavigator("first")
this.navigatorInfo.index=0;this.navigatorSelectCurrent();}}
function DbNetEdit_navigatorMovePrevious()
{var step=(this.navigationStyle=="row")?1:this.rowContainers.length;if(this.navigatorInfo.data.length>0)
{if(this.navigatorInfo.index-step<0)
{this.pageNavigator("prior")}
else
{if(this.navigatorInfo.index>0)
{if(this.checkForChanges())
{this.navigatorInfo.index-=step;if(this.navigatorInfo.index<0)
this.navigatorInfo.index=0;this.navigatorSelectCurrent();}}}}}
function DbNetEdit_navigatorMoveNext()
{var step=(this.navigationStyle=="row")?1:this.rowContainers.length;if(this.navigatorInfo.index<this.navigatorInfo.recordSetLength-1)
{if(this.checkForChanges())
{if((this.navigatorInfo.startIndex+this.navigatorInfo.index+step)>this.navigatorInfo.endIndex)
{this.pageNavigator("next")
this.navigatorInfo.index=0}
else
{this.navigatorInfo.index+=step;this.navigatorSelectCurrent();}}}}
function DbNetEdit_navigatorMoveLast()
{if(this.checkForChanges())
{if(this.navigatorInfo.recordSetLength!=this.navigatorInfo.endIndex+1)
{var page=parseInt(this.navigatorInfo.recordSetLength/this.navigatorPageLength);this.pageNavigator("page",page+1)}
this.navigatorInfo.index=this.navigatorInfo.data.length-1;this.navigatorSelectCurrent();}}
function DbNetEdit_getPageRequestXml(Direction,PageNumber)
{var xml=new Array();var scanToKey=""
if(this.navigatorInfo.index>=0&&this.navigatorInfo.index<this.navigatorInfo.data.length)
scanToKey=this.navigatorInfo.data[this.navigatorInfo.index].dbnetedit_id;var scanFromKey="";var x=this.navigatorInfo.index+this.pageDataRowCount-1
if(x>=0&&x<this.navigatorInfo.data.length)
scanFromKey=this.navigatorInfo.data[x].dbnetedit_id;xml[xml.length]=dbNetLink.createXmlNode("direction",Direction);xml[xml.length]=dbNetLink.createXmlNode("scanToKey",scanToKey);xml[xml.length]=dbNetLink.createXmlNode("scanFromKey",scanFromKey);xml[xml.length]=this.serialise("filterPart");xml[xml.length]=this.serialise("fixedFilterPart");xml[xml.length]=this.serialise("primaryKeyName");xml[xml.length]=this.serialise("orderBy");xml[xml.length]=this.serialise("pageRowCount");xml[xml.length]=this.serialise("navigatorPageLength");xml[xml.length]=dbNetLink.createXmlNode("pageNumber",PageNumber);xml[xml.length]='<sortColumns>';for(var i=0;i<this.sortColumns.length;i++)
xml[xml.length]='<column sequence="'+this.sortSequence[i]+'">'+this.sortColumns[i]+"</column>";xml[xml.length]='</sortColumns>';if(this.browseColumns.length>0)
{xml[xml.length]=this.serialise('browseColumns')
xml[xml.length]=this.serialise('browseTitles')}
xml[xml.length]='<navigator></navigator>';return xml.join('')}
function DbNetEdit_pageNavigator(Direction,PageNumber)
{var xml=this.getPageRequestXml(Direction,PageNumber);if(!this.callService(xml,"page"))
return;this.parseNavigatorResponse();switch(Direction)
{case"first":case"next":case"page":this.navigatorInfo.index=0;break;case"last":case"prior":this.navigatorInfo.index=this.navigatorInfo.data.length-this.rowContainers.length;break;}
this.navigatorSelectCurrent();}
function DbNetEdit_clearSelectedRows()
{for(var i=0;i<this.rowContainers.length;i++)
{var e=getElementById(this.rowContainers[i],'dbneteditrowselector');if(e)
e.checked=false;}
for(var i=0;i<this.fields.length;i++)
for(var j=0;j<this.fields[i].length;j++)
{this.fields[i][j].eof=true;this.fields[i][j].originalValue='';}}
function DbNetEdit_retrieve(valuesInResponse)
{if(typeof(valuesInResponse)=="undefined")
valuesInResponse=false;var xml='';var html='';var nodeName;if(!this.initialised)
{alert(this.getText('notInitialised'));return false;}
this.mode='update';if(valuesInResponse)
{this.displayPageData();return;}
xml+=this.commonDataStructure();xml+=this.serialise('primaryKeyName')+
this.serialise('primaryKeyType')+
this.serialise('primaryKeyDataType')+
this.createXmlNode('eof');if(!this.callService(xml,"retrieve"))
return false;if(parseInt(this.getNodeValue("rowsRetrieved"))<=0)
return false;this.displayPageData();return true;}
function DbNetEdit_commonDataStructure()
{var xml=new Array();var pkArr=testArray(this.primaryKeyValue)?this.primaryKeyValue:new Array(this.primaryKeyValue.toString());xml[xml.length]='<fields>';for(var i=0;i<this.fields[0].length;i++)
xml[xml.length]='<col>'+this.createXmlNode('name',this.fields[0][i].id)+'</col>';xml[xml.length]='</fields>';xml[xml.length]='<data>';for(var r=0;r<this.pageRowCount;r++)
{xml[xml.length]='<row rowindex="'+r+'" eof="true">';for(var i=0;i<this.fields[r].length;i++)
{var fld=this.fields[r][i];var fmt=(this.fieldPropertyValue(fld.id,'format',''))?this.fieldPropertyValue(fld.id,'format',''):'';var lookupText=(this.fieldPropertyValue(fld.id,'lookupText',''))?this.fieldPropertyValue(fld.id,'editLookup',''):'';xml[xml.length]='<col colindex="'+i+'" format="'+fmt+'" lookupText="'+lookupText+'">'+
this.createXmlNode('name',fld.id)+
this.createXmlNode('value','')+"</col>";}
xml[xml.length]=this.createXmlNode('primarykeyvalue',(r<pkArr.length)?pkArr[r]:'');xml[xml.length]='</row>';}
xml[xml.length]='</data>';return xml.join('');}
function DbNetEdit_displayPageData()
{var msg=this.xmlResponse.documentElement.selectSingleNode("//msg");if(msg)
{var e=getElementById(this.container,'evalMessage')
if(!e)
{this.appendHtml("<DIV ID=evalMessage></DIV>");e=getElementById(this.container,'evalMessage');}
e.innerHTML=textFromNode(msg);}
this.pageDataRowCount=parseInt(0);var rowList=this.xmlResponse.documentElement.selectNodes("//row");for(var j=0;j<rowList.length;j++)
{this.disableRow(j,false);disableElementById(this.rowContainers[j],'dbneteditrowselector',true);this.rowContainers[j].eof=eval(rowList[j].getAttribute("eof"));if(!this.rowContainers[j].eof)
this.pageDataRowCount++;disableElementById(this.rowContainers[j],'dbneteditrowselector',this.rowContainers[j].eof)
var fieldNodeList=rowList[j].selectNodes('col');for(var i=0;i<fieldNodeList.length;i++)
{var fieldName=textFromNode(fieldNodeList[i].selectSingleNode('name'));var fieldValue=textFromNode(fieldNodeList[i].selectSingleNode('value'));field=getElementById(this.rowContainers[j],fieldName);switch(field.type)
{case'checkbox':field.checked=eval(fieldValue.toLowerCase()=='true'||fieldValue=='1'||fieldValue=='-1');break;case'select-one':field.value=fieldValue;if(this.rowContainers[j].eof)
field.selectedIndex=-1;if(dbNetLink.isSafari)
if(fieldValue=="")
field.selectedIndex=-1;break;default:field.value=fieldValue;break;}
field.eof=this.rowContainers[j].eof;field.readOnly=eval(field.editReadOnly||field.updateReadOnly||field.eof);this.configureField(field)
switch(field.type)
{case'checkbox':field.originalValue=field.checked?'True':'False';break;case'select-one':field.originalValue=field.value;field.preservedValue=fieldValue
break;default:field.originalValue=field.value;break;}
if(field.getAttribute("lookupTextId"))
{this.updateLookupText(field,fieldNodeList[i].getAttribute("lookupText"));if(fieldNodeList[i].getAttribute("lookupSql"))
field.setAttribute("lookupSql",fieldNodeList[i].getAttribute("lookupSql"));}
if(field.tagName=="IMG")
{field.src=this.virtualDir+"dbnetedit.aspx?mode=image&db="+this.connectionString+"&sql=select "+field.id+" from "+this.tableName+" where "+this.primaryKeyName+" = @key&resize="+field.height+"H&key="+this.getPrimaryKeyValue(j)+"&timestamp="+new Date().valueOf().toString();field.setAttribute("blobStatus","");}}}
this.loadMceEditorContent();this.loadHtmlPreviewContent();var quote=(this.getDataType(this.primaryKeyDataType)=="string"||this.getDataType(this.primaryKeyDataType)=="guid")?"'":"";for(var i=0;i<this.detailFormArray.length;i++)
{var form=this.detailFormArray[i];form[0].fixedFilterPart=form[1]+"="+quote+this.primaryKeyValue+quote;form[0].initialiseNavigator();}
this.setButtonStatus("insert",false);this.setButtonStatus("apply",(this.pageDataRowCount==0));this.setButtonStatus("cancel",(this.pageDataRowCount==0));this.setFocus();if(this.pageDataRowCount==0)
{this.setButtonStatus("delete",true);return false;}
this.setButtonStatus("delete",this.populatedLinkedForm()&&!this.allowLinkedDeletion);for(var j=0;j<rowList.length;j++)
this.editRowInitialisation(j);this.pageIndex=0;if(this.navigatorInfo.data&&this.rowContainers.length!=0)
this.pageIndex=parseInt(this.navigatorInfo.index/this.rowContainers.length);if(this.parentForm!=null)
this.setParentFormDeleteButtonStatus();this.updateImageWindow();this.fireCustomEvent(this.onPageLoaded,this);return true;}
function DbNetEdit_setParentFormDeleteButtonStatus()
{var deleteDisabled=(this.navigatorInfo.recordSetLength>0);if(deleteDisabled&&this.parentForm.allowLinkedDeletion)
deleteDisabled=false;this.parentForm.setButtonStatus('delete',deleteDisabled);}
function DbNetEdit_configureField(field)
{field.disabled=false;if(field.readOnly)
{switch(field.type)
{case"checkbox":if(field.onclick==null)
{field.onclick=function(){return false};field.setAttribute("voidedOnClick","true")}
else
{field.disabled=true;}
break;case"select-one":field.disabled=true;break;}
dbNetLink.addClassName(field,"readonly")}
else
{if(field.type=="checkbox")
if(field.getAttribute("voidedOnClick")=="true")
field.onclick=null;dbNetLink.removeClassName(field,"readonly")}
if(field.dataType=='date')
{var btn=getElementById(field.parentElement,field.id+'.calendarBtn');if(btn)
btn.disabled=field.readOnly;}
if(field.type=='textarea')
disableElementById(field.parentElement,'editorBtn',field.readOnly);}
function DbNetEdit_editRowInitialisation(rowIndex)
{if(rowIndex==null)
rowIndex=0;if(this.dbNetGrid)
{var grid=this.dbNetGrid;if(getElementById(this.container,'editNavigation'))
{var nextRowDisabled=true;var prevRowDisabled=true;if(this.mode=='insert')
{disableElementById(this.container,'nextRow',true);disableElementById(this.container,'prevRow',true);}
else
{nextRowDisabled=(grid.currentRow.rowIndex==grid.table.rows.length-1);prevRowDisabled=(grid.currentRow.rowIndex==1);disableElementById(this.container,'nextRow',nextRowDisabled);disableElementById(this.container,'prevRow',prevRowDisabled);}
var e=getElementById(this.container,'nextRowImg');if(e)
e.src=this.virtualDir+'/images/next'+(nextRowDisabled?'off':'')+'.gif';var e=getElementById(this.container,'prevRowImg');if(e)
e.src=this.virtualDir+'/images/prev'+(prevRowDisabled?'off':'')+'.gif';}}
this.fireCustomEvent(this.rowInitialisation,this,rowIndex);}
function DbNetEdit_populatedLinkedForm()
{var retVal=false;for(var i=0;i<this.detailFormArray.length;i++)
{var form=this.detailFormArray[i][0];if(form.navigator)
if(form.navigatorInfo.data)
if(form.navigatorInfo.data.length>0)
{retVal=true;break;}}
return retVal;}
function DbNetEdit_setFocus(rowIndex)
{if(!rowIndex)
rowIndex=0;var firstField=null;var indexedFields=new Array()
for(var i=0;i<this.fields[rowIndex].length;i++)
{field=this.fields[rowIndex][i];if(!field.readOnly&&field.style.display=='')
{if(typeof(field.tabIndex)=='number')
{if(field.tabIndex>=0)
{if(typeof(indexedFields[field.tabIndex])=="undefined")
{indexedFields[field.tabIndex]=field;}}}
if(firstField==null)
firstField=field;}}
if(indexedFields.length>0)
{for(var i=0;i<indexedFields.length;i++)
{if(indexedFields[i])
{firstField=indexedFields[i];break;}}}
if(firstField)
{this.focusField=firstField;if(this.isIE)
this.setFieldFocus();else
{window.setTimeout(this.toString()+'.setFieldFocus()',100);}}}
function DbNetEdit_setFieldFocus()
{try{this.focusField.focus()
this.focusField.select()}
catch(e){}}
function DbNetEdit_disableRow(rowIndex,status)
{if(status==null)
status=true;for(var i=0;i<this.fields[rowIndex].length;i++)
{var field=this.fields[rowIndex][i];if(field.className.indexOf('dbnetedit')>=0)
field.readOnly=status;if(field.tagName=="IMG")
field.src=this.virtualDir+"images/spacer.gif";}}
function DbNetEdit_applyChanges()
{this.retrieveMceEditorContent();var failedValidation=false;var changes=this.getChanges(false);if(changes.join('')=='')
return true;for(var i=0;i<changes.length;i++)
{if(changes[i])
{if(!this.validateFields(i))
{failedValidation=true;break;}}}
if(failedValidation)
return false;return this.commitChanges();}
function DbNetEdit_commitChanges()
{var xml='';changes=this.getChanges(false);for(var i=0;i<changes.length;i++)
{if(changes[i])
{var pkValue=this.getPrimaryKeyValue(i);var multiPartKeyValue=new Array();for(var j=0;j<this.primaryKeyArray.length;j++)
multiPartKeyValue[multiPartKeyValue.length]=this.inputControl(this.primaryKeyArray[j],i).value;xml+="<row>"
xml+=this.createXmlNode("fields",changes[i]);xml+=this.createXmlNode("primarykey",pkValue,{"name":this.primaryKeyName,"type":this.primaryKeyType,"autoincrement":this.primaryKeyAutoincrement,"parts":multiPartKeyValue.length,"datatype":this.primaryKeyDataType});xml+=this.createXmlNode("multipartkeyvalue",multiPartKeyValue.join(":"));xml+="</row>";this.rowContainers[i].modified=true;}
else
this.rowContainers[i].modified=false;}
if(this.pageValidation!='')
{if(typeof(eval("window."+this.pageValidation))=='undefined')
{this.message("Page validation function '"+this.pageValidation+"()' not found");return false;}
else
{this.msg='page validation failed';if(!eval("window."+this.pageValidation+"(this)"))
{this.setFocus();this.message(this.msg);return false;}}}
this.setButtonStatus("insert",false);xml+=this.serialise('sequenceName')+
this.serialise('autoSequence')+
this.serialise('optimisticLocking');if(this.navigatorInfo.data!=null)
xml+=this.getPageRequestXml("first");if(!this.callService(xml,"update"))
return;var mode=this.getNodeValue("mode");var errorMessage=this.getNodeValue("errorMessage");var errorNumber=this.getNodeValue("errorNumber");var invalidField=this.getNodeValue("invalidField");if(invalidField!='')
{var invalidRow=this.getNodeValue("invalidRow")
try
{this.inputControl(invalidField,invalidRow).focus()}
catch(E)
{}}
if(errorMessage!='')
{this.msg=errorMessage;var status=this.fireCustomEvent(this.onEditError,this);switch(typeof(status))
{case"object":var customMessage=this.fireCustomEvent(this.editError,errorMessage,errorNumber,this);if(customMessage!=null)
errorMessage=customMessage;this.message(errorMessage);break;default:this.message(this.msg);break;}
return false;}
if(eval(this.getNodeValue("modified")))
{this.message(this.getText('modifiedElsewhere'));this.retrieve();return false;}
if(mode=="insert")
{this.primaryKeyValue=new Array();var ids=this.xmlResponse.documentElement.selectNodes("//id");for(var i=0;i<ids.length;i++)
{this.primaryKeyValue[this.primaryKeyValue.length]=textFromNode(ids[i]);if(this.dbNetGrid)
{this.dbNetGrid.recordsAdded+=1;this.dbNetGrid.addedRecordIds[this.dbNetGrid.addedRecordIds.length]=textFromNode(ids[i]);}}}
this.fireCustomEvent(this.onEditApply,this);if(mode=="insert")
{this.message(this.getText('recordAdded'));if(this.dbNetGrid)
{var preserve=this.promptUncommittedChanges;this.promptUncommittedChanges=false;var id=this.dbNetGrid.addedRecordIds[this.dbNetGrid.addedRecordIds.length-1];this.dbNetGrid.loadData(null,id);this.promptUncommittedChanges=preserve;if(this.dbNetGrid.parentGrid)
this.dbNetGrid.parentGrid.configureToolBar(this.dbNetGrid.parentGrid.pageCount);}
else
{if(this.navigator)
{this.parseNavigatorResponse();this.navigatorInfo.index=0;if(eval(this.multipleInsert))
{this.insertRecord(true);return}
if(eval(this.selectInsertedRecord))
{for(var i=0;i<this.navigatorInfo.data.length;i++)
if(this.navigatorInfo.data[i].dbnetedit_id==this.primaryKeyValue[0])
{this.navigatorInfo.index=i;break;}}
this.navigatorSelectCurrent();}
else
{if(eval(this.multipleInsert))
{this.insertRecord(true);return}
this.retrieve();}}}
else
{this.message(this.getText('recordUpdated'));if(this.dbNetGrid)
this.dbNetGrid.updateCurrentRow();if(this.navigator)
this.parseNavigatorResponse();this.retrieve();}
if(this.dbNetGrid)
this.fireCustomEvent(this.onAfterGridUpdated,this);return true;}
function DbNetEdit_cancelChanges()
{if(this.dbNetGrid)
{if(this.dbNetGrid.currentRow)
this.dbNetGrid.selectRow(null,this.dbNetGrid.currentRow.rowIndex);this.fireCustomEvent(this.onEditCancel,this);return}
if(this.navigator)
{if(this.mode=='insert')
this.navigatorInfo.index=this.originalNavigatorIndex;this.navigatorSelectCurrent();}
else
{if(this.primaryKeyValue=='')
this.disable();else
this.retrieve();}
this.fireCustomEvent(this.onEditCancel,this);}
function DbNetEdit_insertRecord(ignoreChanges)
{if(typeof(ignoreChanges)=='undefined')
ignoreChanges=false;var field;var insertionRow=0;if(!eval(this.initialised))
{alert(this.getText('notInitialised'));return false;}
if(!ignoreChanges)
if(!this.checkForChanges())
return false;if(this.parentForm)
if(this.parentForm.mode=='insert')
return false;this.originalNavigatorIndex=this.navigatorInfo.index;this.primaryKeyValue='';if(this.insertionStyle=='row'&&this.pageRowCount>1)
{if(this.navigatorInfo.data)
{this.navigatorInfo.index=this.navigatorInfo.endIndex;this.navigatorSelectCurrent();this.primaryKeyValue=''}
insertionRow=this.fields.length-1;for(var j=0;j<this.fields.length;j++)
{if(this.fields[j][0].eof==true)
{insertionRow=j;break;}}}
this.mode='insert';for(var i=0;i<this.detailFormArray.length;i++)
this.detailFormArray[i][0].disable();if(this.navigatorStatus)
this.navigatorStatus.innerHTML="&nbsp;";this.setButtonStatus("insert",true);this.setButtonStatus("apply",false);this.setButtonStatus("cancel",false);this.setButtonStatus("delete",true);for(var j=0;j<this.fields.length;j++)
{disableElementById(this.rowContainers[j],'dbneteditrowselector',true);if(parseInt(j)!=parseInt(insertionRow)&&this.insertionStyle=='row')
this.disableRow(j);else
{this.disableRow(j,false);for(var i=0;i<this.fields[j].length;i++)
{field=this.fields[j][i];this.configureField(field)
if(field.type=='checkbox')
field.checked=eval(field.initialValue);else
field.value=field.initialValue;if(this.parentForm&&this.foreignKey)
{if(this.qualifyColumnName(field.id)==this.qualifyColumnName(this.foreignKey))
field.value=this.parentForm.primaryKeyValue;}
field.originalValue='';field.readOnly=(field.editReadOnly||field.insertReadOnly);if(field.dataType=='date')
disableElementById(field.parentElement,field.id+'.calendarBtn',field.readOnly);if(field.type=='textarea')
disableElementById(field.parentElement,'editorbtn',field.readOnly);if(field.getAttribute("lookupTextId"))
this.updateLookupText(field);if(field.tagName=="IMG")
{field.src=this.virtualDir+"images/spacer.gif";field.setAttribute("blobStatus","");this.updateImageWindow();}
if(field.readOnly)
field.tabIndex='-1';}
this.editRowInitialisation(j);}}
this.loadMceEditorContent();this.setFocus(insertionRow);return true;}
function DbNetEdit_deleteRecord()
{if(this.primaryKeyName==''||this.primaryKeyValue=='')
return;var selectedRows=this.getSelectedRows();if(!selectedRows.length)
{this.message(this.getText("noneSelected"));return;}
if(this.deleteValidation!='')
{var invalid=false;if(typeof(eval('window.'+this.deleteValidation))=='undefined')
{this.msg="Delete validation function '"+this.deleteValidation+"()' not found";invalid=true;}
else
{this.msg="delete validation failed";for(var i=0;i<selectedRows.length;i++)
{if(!eval('window.'+this.deleteValidation+'(this, selectedRows[i])'))
{invalid=true;break;}}}
if(invalid)
{this.message(this.msg);return;}}
if(this.deletePageValidation!='')
{this.msg='';if(typeof(eval('window.'+this.deletePageValidation))=='undefined')
this.msg="Delete page validation function '"+this.deletePageValidation+"()' not found";else
{for(var i=0;i<this.rowContainers.length;i++)
this.rowContainers[i].selected=false;for(var i=0;i<selectedRows.length;i++)
this.rowContainers[selectedRows[i]].selected=true;this.msg='Cannot delete this record';if(eval('window.'+this.deletePageValidation+'(this)'))
this.msg='';}
if(this.msg!='')
{this.message(this.msg);return;}}
if(eval(this.confirmDeletion))
if(confirm(this.getText('confirmDelete'))==false)
return;this.clearSelectedRows();var xml='';for(var i=0;i<selectedRows.length;i++)
{if(!testArray(this.primaryKeyValue))
pkValue=this.primaryKeyValue;else
pkValue=this.primaryKeyValue[selectedRows[i]];xml+=this.createXmlNode("primarykey",pkValue,{"name":this.primaryKeyName,"type":this.primaryKeyType,"datatype":this.primaryKeyDataType});var uploadColumns='';for(var columnName in this.fieldProperties)
{if(typeof(this.fieldProperties[columnName]['uploadRootFolder'])!='undefined')
{uploadColumns+='<item><fieldName>'+columnName+'</fieldName><rootFolder>'+this.fieldProperties[columnName]['uploadRootFolder'][0][0]+'</rootFolder></item>';}}
xml+='<uploadColumns>'+uploadColumns+'</uploadColumns>';}
if(this.browseColumns.length>0)
xml+=this.getPageRequestXml("first")
if(!this.callService(xml,'delete'))
return;var errorMessage=this.getNodeValue('errorMessage');var errorNumber=this.getNodeValue('errorNumber');if(errorMessage=='')
{if(this.dbNetGrid)
{var preserve=this.promptUncommittedChanges;this.promptUncommittedChanges=false;this.dbNetGrid.loadData();this.promptUncommittedChanges=preserve;if(this.dbNetGrid.parentGrid)
this.dbNetGrid.parentGrid.configureToolBar(dbNetGrid.parentGrid.pageCount);}
else
{if(this.navigator)
{if(this.getNodeValue("browseTable")!="")
{this.parseNavigatorResponse();if(this.navigatorInfo.index>this.navigatorInfo.data.length-1)
this.navigatorInfo.index=this.navigatorInfo.data.length-1;this.navigatorSelectCurrent();}
else
{for(var i=selectedRows.length-1;i>=0;i--)
{var index=parseInt(this.navigatorInfo.index)+parseInt(selectedRows[i]);this.navigatorInfo.data=this.navigatorInfo.data.slice(0,index).concat(this.navigatorInfo.data.slice(index+1));if(this.navigatorInfo.index>=this.navigatorInfo.data.length)
this.navigatorInfo.index=this.navigatorInfo.data.length-1;this.navigatorInfo.recordSetLength--;}
this.navigatorSelectCurrent();if(this.parentForm!=null)
this.setParentFormDeleteButtonStatus();}}
else
this.disable();}
this.fireCustomEvent(this.onDeleteApply,this);this.message(this.getText('recordDeleted'));}
else
{this.msg=errorMessage;var status=this.fireCustomEvent(this.onDeleteError,this);switch(typeof(status))
{case"object":var customMessage=this.fireCustomEvent(this.deleteError,errorMessage,errorNumber,this);if(customMessage!=null)
errorMessage=customMessage;this.message(errorMessage);break;default:this.message(this.msg);break;}}}
function DbNetEdit_upload(evt)
{if(this.mode=='')
return;if(field[this.mode+'ReadOnly'])
return;var o=new Object();o.field=evt.srcElement.field;o.component=this;o.callback=this.uploadCallback;dbNetLink.openModalDialog(this.virtualDir+'common/upload/upload.htm','upload',o);}
function DbNetEdit_getSelectedRows()
{var selectedRows=new Array();if(this.rowContainers.length==1)
selectedRows[selectedRows.length]=0;else
{for(var i=0;i<this.rowContainers.length;i++)
{var e=getElementById(this.rowContainers[i],'dbneteditrowselector');if(e)
if(e.checked)
selectedRows[selectedRows.length]=i;}}
return selectedRows;}
function DbNetEdit_initialiseSpellChecking()
{if(!this.toolbar)
return;if(eval(this.spellCheck)==true&&this.dbNetSpellVirtualDir=='')
alert("DbNetSpell Could not be found.  Spell checking will be disabled.")
if(eval(this.spellCheck)==false||eval(this.edit)==false||this.dbNetSpellVirtualDir=='')
hideElementById(this.toolbar,'spellToolButton',false);else
{getElementById(this.toolbar,'spellToolButton').onclick=this.assignHandler('spell');var head=document.getElementsByTagName("head").item(0);var js=document.createElement("script");js.setAttribute("language","javascript");js.setAttribute("type","text/javascript");js.setAttribute("src",this.dbNetSpellVirtualDir+"/dbnetspell.js");head.insertBefore(js,head.childNodes[0]);}}
function DbNetEdit_spell(evt)
{var btn=evt.srcElement;if(typeof(btn.dbNetSpell)=='undefined')
{for(var x=0;x<this.fields.length;x++)
for(var y=0;y<this.fields[x].length;y++)
{var currentField=this.fields[x][y]
if(!currentField.disabled&&!currentField.readOnly&&currentField.dataType=="string")
if(this.spellCheckAllFields||currentField.spell)
typeof(btn.dbNetSpell)=='undefined'?btn.dbNetSpell=new DbNetSpell(currentField):btn.dbNetSpell.registerElement(currentField);}}
if(typeof(btn.dbNetSpell)=='undefined')
alert("Could not find any string fields with editable content to check")
else
btn.dbNetSpell.checkElement();}
function DbNetEdit_assignColumnData(rowIndex)
{var dh,field;var nodeList=this.getNode("fields").childNodes;var properties=['required','editReadOnly','updateReadOnly','insertReadOnly'];var nodeName;this.primaryKeyAutoincrement=false;for(var i=0;i<nodeList.length;i++)
{node=nodeList[i];nodeName=textFromNode(node.childNodes[0]);var field=getElementById(this.rowContainers[rowIndex],nodeName);if(field.type=="select-one")
if(field.options.length==0)
{field.required=this.fieldPropertyValue(nodeName,'required',false);var fieldParts=field.outerHTML.split("><");var node=this.xmlResponse.documentElement.selectSingleNode("//lookups/col"+i+"/options");field.outerHTML=fieldParts[0]+'>'+(field.required?'':'<OPTION>')+textFromNode(node)+"<"+fieldParts[1];for(var j=0;j<this.fields[rowIndex].length;j++)
if(this.fields[rowIndex][j].id==field.id)
{this.fields[rowIndex][j]=getElementById(this.rowContainers[rowIndex],field.id);this.fields[rowIndex][j].required=eval(this.fields[rowIndex][j].required);}
field=getElementById(this.rowContainers[rowIndex],nodeName);field.selectedIndex=-1;}
if(field.tagName=="IMG")
field.src=this.virtualDir+"images/spacer.gif";field.onfocus=new Function("addClassName(this, 'focused')");field.onblur=new Function("removeClassName(this, 'focused')");field.initialValue='';if(!field.format)
field.format=this.fieldPropertyValue(nodeName,'format','');if(!field.dp)
field.dp=this.fieldPropertyValue(nodeName,'decimalPlaces','');field.editControl=this;for(property in properties)
field[properties[property]]=false;if(field.type=="select-one")
for(var j=0;j<this.primaryKeyArray.length;j++)
if(this.qualifyColumnName(nodeName)==this.qualifyColumnName(this.primaryKeyArray[j]))
field.updateReadOnly=true;field.dbDataType=node.getAttribute("type");field.dataType=this.getDataType(field.dbDataType);if((field.type=="text")||(field.type=="textarea"))
{field.definedSize=node.getAttribute("definedsize");field.precision=node.getAttribute("precision");field.numericScale=node.getAttribute("numericscale");field.autoincrement=node.getAttribute("autoincrement").toLowerCase();field.autoincrement=eval(field.autoincrement=='1'||field.autoincrement=='-1'||field.autoincrement=='true');if(field.autoincrement)
{field.editReadOnly=true;this.primaryKeyAutoincrement=true;}
if(this.foreignKey)
{if(this.qualifyColumnName(field.id)==this.qualifyColumnName(this.foreignKey))
field.editReadOnly=true;}
for(var j=0;j<this.primaryKeyArray.length;j++)
{if(this.qualifyColumnName(nodeName)==this.qualifyColumnName(this.primaryKeyArray[j]))
{field.updateReadOnly=true;if(!field.autoincrement&&!field.dataType=='guid')
field.required=true;if(field.dataType=='guid')
field.insertReadOnly=true;}}
if(field.type=="textarea")
{var e=getElementById(this.container,field.id+".editBtn");if(e)
{e.innerHTML="<img class='imageButton' id=edtBtn title='"+this.getText('editorTitle')+"' src='"+this.virtualDir+"images/editor.gif' WIDTH='16' HEIGHT='16' >";field.editorBtn=getElementById(e,'edtBtn');}
else
{dbNetLink.insertAdjacentHTML(field,"afterEnd","<img class='imageButton' title='"+this.getText('editorTitle')+"' id=edtBtn src='"+this.virtualDir+"images/editor.gif' WIDTH='16' HEIGHT='16' >");field.editorBtn=getElementById(field.parentElement,"edtBtn");}
assignTabIndex(field,field.editorBtn);field.editorBtn.dbNetEdit=this;field.editorBtn.field=field;field.editorBtn.onclick=this.assignHandler("editor");}
if(field.type=="text")
{switch(field.dataType)
{case"string":{if(parseInt(field.definedSize)>0)
{field.maxLength=field.definedSize;if(field.definedSize<=255)
field.size=field.maxLength;}
break;}
case"date":{if(dbNetLink.standardDateFormat(field.format))
{if(field.format.toLowerCase()!='t')
{var btn=getElementById(this.rowContainers[rowIndex],field.id+'.calendarBtn');if(!btn)
{dbNetLink.insertAdjacentHTML(field,"afterEnd","<img class='imageButton' title='"+this.getText('calendarTitle')+"' id='"+field.id+".calendarBtn' src='"+this.virtualDir+"images/calendar.gif' WIDTH='16' HEIGHT='16' >");btn=getElementById(field.parentElement,field.id+'.calendarBtn');}
btn.onclick=this.assignHandler('selectedDate');btn.field=field;}}
this.culture.sizeDateTimeField(field);break;}
case"time":{if(field.format=='')
field.format=this.timeFormat;field.maxLength=8;field.size=8;this.culture.sizeDateTimeField(field);break;}
case"guid":{field.maxLength=50;field.size=50;break;}
default:{field.maxLength=20;field.size=8;field.style.textAlign="right";break;}}}}
var columnProperties=this.fieldProperties[this.qualifyColumnName(nodeName)];for(var fieldProperty in columnProperties)
{var propertyValue=columnProperties[fieldProperty][0][0];switch(fieldProperty)
{case'spell':if(propertyValue==""||eval(propertyValue))
{field[fieldProperty]=true;this.spellCheck=true;this.spellCheckAllFields=false;}
break;case'lookup':break;case'required':case'editReadOnly':case'updateReadOnly':case'insertReadOnly':field[fieldProperty]=eval(propertyValue);break;case'editLookupMultiSelect':field[fieldProperty]=eval(propertyValue);break;case'initialValue':case'validation':case'format':case'uploadSubFolder':case'uploadExtFilter':case'uploadMaxFileSize':case'uploadOverwrite':case'uploadRename':case'uploadDelete':case'uploadMakeUnique':case'uploadCreateFolder':field[fieldProperty]=propertyValue;break;case'uploadRootFolder':field[fieldProperty]=propertyValue;var btn=this.addButton(field,"upload");btn.onclick=this.assignHandler("upload");field['editReadOnly']=true;if(field.tagName=="IMG")
{var btn=this.addButton(field,"trash");btn.onclick=this.assignHandler("clearImage");field.setAttribute("blob","true");field.setAttribute("column",field.id);}
break;case'editLookup':field[fieldProperty]=propertyValue;var btn=this.addButton(field,"lookup");field.parentElement.style.whiteSpace="nowrap";btn.onclick=this.assignHandler("openEditLookup");if(columnProperties["lookupText"])
{var propertyValue=columnProperties["lookupText"][0][0];var size=20;var lookupTextId=field.id+"__lookupText";if(isNaN(propertyValue))
lookupTextId=propertyValue;else
size=propertyValue;field.style.display="none";var o=this;field.onchange=function(){o.updateLookupText(this)};field.setAttribute("lookupTextId",lookupTextId);if(!getElementById(field.parentElement,lookupTextId))
{dbNetLink.insertAdjacentHTML(field,"beforeBegin","<input class=lookupText size="+size+" id=\""+lookupTextId+"\"></input>");}
var e=getElementById(field.parentElement,lookupTextId);e.readOnly=true;e.onkeydown=this.assignHandler("lookupTextKeyPress");e.setAttribute("lookupValueId",field.id);e.title=this.getText("del_to_clear");}
break;case'html':field.setAttribute(fieldProperty,propertyValue);if(propertyValue=="preview")
this.createPreviewField(field)
else
this.createMceEditor(field)
break;case'suggest':if(propertyValue==""||propertyValue.toLowerCase()=="true")
propertyValue="select "+field.id+" from "+this.tableName;field.setAttribute(fieldProperty,propertyValue);this.addSuggestField(field);break;default:field.style[fieldProperty]=propertyValue;if(fieldProperty=='display')
row.style.display=propertyValue;}}}}
function DbNetEdit_addButton(field,id)
{var html="<img class=\"imageButton\" id="+id+"Btn "+(((id=="upload"&&field.tagName!="IMG")||id=="lookup")?"align=absmiddle":"")+" title='"+this.getText(id+"Title")+"' src='"+this.virtualDir+"images/"+id+".gif' WIDTH=16 HEIGHT=16>";dbNetLink.insertAdjacentHTML(field.parentElement,"beforeEnd",html);var btn=getElementById(field.parentElement,id+"Btn");btn.field=field;field.button=btn;assignTabIndex(field,btn);return btn;}
function DbNetEdit_lookupTextKeyPress(event)
{if(event.event.keyCode!=46)
return;var field=event.srcElement;var e=getElementById(field.parentElement,field.getAttribute("lookupValueId"));if(e.readOnly)
return;e.value="";field.value="";}
function DbNetEdit_updateLookupText(e,textValue)
{if(e.value=="")
{getElementById(e.parentElement,e.getAttribute("lookupTextId")).value="";return;}
if(typeof(textValue)=="string")
{getElementById(e.parentElement,e.getAttribute("lookupTextId")).value=textValue;return;}
var sql=e.getAttribute("lookupSql");if(sql==null)
sql=this.getLookupSql(e.editLookup)
var params=new Object()
params["key"]=e.value;var data=this.selectData(sql,params);for(var c in data)
getElementById(e.parentElement,e.getAttribute("lookupTextId")).value=data[c];}
function DbNetEdit_getLookupSql(lookup)
{var m=lookup.match(/select (.*) from/i);var columns=m[1];var valueColumn=columns.split(',')[0];var textColumn=columns.replace(valueColumn+",","");var sql=lookup.replace(columns,textColumn);sql=sql.replace(/where (.*)/i,"");sql=sql.replace(/order by (.*)/i,"");sql+=" where "+valueColumn+" = @key";return sql;}
function DbNetEdit_repopulateLookup(id,lookup)
{var html=this.getSelectOptions(lookup,false);var opts=html.split("<option");var selectObj
for(var r=0;r<this.pageRowCount;r++)
{selectObj=this.inputControl(id,r);var restore=selectObj.preservedValue;while(selectObj.options.length>0)
selectObj.remove(0);if(!selectObj.required)
addOption(selectObj,"","")
for(var j=0;j<opts.length;j++)
{var matches=opts[j].match(/value=\"(.*)\">(.*)$/);if(matches)
addOption(selectObj,matches[2],matches[1])}
selectObj.value=restore;selectObj.originalValue=restore}}
function DbNetEdit_loadSelectOptions(selectObj,lookup,lookupWin)
{if(lookup=='')
return;var html=this.getSelectOptions(lookup,false);selectObj.innerHTML="";var selectParts=selectObj.outerHTML.split('><');var emptyOption='';if(!lookupWin&&!selectObj.required)
emptyOption='<option>';selectObj.outerHTML=selectParts[0]+'>'+emptyOption+html+'<'+selectParts[selectParts.length-1];}
function DbNetEdit_getSelectOptions(lookup,tableFormat)
{var html;if(lookup.indexOf('[[')>-1)
html=arrayToOptions(lookup,tableFormat)
else
{var xml=this.createXmlNode('sql',lookup)+
this.createXmlNode('tableFormat',tableFormat);if(!this.callService(xml,'selectoptions',this.XmlSelectData))
return
html=this.getNodeValue('html',this.XmlSelectData);}
return html}
function DbNetEdit_assignButtonAction(propertyName,containerName,targetFunction)
{if(this[propertyName]==null)
{var e=getElementById(this.container,containerName);if(e)
this[propertyName]=e;}
if(this[propertyName]!=null)
{if(typeof(this[propertyName].onclick)!='function')
this[propertyName].onclick=this.assignHandler(targetFunction);}}
function DbNetEdit_buildEditNavigator(container)
{var html="<table cellpadding=0 cellspacing=0><tr>";for(var i=0;i<this.navigatorButtons.length;i++)
{var id=this.navigatorButtons[i];if(id=="profile")
html+="<td>&nbsp;</td><td><select id=\"profileSelect\"></select></td>";html+="<TD id="+id+"Cell>"+this.makeButton(id)+"</TD>";}
container.innerHTML=html;}
function DbNetEdit_buildToolbar(container)
{if(this.profileSelect)
this.profile=true;var html="<table cellpadding=0 cellspacing=0><tr>";for(var i=0;i<this.toolbarButtons.length;i++)
{var id=this.toolbarButtons[i];if(id=="spell")
html+="<TD id="+id+"Cell>&nbsp;&nbsp;"+this.makeButton(id)+"</TD>";else
html+="<TD id="+id+"Cell>"+this.makeButton(id)+"</TD>";}
container.innerHTML=html;getElementById(container,'insertToolButton').onclick=this.assignHandler('insertRecord');getElementById(container,'applyToolButton').onclick=this.assignHandler('applyChanges');getElementById(container,'cancelToolButton').onclick=this.assignHandler('cancelChanges');getElementById(container,'deleteToolButton').onclick=this.assignHandler('deleteRecord');if(eval(this.insert)==false||eval(this.edit)==false)
hideElementById(container,'insertToolButton',false);if(eval(this.apply)==false||eval(this.edit)==false)
hideElementById(container,'applyToolButton',false);if(eval(this.cancel)==false||eval(this.edit)==false)
hideElementById(container,'cancelToolButton',false);if(eval(this.deleteRow)==false||eval(this.edit)==false)
hideElementById(container,'deleteToolButton',false);}
function DbNetEdit_selectedDate(evt)
{this.selectDate(evt.srcElement.field,evt.x,evt.y,this.fieldChange)}
function DbNetEdit_makeButton(id)
{var bStyle=this.buttonStyle.toUpperCase();var accessKey='';var glyph='<img id='+id+'Img src="'+this.virtualDir+'images/'+id+'.gif"></img>';var btnText=this.getText(id+'Text');var key=btnText.toLowerCase().match(/<u>(.*)<\/u>/);if(key)
accessKey='accessKey='+key[1];var html='<table cellpadding=0 cellspacing=0><tr>';if(bStyle=="TEXTOVER")
html=html+'<td class="dbneteditButtonCell">'+btnText+'</td></tr><tr>';if(bStyle=="TEXTLEFT")
html=html+'<td class="dbneteditButtonCell">'+btnText+'&nbsp;&nbsp;</td>';if(bStyle=="TEXTONLY")
html=html+'<td style=class="dbneteditButtonCell">'+btnText+'</td>';else
html+=('<td align=center>'+glyph+'</td>');if(bStyle=="TEXTRIGHT")
html=html+'<td class="dbneteditButtonCell">&nbsp;&nbsp;'+btnText+'</td>';if(bStyle=="TEXTUNDER")
html=html+'</tr><tr><td style="font-size:8pt">'+btnText+'</td>';html+='</tr></table>';return'<button type="button" class="dbneteditButton" id='+id+'ToolButton '+accessKey+' title="'+this.getText(id+'Title')+'">'+html+'</button>';}
function DbNetEdit_qualifyColumnName(columnName)
{return this.isEncrypted(columnName)?columnName:columnName.toLowerCase();}
function DbNetEdit_setFieldProperty(columnName,property)
{if(columnName=='')
return;columnName=this.qualifyColumnName(columnName);var el=this.getField(columnName);if(typeof(el)=="undefined"||el==null)
{this.message("Cannot set edit property for non-existent field "+columnName);return;}
var propParts=property.split(":");if((el.tagName=="INPUT")&&(propParts[0]=="lookup"))
{propParts[0]="editLookup";property=propParts.join(":");}
if(propParts[0]=="format")
propParts[1]=this.convertDateTimeFormat(propParts[1]);if(typeof(this.fieldProperties[columnName])=="undefined")
this.fieldProperties[columnName]=new Array();if(typeof(this.fieldProperties[columnName][property.split(':')[0]])=="undefined")
this.fieldProperties[columnName][property.split(':')[0]]=new Array();var propertyArray=this.fieldProperties[columnName][property.split(':')[0]];propertyArray[0]=[property.split(':').slice(1,property.split(':').length).join(':'),null,null];}
function DbNetEdit_setSearchFieldProperty(columnName,property)
{if(columnName=='')
return;columnName=this.qualifyColumnName(columnName);if(!this.isSearchField(columnName))
{this.message("Cannot set property for non-existent field "+columnName);return;}
var propParts=property.split(":");if(typeof(this.searchFieldProperties[columnName])=="undefined")
this.searchFieldProperties[columnName]=new Array();if(typeof(this.searchFieldProperties[columnName][property.split(':')[0]])=="undefined")
this.searchFieldProperties[columnName][property.split(':')[0]]=new Array();var propertyArray=this.searchFieldProperties[columnName][property.split(':')[0]];propertyArray[0]=[property.split(':').slice(1,property.split(':').length).join(':'),null,null];}
function DbNetEdit_isSearchField(columnName)
{var match=false;for(var i=0;i<this.searchFields.length;i++)
{if(this.qualifyColumnName(columnName)==this.qualifyColumnName(this.searchFields[i]))
{match=true;break;}}
return match;}
function DbNetEdit_getField(columnName)
{var el=null;for(var i=0;i<this.fields[0].length;i++)
{if(this.fields[0][i].id.toLowerCase()==columnName.toLowerCase())
el=this.fields[0][i];}
return el;}
function DbNetEdit_selectContainer(evt)
{if(eval(this.multipleSelect)==false&&evt.srcElement.checked)
{for(var i=0;i<this.rowContainers.length;i++)
{var selector=getElementById(this.rowContainers[i],'dbneteditrowselector')
if(selector&&selector!=evt.srcElement)
if(selector.checked)selector.checked=false;}}}
function DbNetEdit_openEditLookup(evt)
{if(evt.srcElement.field.disabled||evt.srcElement.field.readOnly)
return;var o=new Object();o.field=evt.srcElement.field;o.component=this;o.callback=this.fieldChange;o.selectionType=this.editLookupSelectionType;o.x=evt.x;o.y=evt.y;dbNetLink.openModalDialog(this.virtualDir+'common/lookup.htm','lookup',o);}
function DbNetEdit_applyFieldChange(field)
{if(field.originalValue!=field.value)
if(typeof(field.onchange)=="function")
field.onchange();}
function DbNetEdit_appendHtml(html)
{if(this.container.tagName=="TABLE")
{var max=0,ct=0;for(var r=0;r<this.container.rows.length;r++)
{ct=0;for(var c=0;c<this.container.rows[r].cells.length;c++)
if(this.container.rows[r].cells[c].colSpan)
ct+=parseInt(this.container.rows[r].cells[c].colSpan);if(ct>max)
max=ct;}
var row=this.container.insertRow(-1);var cell=row.insertCell(-1);cell.colSpan=max;cell.innerHTML=html;}
else
{dbNetLink.insertAdjacentHTML(this.container,"beforeEnd",html);}}
function DbNetEdit_disable(disableLinkedForms)
{for(var j=0;j<this.fields.length;j++)
{for(var i=0;i<this.fields[j].length;i++)
{var field=this.fields[j][i];if(field.tagName=="IMG")
field.src=this.virtualDir+"images/spacer.gif";else
{switch(field.type)
{case"checkbox":field.checked=false;break;case"select-one":field.selectedIndex=-1;break;default:field.value="";break;}}
field.readOnly=true;field.originalValue=field.value;this.configureField(field);}}
this.setButtonStatus("insert",false);this.setButtonStatus("cancel",true);this.setButtonStatus("apply",true);this.setButtonStatus("delete",true);this.mode='';}
function DbNetEdit_addLinkedEditForm(editForm,foreignKey)
{var el=editForm.getField(foreignKey)
if(el==null)
{this.error("The linked form does not contain the foreign key "+foreignKey)
return}
this.detailFormArray[this.detailFormArray.length]=[editForm,foreignKey];editForm.parentForm=this;editForm.foreignKey=foreignKey;}
function DbNetEdit_setButtonStatus(buttonId,isDisabled)
{var btn=eval("this."+buttonId+"Button");if(btn)
btn.disabled=isDisabled;if(this.toolbar)
{var btn=getElementById(this.toolbar,buttonId+'ToolButton')
if(btn)
btn.disabled=isDisabled;if(buttonId=='delete')
{var img=getElementById(btn,buttonId+"Img")
if(img)
img.src=this.virtualDir+'images/'+buttonId+(btn.disabled?'off':'')+'.gif';}}}
function DbNetEdit_fieldPropertyValue(nodeName,property,defaultValue)
{var retVal=defaultValue;var properties=this.fieldProperties[this.qualifyColumnName(nodeName)];if(properties)
if(properties[property])
if(typeof(defaultValue)=='boolean')
retVal=eval(properties[property][0][0]);else
retVal=properties[property][0][0];return retVal;}
function DbNetEdit_showBrowseWindow()
{var o=new Object();o.component=this;var url=this.virtualDir+'/browse_window.htm'
url=url.replace(/\/\//g,'\/');this.browseWin=this.openNonModalDialog(url,'browse',o);}
function DbNetEdit_showSearchWindow()
{if(this.searchWin)
if(!this.searchWin.closed)
{this.searchWin.focus();return;}
var o=new Object();o.connectionString=this.connectionString;for(var i=0;i<this.searchFields.length;i++)
this.searchFields[i]=this.qualifyColumnName(this.searchFields[i]);o.fields=this.searchFields;o.labels=this.searchLabels;o.component=this;o.content=this.searchDialogContent;o.composite=false;o.parentWindow=window;var winName='search_window';switch(this.searchType)
{case'composite':o.composite=true;winName='composite_search_window';break;case'simple':if(this.simpleSearchIsValid())
winName='simple_search_window';break;}
this.searchWin=this.openNonModalDialog(this.virtualDir+'common/'+winName+'.htm',winName,o);}
function DbNetEdit_sortData()
{var o=new Object();o.sortColumns=this.sortColumns;o.sortSequence=this.sortSequence;o.sortHeadings=this.sortHeadings;o.columns=this.sortFields;o.headings=this.sortLabels;o.component=this;o.callback=this.doSort;dbNetLink.openModalDialog(this.virtualDir+'common/sort.htm','sort',o);}
function DbNetEdit_doSort(selection)
{if(selection!=null)
{if(selection.sortColumns=='')
{this.sortColumns=new Array();this.sortSequence=new Array();this.sortHeadings=new Array();}
else
{this.sortColumns=selection.sortColumns.split('~');this.sortSequence=selection.sortSequence.split('~');this.sortHeadings=selection.sortHeadings.split('~');}
this.initialiseNavigator();}}
function DbNetEdit_doBeforeUpload(form)
{this.fireCustomEvent(this.onBeforeUpload,form,this);}
function DbNetEdit_doAfterUpload(form)
{this.fireCustomEvent(this.onAfterUpload,form,this);}
function DbNetEdit_simpleSearchIsValid()
{if(!testArray(this.simpleSearchFilter))
return false;if(this.simpleSearchFilter.length<1)
return false;var valid=true;for(var i=0;i<this.simpleSearchFilter.length;i++)
{if(!testArray(this.simpleSearchFilter[i]))
{valid=false;break;}
if(this.simpleSearchFilter[i].length!=2)
{valid=false;break;}}
return valid;}
function DbNetEdit_editor(evt)
{if(evt.srcElement.field.disabled||evt.srcElement.field.readOnly)
return;this.openEditor(evt.srcElement.field);}
function DbNetEdit_openEditor(field)
{if(field.srcElement)
{var e=field.srcElement.parentNode
while(!e.getAttribute("linkedElement"))
e=e.parentNode;field=this.inputControl(e.getAttribute("linkedElement"));}
var params=new Object();params.field=field;params.component=this;params.callback=this.fieldChange;var e=getElementById(this.editorPicker,'editorSelect');if(!e)
return;if(!this.editorSelector)
if(field.getAttribute("html")!=null)
e.value="html"
else
e.value="text"
if(e.value=="html")
dbNetLink.openHTMLEditor(params);else
dbNetLink.openModalDialog(this.virtualDir+'common/editor/texteditor.htm','texteditor',params,'resizable=yes,dialogHeight=200px,dialogWidth=600px');}
function DbNetEdit_defaultSearchAction()
{if(!this.checkForChanges())
return;this.doSearch();}
function DbNetEdit_doSearch()
{if(this.pendingSearchCriteria)
{this.filterPart=this.pendingSearchCriteria.filterPart;if(this.pendingSearchCriteria.type=='simple')
this.simpleSearchDialogContent=this.pendingSearchCriteria.content
else
this.searchDialogContent=this.pendingSearchCriteria.content;this.pendingSearchCriteria=null;}
this.initialiseNavigator();if(this.navigatorInfo.data.length==0&&this.getText('noneFound')!='')
this.message(this.getText('noneFound'));}
function DbNetEdit_setSearchResult(fp,content,type)
{if(!this.pendingSearchCriteria)
this.pendingSearchCriteria=new Object();this.pendingSearchCriteria.filterPart=fp;this.pendingSearchCriteria.content=content;this.pendingSearchCriteria.type=type;}
function DbNetEdit_fieldChange(args)
{this.applyFieldChange(args.field)}
function DbNetEdit_getModifiedRowCount()
{var ct=0;for(var i=0;i<this.rowContainers.length;i++)
if(this.rowContainers[i].modified)
ct++;return ct;}
function DbNetEdit_createSimpleSearch()
{if(this.simpleSearchFilter!="")
return;var a=new Array();for(var i=0;i<this.fields[0].length;i++)
{var field=this.fields[0][i];if(field.dataType=="string");a[a.length]=field.id+" like '%{token}%'";}
if(a.length>0)
this.simpleSearchFilter=new Array(new Array("",a.join(" or ")));}
function DbNetEdit_getPrimaryKeyValue(i)
{var pk='';if(!testArray(this.primaryKeyValue))
pk=this.primaryKeyValue;else
if(this.primaryKeyValue[i])
pk=this.primaryKeyValue[i];return pk;}
function DbNetEdit_updateImageWindow()
{for(var id in this.imageWindow)
{var w=this.imageWindow[id];if(windowOpen(w))
{var src=this.inputControl(id).src;w.updateImage(src);w.focus();}}}
function DbNetEdit_showImageWindow(event)
{var id=event.srcElement.id.replace(/_\d{1,}/,"");var w=this.imageWindow[id];if(windowOpen(w))
{w.updateImage(event.srcElement.src);w.focus();return;}
var o=new Object();o.src=event.srcElement.src;o.parentWindow=window;o.component=this;this.imageWindow[id]=this.openNonModalDialog(this.virtualDir+'common/image_window.htm',"image_window_"+id,o,"scrollbars=yes");}
function DbNetEdit_clearImage(event)
{event.srcElement.field.src=this.virtualDir+"images/spacer.gif";event.srcElement.field.setAttribute("blobStatus","deleted");this.updateImageWindow()}
function assignTabIndex(field,button)
{if(typeof(field.tabIndex)=="number")
button.tabIndex=field.tabIndex;}
function DbNetEdit_uploadCallback(o)
{var field=o.field;if(field.getAttribute("blob")=="true")
{field.setAttribute("blobStatus","uploaded");field.src=this.virtualDir+"dbnetedit.aspx?mode=image&session="+field.id+"&resize="+field.height+"H&timestamp="+new Date().valueOf().toString();this.updateImageWindow();}
else
this.applyFieldChange(field)}
function DbNetEdit_unhighlightActiveControl()
{removeClassName(this.activeControl,'focused');}
function DbNetEdit_loadFormTemplate(path)
{this.httpRequest.get(path);this.container.innerHTML=this.xmlRequest.responseText;}
function DbNetEdit_browsePaneToolbar()
{var html="<table><tr>"+"<td><button id=firstBtn type=button><img src='{vd}images/first.gif'></img></button></td>"+"<td><button id=prevBtn type=button><img src='{vd}images/prev.gif'></img></button></td>"+"<td>Page</td>"+"<td id=pageSelectorCell></td>"+"<td>of</td>"+"<td id=pageCount></td>"+"<td><button id=nextBtn type=button><img src='{vd}images/next.gif'></img></button></td>"+"<td><button id=lastBtn type=button><img src='{vd}images/last.gif'></img></button></td>"+"</tr></table>";html=html.replace(/{vd}/g,this.virtualDir);return html}
function DbNetEdit_updateBrowsePaneToolbar()
{if(!this.browseToolbar)
return;if(this.pageSelector)
if(this.pageSelector.options.length!=this.navigatorInfo.pageCount)
this.pageSelector=null;if(this.pageSelector==null)
{var opts=new Array();for(var i=1;i<=this.navigatorInfo.pageCount;i++)
opts[opts.length]="<option value="+i+">"+i;getElementById(this.browseToolbar,"pageSelectorCell").innerHTML="<select id=pageSelector>"+opts.join("")+"</select>";this.pageSelector=getElementById(this.browseToolbar,'pageSelector');this.pageSelector.onchange=this.assignHandler('selectPage');getElementById(this.browseToolbar,"pageCount").innerHTML=this.navigatorInfo.pageCount;}
this.pageSelector.value=this.navigatorInfo.currentPage;this.setScrollButtonState();}
function DbNetEdit_createMceEditor(field)
{field.style.display="none";if(typeof(field.editorBtn)!='undefined')
field.editorBtn.style.display="none";if(field.style.height==""||parseInt(field.style.height)<130)
field.style.height=130
if(!dbNetLink.isSafari)
{var html="<iframe id="+field.id+"_mce_editor_frame name="+field.id+"_mce_editor_frame src=\""+this.virtualDir+"/common/editor/tinymce/tinymce_frame.aspx\" style=\"height:"+field.style.height+";width:"+field.style.width+"\" scrolling=\"no\" frameborder=0 config=\""+field.getAttribute("html")+"\" linkedElement=\""+field.id+"\"></iframe>";dbNetLink.insertAdjacentHTML(field,"beforeBegin",html);}
else
{var node=document.createElement("IFRAME");node.setAttribute("id",field.id+"_mce_editor_frame");node.setAttribute("name",field.id+"_mce_editor_frame");node.setAttribute("src",this.virtualDir+"/common/editor/tinymce/tinymce_frame.aspx");node.setAttribute("config",field.getAttribute("html"));node.setAttribute("scrolling","no");node.setAttribute("frameBorder","0");node.setAttribute("linkedElement",field.id);node.style.width=field.style.width;node.style.height=field.style.height;field.parentNode.insertBefore(node,field);}
document.getElementById(field.id+"_mce_editor_frame").component=this
this.mceEditorFrames[this.mceEditorFrames.length]=document.getElementById(field.id+"_mce_editor_frame");}
function DbNetEdit_createPreviewField(field)
{if(field.type!="textarea")
{alert("Only textarea elements may be defined as html preview fields.");return}
field.style.display="none";var html="<div id="+field.id+"_preview_field style=\"height:"+field.style.height+";width:"+field.style.width+";border:1pt solid silver;padding:2px;overflow-x:hidden;overflow-y:auto;\" linkedElement=\""+field.id+"\"></div>";dbNetLink.insertAdjacentHTML(field,"beforeBegin",html);field.previousSibling.ondblclick=this.assignHandler("openEditor");this.HTMLPreviewFields[this.HTMLPreviewFields.length]=document.getElementById(field.id+"_preview_field");}
function DbNetEdit_loadMceEditorContent()
{for(n in this.mceEditorFrames)
{var f=window.frames[this.mceEditorFrames[n].name];if(f.window.document.body==null||typeof(f.tinyMCE)=="undefined"||typeof(f.window.tinyMCE.getInstanceById("editor_area"))=="undefined")
{setTimeout(this.toString()+".loadMceEditorContent()",100);return;}}
for(n in this.mceEditorFrames)
{var f=window.frames[this.mceEditorFrames[n].name];var p=this.mceEditorFrames[n].parentNode;var id=this.mceEditorFrames[n].getAttribute("linkedElement");var e=dbNetLink.getElementById(p,id);f.window.tinyMCE.getInstanceById("editor_area").setContent(e.value);f.window.initialContent=f.window.tinyMCE.getInstanceById("editor_area").getContent();}}
function DbNetEdit_retrieveMceEditorContent()
{for(n in this.mceEditorFrames)
{var f=window.frames[this.mceEditorFrames[n].name];if(typeof(f.window.initialContent)!="undefined"&&f.window.initialContent!=f.tinyMCE.getInstanceById("editor_area").getContent())
dbNetLink.getElementById(f.frameElement.parentNode,f.frameElement.getAttribute("linkedElement")).value=f.tinyMCE.getInstanceById("editor_area").getContent()}}
function DbNetEdit_loadHtmlPreviewContent()
{for(n in this.HTMLPreviewFields)
this.HTMLPreviewFields[n].innerHTML=document.getElementById(this.HTMLPreviewFields[n].getAttribute("linkedElement")).value;}
function DbNetEdit_addSuggestField(field)
{var htmlHead=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.setAttribute("language","Javascript");script.setAttribute("src",this.virtualDir+"common/suggestlookup.js");htmlHead.insertBefore(script,htmlHead.childNodes[0]);var htmlHead=document.getElementsByTagName("head")[0];var link=document.createElement("link");link.setAttribute("rel","stylesheet");link.setAttribute("href",this.virtualDir+"common/css/suggestlookup.css");link.setAttribute("type","text/css");htmlHead.insertBefore(link,htmlHead.childNodes[0]);var thisReference=this;var timeOut=function(){if(typeof(Lookup)=="undefined")
window.setTimeout(timeOut,100)
else
{var sql=field.getAttribute("suggest");var suggest=new Lookup(field,sql,thisReference,field.id,thisReference.tableName);field.suggest=suggest;}};timeOut();}