//////////////////////////////////////////////////////////////////////////////////////////
// dbnetgrid.js
// Copyright DbNetLink Ltd 2006
//////////////////////////////////////////////////////////////////////////////////////////
window.DbNetGridArray = new Object();

DbNetGrid.prototype = new Component();

// public properties

DbNetGrid.prototype.allowLinkedDeletion = false;				
DbNetGrid.prototype.asyncLoad = false;	
DbNetGrid.prototype.autoSequence = false;	
DbNetGrid.prototype.buttonNavigation = true;				
DbNetGrid.prototype.chart = false;				
DbNetGrid.prototype.chartDocument = "";				
DbNetGrid.prototype.chartPlotBy ="columns";				
DbNetGrid.prototype.childFilterType = "fixedFilter";				
DbNetGrid.prototype.columnPicker = true;				
DbNetGrid.prototype.config = true;				
DbNetGrid.prototype.confirmDeletion = true;				
DbNetGrid.prototype.confirmUnappliedChanges = true;				
DbNetGrid.prototype.connectionString = "samples";				
DbNetGrid.prototype.copy = true;				
DbNetGrid.prototype.copyColumns = "array";
DbNetGrid.prototype.copyDocument = "";				
DbNetGrid.prototype.copyHeadings = "array";				
DbNetGrid.prototype.copyPageSize = 0; 				
DbNetGrid.prototype.copyTemplatePath = ""; 				
DbNetGrid.prototype.copyType = "";				
DbNetGrid.prototype.csvExportFilename = "dbnetgrid.csv";				
DbNetGrid.prototype.customEditDialog = "";				
DbNetGrid.prototype.dataOnlyColumns = "array";
DbNetGrid.prototype.datasourceColumns = "array";
DbNetGrid.prototype.datasourceHeadings = "array";				
DbNetGrid.prototype.dateFormat = "d";				
DbNetGrid.prototype.DBMSName = "";				
DbNetGrid.prototype.dbNetEdit = null;				
DbNetGrid.prototype.deferredColumns = "array";
DbNetGrid.prototype.deferredHeadings = "array";					
DbNetGrid.prototype.deleteError = "";				
DbNetGrid.prototype.deleteRow = true;				
DbNetGrid.prototype.deleteValidation = "";				
DbNetGrid.prototype.displayToolbar = true;				
DbNetGrid.prototype.dng_lang = "";				
DbNetGrid.prototype.dragAndDrop = true;				
DbNetGrid.prototype.editCommentHeight = "50px";				
DbNetGrid.prototype.editDialogCloseOnApply = false; 				
DbNetGrid.prototype.editDialogHeight = "";				
DbNetGrid.prototype.editDialogInitialisation = "";				
DbNetGrid.prototype.editFields = "array";
DbNetGrid.prototype.editLabels = "array";
DbNetGrid.prototype.editLookupSelectionType = "";				
DbNetGrid.prototype.editNavigation = true;				
DbNetGrid.prototype.editRow = true;				
DbNetGrid.prototype.editRowInitialisation = "";				
DbNetGrid.prototype.editTableName = "";				
DbNetGrid.prototype.excelExportFilename = "dbnetgrid.xls";				
DbNetGrid.prototype.exportPageSize = 0;				
DbNetGrid.prototype.exportTemplatePath = ""; 				
DbNetGrid.prototype.filterAutocomplete = true;				
DbNetGrid.prototype.filterColumns = "array";
DbNetGrid.prototype.filterPart = "";				
DbNetGrid.prototype.filterTable = "";				
DbNetGrid.prototype.filterType = "simple";				
DbNetGrid.prototype.filterValues = "array";				
DbNetGrid.prototype.firstDataRowIndex = 1;				
DbNetGrid.prototype.fixedFilterPart = "";				
DbNetGrid.prototype.fixedOrderPart = "";				
DbNetGrid.prototype.fromPart = "";				
DbNetGrid.prototype.gridHeight = 0;				
DbNetGrid.prototype.gridWidth = 0;				
DbNetGrid.prototype.groupBy = "";				
DbNetGrid.prototype.having = "";				
DbNetGrid.prototype.headingRow = "";				
DbNetGrid.prototype.headings = "array";				
DbNetGrid.prototype.help = false;				
DbNetGrid.prototype.helpFile = DbNetGrid.prototype.virtualDir + "/docs/help/DbNetGrid.htm";				
DbNetGrid.prototype.helpWindow = "";				
DbNetGrid.prototype.hiddenGridColumns = "array";
DbNetGrid.prototype.hiddenGridHeadings = "array";	
DbNetGrid.prototype.HTMLEditor = "tinymce";
DbNetGrid.prototype.imageEditPreviewHeight = 32;			
DbNetGrid.prototype.initialGridColumns = "array";
DbNetGrid.prototype.initialGridHeadings = "array";
DbNetGrid.prototype.insertRow = true; 				
DbNetGrid.prototype.joinPart = "";  				
DbNetGrid.prototype.language = "";				
DbNetGrid.prototype.lookupAutocomplete = true;				
DbNetGrid.prototype.mailMerge = false;				
DbNetGrid.prototype.mailMergeDocument = "";				
DbNetGrid.prototype.mailMergeExecute = false;				
DbNetGrid.prototype.message = ""; 				
DbNetGrid.prototype.msg = ""; 				
DbNetGrid.prototype.multipleInsert = false; 				
DbNetGrid.prototype.nestedChildGrids = null; 				
DbNetGrid.prototype.optimisticLocking = true; 				
DbNetGrid.prototype.orderColumn = "";				
DbNetGrid.prototype.orderSequence = "asc";				
DbNetGrid.prototype.outputTemplateParameters = "object"; 				
DbNetGrid.prototype.outputMode = false; 				
DbNetGrid.prototype.outputCurrentPageOnly = false; 				
DbNetGrid.prototype.pageInfo = true;				
DbNetGrid.prototype.pageNumber = 1;				
DbNetGrid.prototype.pageSize = 20;				
DbNetGrid.prototype.parentGrid;				
DbNetGrid.prototype.parentRow;				
DbNetGrid.prototype.pendingSearchCriteria;				
DbNetGrid.prototype.positionOnInsertedRecord = false;				
DbNetGrid.prototype.primaryKeyAutoincrement = false; 				
DbNetGrid.prototype.primaryKeyColumn = "";				
DbNetGrid.prototype.primaryKeyColumnForDeletion = "";				
DbNetGrid.prototype.print = true;				
DbNetGrid.prototype.printColumns = "array";
DbNetGrid.prototype.printHeadings = "array";
DbNetGrid.prototype.printPageSize = 0;				
DbNetGrid.prototype.printTemplatePath = ""; 				
DbNetGrid.prototype.printType = ""; 				
DbNetGrid.prototype.procedure = "";				
DbNetGrid.prototype.procedureParameters = "object";		
DbNetGrid.prototype.profile = false;				
DbNetGrid.prototype.queryParameters = "object";				
DbNetGrid.prototype.rowInfo = true; 				
DbNetGrid.prototype.rowValidation = "";				
DbNetGrid.prototype.save = true;				
DbNetGrid.prototype.saveColumns = "array";
DbNetGrid.prototype.saveHeadings = "array";
DbNetGrid.prototype.saveOptions = "HTML,Word,Excel,XML,CSV"; 				
DbNetGrid.prototype.saveType = "";				
DbNetGrid.prototype.scanRowsForCount = true;				
DbNetGrid.prototype.search = true; 				
DbNetGrid.prototype.searchColumnProperties = "array";				
DbNetGrid.prototype.searchDialog = "";				
DbNetGrid.prototype.searchDialogCloseOnApply = false; 				
DbNetGrid.prototype.searchDialogHeight = "";				
DbNetGrid.prototype.searchDialogInitialisation = "";				
DbNetGrid.prototype.searchDialogJoinOperator = "and";				
DbNetGrid.prototype.searchFields = "array";
DbNetGrid.prototype.searchFromPart = "";				
DbNetGrid.prototype.searchLabels = "array";
DbNetGrid.prototype.searchLookupSelectionType = "";				
DbNetGrid.prototype.searchType = ""; 				
DbNetGrid.prototype.searchTypeFixed = false;				
DbNetGrid.prototype.selectModifier = "";				
DbNetGrid.prototype.selectPart = "array";				
DbNetGrid.prototype.selectedSortColumns = "array";
DbNetGrid.prototype.selectedSortLabels = "array";
DbNetGrid.prototype.selectedSortSequence = "array"; 				
DbNetGrid.prototype.sequenceName = "";				
DbNetGrid.prototype.simpleSearchFilter = "";				
DbNetGrid.prototype.sort = true; 				
DbNetGrid.prototype.sortColumns = "array";
DbNetGrid.prototype.sortLabels = "array";
DbNetGrid.prototype.sql = "";				
DbNetGrid.prototype.table;				
DbNetGrid.prototype.text;				
DbNetGrid.prototype.textLoaded = false;				
DbNetGrid.prototype.toolbar;				
DbNetGrid.prototype.toolButtonStyle = "image"; 		
DbNetGrid.prototype.totalBreakColumns = "array";
DbNetGrid.prototype.totalBreakInfo = "object";
DbNetGrid.prototype.totalDuplicatedColumns = "array";
DbNetGrid.prototype.totalColumns = "array";
DbNetGrid.prototype.totalFinalLabel = "";
DbNetGrid.prototype.trace = false;				
DbNetGrid.prototype.traceArray;				
DbNetGrid.prototype.traceWindow;				
DbNetGrid.prototype.updateRow = true;				
DbNetGrid.prototype.useSortSequence = false; 				
DbNetGrid.prototype.view = false;				
DbNetGrid.prototype.viewColumnProperties = "array";;				
DbNetGrid.prototype.viewControl = null;				
DbNetGrid.prototype.viewDialogHeight = "";				
DbNetGrid.prototype.viewDialogWidth = "";				
DbNetGrid.prototype.viewDialogInitialisation = "";				
DbNetGrid.prototype.viewFields = "array";
DbNetGrid.prototype.viewLabels = "array";
DbNetGrid.prototype.viewNavigation = true;				
DbNetGrid.prototype.viewPrint = false;				
DbNetGrid.prototype.viewPrintTemplate = "{data}"; 				
DbNetGrid.prototype.viewPrintTemplatePath = ""; 				
DbNetGrid.prototype.viewRowInitialisation = "";				
DbNetGrid.prototype.viewTemplate = "";				
DbNetGrid.prototype.viewTemplatePath = "";				
DbNetGrid.prototype.virtualDir = "/dbnetlink_components/dbnetgrid/";
DbNetGrid.prototype.wordExportFilename = "dbnetgrid.doc";				
DbNetGrid.prototype.wrapHeadings = false;				


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.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.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;function DbNetLink()
{this.isIE=false;if(document.all)
this.isIE=true;if(this.isIE)
{navigator.userAgent.toLowerCase().match(/msie (\d{1,}\.\d{1,})/)
if(RegExp.$1!="")
this.IEVersion=parseFloat(RegExp.$1);}
else
{navigator.userAgent.toLowerCase().match(/firefox\/(\d{1,}\.\d{1,})/)
if(RegExp.$1!="")
this.FFVersion=parseFloat(RegExp.$1);}}
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(!document.all)
{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)
{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));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_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("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.htm";params.standardWindow=true;window._htmlEditorParams=params;}
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);}
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.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.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();}
function initialiseComponent(o)
{if(window[o.componentName+"VirtualFolder"])
o.virtualDir=window[o.componentName+"VirtualFolder"];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_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++)
{alert(rules[r].selectorText+"\n"+qualifiedName)
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)
{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);}
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.toLowerCase())
{case'g':var d=new Date(o.year,o.month-1,o.day,o.hour,o.mins,0);break;case'd':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&&dbNetLink.isIE&&!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;o.x=event.screenX;o.y=event.screenY;o.event=event;}
return o;}
function getWindowArguments()
{if(opener)
if(opener.dialogArguments)
return opener.dialogArguments[window.name];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);}}}
DbNetGrid.prototype.componentName="DbNetGrid";DbNetGrid.prototype.configLang="default";DbNetGrid.prototype.addedRecordIds="";DbNetGrid.prototype.allRows="";DbNetGrid.prototype.buttons=["first","prev","next","last","search","updateRow","insertRow","deleteRow","save","copy","help","columnPicker","sort","print","view","config","trace","mailMerge","chart","profile"];DbNetGrid.prototype.childGrid="";DbNetGrid.prototype.childGridForeignKeyColumn="";DbNetGrid.prototype.columnLookups="array";DbNetGrid.prototype.columnNames;DbNetGrid.prototype.columnOffset=-1;DbNetGrid.prototype.columnProperties="array";DbNetGrid.prototype.culture=null;DbNetGrid.prototype.currentFilterPart="";DbNetGrid.prototype.currentRow;DbNetGrid.prototype.dateQueryFunction="";DbNetGrid.prototype.dateQueryStringFormat="";DbNetGrid.prototype.detailGridArray="array";DbNetGrid.prototype.dragStarted=false;DbNetGrid.prototype.editColumnProperties="array";DbNetGrid.prototype.editControl=null;DbNetGrid.prototype.editWindow="";DbNetGrid.prototype.errorMessage="";DbNetGrid.prototype.errorNumber="";DbNetGrid.prototype.editWindow="";DbNetGrid.prototype.focusedFilter="";DbNetGrid.prototype.foreignKeyColumn="";DbNetGrid.prototype.foreignKeyValue="";DbNetGrid.prototype.gridContainer;DbNetGrid.prototype.gridToCopy="";DbNetGrid.prototype.gridToPrint="";DbNetGrid.prototype.gridToSave="";DbNetGrid.prototype.headingProperties="object";DbNetGrid.prototype.htmlFormat="lite";DbNetGrid.prototype.imageCache="array";DbNetGrid.prototype.imageLookups="array";DbNetGrid.prototype.imageWindow="object";DbNetGrid.prototype.navButtons=["first","prev","next","last"];DbNetGrid.prototype.navigationControl=null;DbNetGrid.prototype.nestedChild=false;DbNetGrid.prototype.nestedLevel=0;DbNetGrid.prototype.openingEditDialog=false;DbNetGrid.prototype.outputControl=null;DbNetGrid.prototype.pageCount=0;DbNetGrid.prototype.primaryKeyColumnType="";DbNetGrid.prototype.propertyTypes=null;DbNetGrid.prototype.printDocument="";DbNetGrid.prototype.recordsAdded=0;DbNetGrid.prototype.requiredProperties=["fromPart","joinPart","filterPart","fixedFilterPart","orderColumn","orderSequence","pageNumber","pageSize","primaryKeyColumn","connectionString","procedure","selectModifier","fixedOrderPart","groupBy","having","scanRowsForCount","dataOnlyColumns","totalBreakColumns","totalColumns","totalDuplicatedColumns","totalBreakInfo","totalFinalLabel"];DbNetGrid.prototype.rowCount=0;DbNetGrid.prototype.saveDocument="";DbNetGrid.prototype.searchControl=null;DbNetGrid.prototype.searchDialogContent="object";DbNetGrid.prototype.searchWindow=null;DbNetGrid.prototype.searchWithinResults=true;DbNetGrid.prototype.server="dbnetgrid.aspx";DbNetGrid.prototype.simpleSearchDialogContent="";DbNetGrid.prototype.simpleSearchToken="";DbNetGrid.prototype.specialCharRE=/[\(\'&,]/;DbNetGrid.prototype.smallButtons=true;DbNetGrid.prototype.tableProperties="object";DbNetGrid.prototype.userProfileProperties=["selectPart","headings","searchDialogContent","orderColumn","orderSequence","filterPart","fixedFilterPart","filterValues","pageSize","searchType","selectedSortColumns","selectedSortSequence","selectedSortLabels","simpleSearchDialogContent","filterType","saveFormat","saveType","copyType","printType","useSortSequence","outputCurrentPageOnly","htmlFormat","filterText","deferredColumns","deferredHeadings","hiddenGridColumns","hiddenGridHeadings","exportPageSize","printPageSize","copyPageSize"];DbNetGrid.prototype.version='3.1';DbNetGrid.prototype.viewWindow="";DbNetGrid.prototype.addDetailGrid=DbNetGrid_addDetailGrid;DbNetGrid.prototype.addNestedGrid=DbNetGrid_addNestedGrid;DbNetGrid.prototype.addTotalBreak=DbNetGrid_addTotalBreak;DbNetGrid.prototype.addToolbarButton=DbNetGrid_addToolbarButton;DbNetGrid.prototype.assignEventsToColumnHeadings=DbNetGrid_assignEventsToColumnHeadings;DbNetGrid.prototype.arrayIndex=DbNetGrid_arrayIndex;DbNetGrid.prototype.columnIndex=DbNetGrid_columnIndex;DbNetGrid.prototype.getColumn=DbNetGrid_getColumn;DbNetGrid.prototype.copyGrid=DbNetGrid_copyGrid;DbNetGrid.prototype.deleteRecord=DbNetGrid_deleteRecord;DbNetGrid.prototype.getAllRows=DbNetGrid_getAllRows;DbNetGrid.prototype.getHeading=DbNetGrid_getHeading;DbNetGrid.prototype.getHeadingRow=DbNetGrid_getHeadingRow;DbNetGrid.prototype.gridElement=DbNetGrid_gridElement;DbNetGrid.prototype.insertRecord=DbNetGrid_insertRecord;DbNetGrid.prototype.loadData=DbNetGrid_loadData;DbNetGrid.prototype.printGrid=DbNetGrid_printGrid;DbNetGrid.prototype.saveGrid=DbNetGrid_saveGrid;DbNetGrid.prototype.setColumnProperty=DbNetGrid_setColumnProperty;DbNetGrid.prototype.setGridColumnProperty=DbNetGrid_setColumnProperty;DbNetGrid.prototype.setColumnLookup=DbNetGrid_setColumnLookup;DbNetGrid.prototype.setGridColumnLookup=DbNetGrid_setColumnLookup;DbNetGrid.prototype.setDialogColumns=DbNetGrid_setDialogColumns;DbNetGrid.prototype.setEditColumnProperty=DbNetGrid_setEditColumnProperty;DbNetGrid.prototype.setFilterFocus=DbNetGrid_setFilterFocus;DbNetGrid.prototype.setSearchResult=DbNetGrid_setSearchResult;DbNetGrid.prototype.setSearchColumnProperty=DbNetGrid_setSearchColumnProperty;DbNetGrid.prototype.setViewColumnProperty=DbNetGrid_setViewColumnProperty;DbNetGrid.prototype.setViewColumnLookup=DbNetGrid_setViewColumnLookup;DbNetGrid.prototype.toolbarElement=DbNetGrid_toolbarElement;DbNetGrid.prototype.updateRecord=DbNetGrid_updateRecord;DbNetGrid.prototype.addGridNode=DbNetGrid_addGridNode;DbNetGrid.prototype.applyColumnDrop=DbNetGrid_applyColumnDrop;DbNetGrid.prototype.applyFilter=DbNetGrid_applyFilter;DbNetGrid.prototype.applyGridProperties=DbNetGrid_applyGridProperties;DbNetGrid.prototype.applySearchCriteria=DbNetGrid_applySearchCriteria;DbNetGrid.prototype.arrayOfElements=DbNetGrid_arrayOfElements;DbNetGrid.prototype.assignFilters=DbNetGrid_assignFilters;DbNetGrid.prototype.assignText=DbNetGrid_assignText;DbNetGrid.prototype.assignToolbarControl=DbNetGrid_assignToolbarControl;DbNetGrid.prototype.assignToolbarText=DbNetGrid_assignToolbarText;DbNetGrid.prototype.assignTreeSelect=DbNetGrid_assignTreeSelect;DbNetGrid.prototype.buildInitialGridColumns=DbNetGrid_buildInitialGridColumns;DbNetGrid.prototype.buttonContent=DbNetGrid_buttonContent;DbNetGrid.prototype.checkPrintDocumentState=DbNetGrid_checkPrintDocumentState;DbNetGrid.prototype.checkSql=DbNetGrid_checkSql;DbNetGrid.prototype.clearRows=DbNetGrid_clearRows;DbNetGrid.prototype.closeWindow=DbNetGrid_closeWindow;DbNetGrid.prototype.columnDefined=DbNetGrid_columnDefined;DbNetGrid.prototype.columnInList=DbNetGrid_columnInList;DbNetGrid.prototype.columnsSelected=DbNetGrid_columnsSelected;DbNetGrid.prototype.configureFilters=DbNetGrid_configureFilters;DbNetGrid.prototype.configureFixedHeader=DbNetGrid_configureFixedHeader;DbNetGrid.prototype.configureToolBar=DbNetGrid_configureToolBar;DbNetGrid.prototype.copyGridToClipboard=DbNetGrid_copyGridToClipboard;DbNetGrid.prototype.copyProperties=DbNetGrid_copyProperties;DbNetGrid.prototype.createSimpleSearch=DbNetGrid_createSimpleSearch;DbNetGrid.prototype.createToolbar=DbNetGrid_createToolbar;DbNetGrid.prototype.dBColumnName=DbNetGrid_dBColumnName;DbNetGrid.prototype.invalidContextColumn=DbNetGrid_invalidContextColumn;DbNetGrid.prototype.displayGrid=DbNetGrid_displayGrid;DbNetGrid.prototype.doSearch=DbNetGrid_applySearchCriteria;DbNetGrid.prototype.enhancedSaveGrid=DbNetGrid_enhancedSaveGrid;DbNetGrid.prototype.exportGrid=DbNetGrid_exportGrid;DbNetGrid.prototype.forceFilterRefresh=DbNetGrid_forceFilterRefresh;DbNetGrid.prototype.getColumnName=DbNetGrid_getColumnName;DbNetGrid.prototype.getRowAttribute=DbNetGrid_getRowAttribute;DbNetGrid.prototype.getFilterWhereClause=DbNetGrid_getFilterWhereClause;DbNetGrid.prototype.getPoint=DbNetGrid_getPoint;DbNetGrid.prototype.getSelectOptions=DbNetGrid_getSelectOptions;DbNetGrid.prototype.getText=DbNetGrid_getText;DbNetGrid.prototype.headingDrag=DbNetGrid_headingDrag;DbNetGrid.prototype.headingDragEnd=DbNetGrid_headingDragEnd;DbNetGrid.prototype.headingDragLeave=DbNetGrid_headingDragLeave;DbNetGrid.prototype.headingDragOver=DbNetGrid_headingDragOver;DbNetGrid.prototype.headingDragStart=DbNetGrid_headingDragStart;DbNetGrid.prototype.headingDrop=DbNetGrid_headingDrop;DbNetGrid.prototype.headingMouseDown=DbNetGrid_headingMouseDown;DbNetGrid.prototype.highlightRow=DbNetGrid_highlightRow;DbNetGrid.prototype.initialiseProperties=DbNetGrid_initialiseProperties;DbNetGrid.prototype.linkedEditForm=DbNetGrid_linkedEditForm;DbNetGrid.prototype.loadNestedGrid=DbNetGrid_loadNestedGrid;DbNetGrid.prototype.loadSelectOptions=DbNetGrid_loadSelectOptions;DbNetGrid.prototype.lookupObject=DbNetGrid_lookupObject;DbNetGrid.prototype.makeButton=DbNetGrid_makeButton;DbNetGrid.prototype.makeHiddenIframe=DbNetGrid_makeHiddenIframe;DbNetGrid.prototype.modifySelectedColumns=DbNetGrid_modifySelectedColumns;DbNetGrid.prototype.openCloseLeaf=DbNetGrid_openCloseLeaf;DbNetGrid.prototype.orderByFromSortColumns=DbNetGrid_orderByFromSortColumns;DbNetGrid.prototype.populatedDetailGrid=DbNetGrid_populatedDetailGrid;DbNetGrid.prototype.processDocument=DbNetGrid_processDocument;DbNetGrid.prototype.propercase=DbNetGrid_propercase;DbNetGrid.prototype.qualifyColumnName=DbNetGrid_qualifyColumnName;DbNetGrid.prototype.qualifyColumnNames=DbNetGrid_qualifyColumnNames;DbNetGrid.prototype.qualifyEditFields=DbNetGrid_qualifyEditFields;DbNetGrid.prototype.qualifyingValue=DbNetGrid_qualifyingValue;DbNetGrid.prototype.qualifySearchFields=DbNetGrid_qualifySearchFields;DbNetGrid.prototype.qualifySelectPart=DbNetGrid_qualifySelectPart;DbNetGrid.prototype.reorder=DbNetGrid_reorder;DbNetGrid.prototype.resetTotalColumns=DbNetGrid_resetTotalColumns;DbNetGrid.prototype.runCharting=DbNetGrid_runCharting;DbNetGrid.prototype.runMailMerge=DbNetGrid_runMailMerge;DbNetGrid.prototype.saveGrid=DbNetGrid_saveGrid;DbNetGrid.prototype.searchAction=DbNetGrid_applySearchCriteria;DbNetGrid.prototype.selectableRow=DbNetGrid_selectableRow;DbNetGrid.prototype.selectColumns=DbNetGrid_selectColumns;DbNetGrid.prototype.selectPage=DbNetGrid_selectPage;DbNetGrid.prototype.selectRow=DbNetGrid_selectRow;DbNetGrid.prototype.sendRequest=DbNetGrid_sendRequest;DbNetGrid.prototype.serialiseColumnFormat=DbNetGrid_serialiseColumnFormat;DbNetGrid.prototype.setColProp=DbNetGrid_setColProp;DbNetGrid.prototype.showConfigWindow=DbNetGrid_showConfigWindow;DbNetGrid.prototype.showEditWindow=DbNetGrid_showEditWindow;DbNetGrid.prototype.showImageWindow=DbNetGrid_showImageWindow;DbNetGrid.prototype.showHelpWindow=DbNetGrid_showHelpWindow;DbNetGrid.prototype.showSearchWindow=DbNetGrid_showSearchWindow;DbNetGrid.prototype.showTraceWindow=DbNetGrid_showTraceWindow;DbNetGrid.prototype.showViewWindow=DbNetGrid_showViewWindow;DbNetGrid.prototype.outputPage=DbNetGrid_outputPage;DbNetGrid.prototype.setHeadingProperty=DbNetGrid_setHeadingProperty;DbNetGrid.prototype.setRowStyle=DbNetGrid_setRowStyle;DbNetGrid.prototype.setTableProperty=DbNetGrid_setTableProperty;DbNetGrid.prototype.sortColumnsSelected=DbNetGrid_sortColumnsSelected;DbNetGrid.prototype.sortData=DbNetGrid_sortData;DbNetGrid.prototype.toolbarDragLeave=DbNetGrid_toolbarDragLeave;DbNetGrid.prototype.toolbarDragOver=DbNetGrid_toolbarDragOver;DbNetGrid.prototype.toolbarDrop=DbNetGrid_toolbarDrop;DbNetGrid.prototype.transposeColumns=DbNetGrid_transposeColumns;DbNetGrid.prototype.unappliedEdit=DbNetGrid_unappliedEdit;DbNetGrid.prototype.unhighlightRow=DbNetGrid_unhighlightRow;DbNetGrid.prototype.updateCurrentRow=DbNetGrid_updateCurrentRow;DbNetGrid.prototype.updateEditWindow=DbNetGrid_updateEditWindow;DbNetGrid.prototype.updateHeaderScroll=DbNetGrid_updateHeaderScroll;DbNetGrid.prototype.updateImageWindow=DbNetGrid_updateImageWindow;DbNetGrid.prototype.updateViewWindow=DbNetGrid_updateViewWindow;DbNetGrid.prototype.updateWindow=DbNetGrid_updateWindow;DbNetGrid.prototype.onAfterUpload=null;DbNetGrid.prototype.onBeforeGridCopy=null;DbNetGrid.prototype.onBeforeGridPrint=null;DbNetGrid.prototype.onBeforeGridSave=null;DbNetGrid.prototype.onBeforePageLoaded=null;DbNetGrid.prototype.onBeforeUpload=null;DbNetGrid.prototype.onBeforeViewPrint=null;DbNetGrid.prototype.onChildGridAdded=null;DbNetGrid.prototype.onColumnSort=null;DbNetGrid.prototype.onColumnSelection=null;DbNetGrid.prototype.onDeleteApply=null;DbNetGrid.prototype.onDeleteError=null;DbNetGrid.prototype.onDoubleClick=null;DbNetGrid.prototype.onEditApply=null;DbNetGrid.prototype.onEditDialogClosed=null;DbNetGrid.prototype.onEditError=null;DbNetGrid.prototype.onEmptyGrid=null;DbNetGrid.prototype.onGridCopy=null;DbNetGrid.prototype.onGridPrint=null;DbNetGrid.prototype.onGridSave=null;DbNetGrid.prototype.onNestedColumnSort=null;DbNetGrid.prototype.onPageLoaded=null;DbNetGrid.prototype.onPageLoadedDbNetEdit=null;DbNetGrid.prototype.onRowSelected=null;DbNetGrid.prototype.onRowSelectedDbNetEdit=null;DbNetGrid.prototype.onRowUpdated=null;DbNetGrid.prototype.onSearchDialogClosed=null;DbNetGrid.prototype.onServerError=null;DbNetGrid.prototype.onViewDialogClosed=null;DbNetGrid.prototype.onViewPrint=null;function DbNetGrid(id)
{var e=id
initialiseComponent(this);switch(typeof(id))
{case"string":e=$(e);break;}
if(!e)
{this.checkDOM(id);return;}
this.initialiseStyleSheet();this.container=e;this.id=e.id;if(this.container.getAttribute("toolButtonStyle"))
this.toolButtonStyle=this.container.getAttribute("toolButtonStyle");window.DbNetGridArray[this.id]=this;this.initialiseProperties();this.text=new Object();var cacheImages=["expand","collapse","loading"];for(var i=0;i<cacheImages.length;i++)
{var img=new Image();img.src=this.virtualDir+"images/"+cacheImages[i]+".gif";this.imageCache[this.imageCache.length]=img;}
this.XmlData=this.createXmlDocument();this.saveOptions=this.saveOptions.split(",");this.userSortSequence=false;this.openingEditDialog=false;this.printType="";this.saveType="";this.copyType="";this.columnOffset=-1;this.createToolbar();}
function DbNetGrid_initialiseProperties()
{if(this.propertyTypes==null)
this.propertyTypes=new Object();for(p in this)
{var pType
if(this.propertyTypes[p])
pType=this.propertyTypes[p];else
pType=this[p];if(typeof(pType)=="string")
switch(pType)
{case"array":this[p]=new Array();this.propertyTypes[p]=pType;break;case"object":this[p]=new Object();this.propertyTypes[p]=pType;break;}}
this.primaryKeyColumn="";this.orderColumn="1";if(!eval(this.smallButtons))
this.toolButtonStyle="vertical";this.profileKey=window.location.pathname.replace(/\W/g,"_")+"_"+this.id}
function DbNetGrid_loadData(rowIdx,addedRecordId)
{if(!this.checkSql())
return;if(!this.evaluate(this.fireCustomEvent(this.onBeforePageLoaded,this)))
return;if(this.asyncLoad&&!rowIdx&&!addedRecordId)
{this.gridElement("listTable").innerHTML="<img src=\""+this.virtualDir+"/images/loading.gif\"></img>";this.callbackFunction=this.displayGrid;}
this.nestedChild=(typeof(this.onChildGridAdded)=="function"||typeof(this.onChildGridAdded)=="string");var xml="";if(addedRecordId&&this.positionOnInsertedRecord)
xml=this.createXmlNode("addedRecordId",addedRecordId);if(!this.sendRequest('data',xml)||this.callbackFunction)
return;this.displayGrid(rowIdx,addedRecordId);}
function DbNetGrid_displayGrid(rowIdx,addedRecordId)
{this.callbackFunction=null;if(this.isEncrypted(this.selectPart[0]))
this.columnNames=this.getNodeValue('columns').split(",");else
this.columnNames=this.getNodeValue('columns').toLowerCase().split(",");this.gridElement('listTable').innerHTML=this.getNodeValue("html");this.table=this.gridElement('dbNetGridTable');this.headingRow=getElementById(this.table,"headingRow");if(!this.textLoaded)
{this.culture=new cultureInfo(this);this.DBMSName=this.getNodeValue("DBMSName");this.dateQueryStringFormat=this.getNodeValue("dateQueryStringFormat");this.dateQueryFunction=this.getNodeValue("dateQueryFunction");this.assignText();this.assignToolbarText();if(this.totalFinalLabel=="")
this.totalFinalLabel=this.getText("totalFinalLabel");if(this.profileSelect)
this.profileCombo=this.toolbarElement("profileSelect");if(this.profileCombo)
if(this.profileCombo.onchange==null)
this.profileCombo.onchange=this.assignHandler("selectProfile");}
this.sql=this.getNodeValue('sql');this.columnOffset=-1;if(this.primaryKeyColumnType=='')
this.primaryKeyColumnType=this.getNodeValue('primaryKeyColumnType');if(this.primaryKeyColumn==''&&this.fromPart.split(',').length==1&&this.fromPart.split(' join ').length==1)
this.primaryKeyColumn=this.qualifyColumnName(this.getNodeValue('primaryKeyColumn'));if(this.procedure!='')
{this.search=(this.searchFields.length>0);this.sort=(this.sortColumns.length>0||this.onNestedColumnSort!=null);}
if(parseInt(this.getNodeValue('rowCount'))==0)
{for(var i=0;i<this.detailGridArray.length;i++)
this.detailGridArray[i][0].clearRows();}
if(this.selectPart.length==0)
{this.selectPart=this.getNodeValue('columns').split(',');this.qualifySelectPart();}
if(this.headings.length==0)
this.headings=this.getNodeValue('headings').split(',');if(this.initialGridColumns=="")
{this.initialGridColumns=this.selectPart;this.initialGridHeadings=this.headings;}
var colArrays=["print","copy","save","datasource"];for(var i=0;i<colArrays.length;i++)
this.qualifyColumnNames(this[colArrays[i]+"Columns"]);var deferredHeaders=false;if(this.gridHeight>0)
{this.gridElement('listTable').style.width=this.table.offsetWidth;if(this.gridHeight<=this.gridElement('listTable').offsetHeight||this.nestedChild)
{__dbnetgrid=this;window.setTimeout("__dbnetgrid.configureFixedHeader()",1);deferredHeaders=true;this.gridElement('listTable').style.overflowY="scroll";}
this.gridElement('listTable').style.height=this.gridHeight;}
if(this.gridWidth>0)
{this.gridElement('headingContainer').style.width=this.gridWidth-17;this.gridElement('listTable').style.width=this.gridWidth;this.gridElement('listTable').style.overflowX="scroll";}
var rows=this.table.rows;var cellCount=this.headingRow.cells.length;if(!deferredHeaders)
this.assignEventsToColumnHeadings(this.headingRow)
this.applyGridProperties(rows,'display');this.rowCount=parseInt(this.getNodeValue('rowCount'));this.configureToolBar(this.getNodeValue('pageCount'));if(!this.isIE)
try
{java.lang.Thread.sleep(1);}
catch(e){}
if(addedRecordId&&this.positionOnInsertedRecord)
{this.pageNumber=parseInt(this.getNodeValue('pageNumber'));for(var r=0;r<rows.length;r++)
if(rows[r].id==addedRecordId)
rowIdx=r;}
if(this.rowCount>0)
{if(!rowIdx)
rowIdx=this.firstDataRowIndex;else if(rowIdx>this.table.rows.length-1)
rowIdx=this.table.rows.length-1;this.selectRow(null,rowIdx);}
if(this.nestedChild)
this.assignTreeSelect();if(!this.textLoaded)
{this.transposeColumns("edit");this.transposeColumns("search");this.transposeColumns("view");this.transposeColumns("sort");this.createSimpleSearch();}
this.assignFilters();this.configureFilters();if(!this.textLoaded)
{this.loadProfileCombo();}
this.fireCustomEvent(this.onPageLoaded,this);this.fireCustomEvent(this.onPageLoadedDbNetEdit,this);this.textLoaded=true;if(this.linkedEditForm()&&this.rowCount==0)
this.dbNetEdit.disable();}
function DbNetGrid_createToolbar()
{var html=new Array();html[html.length]="<table id=toolbar class=dbnetgridToolbar cellpadding=0 cellspacing=0><tr>";html[html.length]="<td id=searchCell>"+this.makeButton('search')+"&nbsp;</td>";html[html.length]="<td id=viewCell>"+this.makeButton('view')+"&nbsp;</td>";html[html.length]="<td id=updateRowCell>"+this.makeButton('updateRow')+"</td>";html[html.length]="<td id=insertRowCell>"+this.makeButton('insertRow')+"</td>";html[html.length]="<td id=deleteRowCell>"+this.makeButton('deleteRow')+"</td>";var s="";for(var i=0;i<this.navButtons.length;i++)
{s+="<td id="+this.navButtons[i]+"Cell>"+this.makeButton(this.navButtons[i])+"</td>";if(i==1)
{s+="<td id=pageInfoCell>";s+="<table cellpadding=0 cellspacing=0><tr>";s+="<td id=pageText></td>";s+="<td><select class=dbnetgrid id=pageNumber></select></td>";s+="<td id=ofText></td>";s+="<td><input class=dbnetgrid id=pageCount readonly type=text size=1></input></td>";s+="</tr></table>";s+="</td>";}}
html[html.length]=this.assignToolbarControl(s,"navigation");html[html.length]="<td id=rowInfoCell>";html[html.length]="<table cellpadding=0 cellspacing=0><tr>";html[html.length]="<td id=rowsText></td>";html[html.length]="<td><input class=dbnetgrid id=rowCount readonly type=text size=2></input></td>";html[html.length]="</tr></table>";html[html.length]="</td>";s="";s+="<td id=saveCell>";s+="<table cellpadding=0 cellspacing=0><tr>";s+="<td>&nbsp;"+this.makeButton('save')+"</td>";s+="<td><select class=dbnetgrid id=saveFormat></select></td>";s+="</tr></table>";s+="</td>";s+="<td id=printCell>"+this.makeButton('print')+"</td>";s+="<td id=copyCell>"+this.makeButton('copy')+"&nbsp;</td>";s+="<td id=outputModeCell style='display:none'>";s+="<table cellpadding=0 cellspacing=0><tr>";s+="<td id=outputModeText></td>";s+="<td><input type=checkbox id=outputCurrentPageOnlyCb></input></td>";s+="</tr></table>";s+="</td>";html[html.length]=this.assignToolbarControl(s,"output");html[html.length]="<td id=columnPickerCell>"+this.makeButton('columnPicker')+"&nbsp;</td>";html[html.length]="<td id=profileSelectCell><select id=\"profileSelect\"></select></td>";html[html.length]="<td id=profileCell>"+this.makeButton('profile')+"&nbsp;</td>";html[html.length]="<td id=sortCell>"+this.makeButton('sort')+"&nbsp;</td>";html[html.length]="<td id=helpCell>"+this.makeButton('help')+"&nbsp;</td>";html[html.length]="<td id=configCell>"+this.makeButton('config')+"&nbsp;</td>";html[html.length]="<td id=traceCell>"+this.makeButton('trace')+"&nbsp;</td>";html[html.length]="<td id=mailMergeCell>"+this.makeButton('mailMerge')+"&nbsp;</td>";html[html.length]="<td id=chartCell>"+this.makeButton('chart')+"&nbsp;</td>";html[html.length]="</tr></table>";if(window.document.getElementById(this.id+".toolbar"))
{window.document.getElementById(this.id+".toolbar").innerHTML=html.join("");html="";}
else
html="<div id=\""+this.id+".toolbar\" style=\"display:none\">"+html.join("")+"</div>";html+="<table id=\""+this.id+".filterTable\" style='display:none'></table>";html+="<div id=headingContainer style=\"overflow:hidden\"><table class=dbnetgrid id=dbNetGridHeadingTable border=1></table></div>";html+="<div id=listTable></div>";html+="<div id=dragIcon class=dbnetgidDragHeading style=\"display:none;\">";html+="<table cellpadding=0 cellspacing=0><tr><td id=textCell></td></tr></table></div>";html+="<img id=insertionPoint style='position:absolute;display:none;' src='"+this.virtualDir+"images/insertion_point.gif'></img>";this.container.innerHTML=html;this.gridContainer=this.gridElement("listTable");this.makeHiddenIframe("dbNetGrid__Export__Frame","export");this.makeHiddenIframe("dbNetGrid__Printer__Frame","printer");this.toolbar=document.getElementById(this.id+'.toolbar');this.filterTable=document.getElementById(this.id+'.filterTable');this.toolbarElement("pageNumber").onchange=this.assignHandler("selectPage");this.toolbarElement("search").onclick=this.assignHandler("showSearchWindow");this.toolbarElement("view").onclick=this.assignHandler("showViewWindow");this.toolbarElement("config").onclick=this.assignHandler("showConfigWindow");this.toolbarElement("trace").onclick=this.assignHandler("showTraceWindow");this.toolbarElement("updateRow").onclick=this.assignHandler("updateRecord");this.toolbarElement("insertRow").onclick=this.assignHandler("insertRecord");this.toolbarElement("deleteRow").onclick=this.assignHandler("deleteRecord");this.toolbarElement("first").onclick=this.assignHandler("selectPage");this.toolbarElement("last").onclick=this.assignHandler("selectPage");this.toolbarElement("next").onclick=this.assignHandler("selectPage");this.toolbarElement("prev").onclick=this.assignHandler("selectPage");this.toolbarElement("save").onclick=this.assignHandler("saveGrid");this.toolbarElement("copy").onclick=this.assignHandler("copyGrid");this.toolbarElement("print").onclick=this.assignHandler("printGrid");this.toolbarElement("help").onclick=this.assignHandler("showHelpWindow");this.toolbarElement("columnPicker").onclick=this.assignHandler("selectColumns");this.toolbarElement("profile").onclick=this.assignHandler("userProfileDialog");this.toolbarElement("profileSelect").onchange=this.assignHandler("selectProfile");this.toolbarElement("sort").onclick=this.assignHandler("sortData");this.toolbarElement("mailMerge").onclick=this.assignHandler("runMailMerge");this.toolbarElement("chart").onclick=this.assignHandler("runCharting");if(this.isIE)
{this.toolbar.ondrop=this.assignHandler("toolbarDrop");this.toolbar.ondragover=this.assignHandler("toolbarDragOver");this.ondragleave=this.assignHandler("toolbarDragLeave");}}
function DbNetGrid_assignToolbarControl(html,id)
{var e=window.document.getElementById(this.id+"."+id);if(e)
{this[id+"Control"]=e;this[id+"Control"].innerHTML="<table><tr>"+html+"</tr></table>";html="";}
return html;}
function DbNetGrid_assignToolbarText()
{var a=["page","of","rows","outputMode"];for(var i=0;i<a.length;i++)
this.toolbarElement(a[i]+"Text").innerHTML="&nbsp;"+this.text[a[i]]+"&nbsp;";var optionText="<select class=dbnetgrid id=saveFormat>";if(typeof(this.saveOptions)=="string")
this.saveOptions=this.saveOptions.split(",");for(var i=0;i<this.saveOptions.length;i++)
optionText+="<option value='"+this.saveOptions[i].toLowerCase()+"'>"+this.saveOptions[i];this.toolbarElement("saveFormat").outerHTML=optionText+"</select>";for(var i=0;i<this.buttons.length;i++)
{var btn=this.toolbarElement(this.buttons[i]);btn.title=this.text[this.buttons[i].replace(/Btn/,'')+'Title'];if(this.toolButtonStyle=="image")
continue;var btnText=this.getText(btn.id.replace(/Btn/,'')+'Text');getElementById(btn,"buttonText").innerHTML=btnText;var key=btnText.toLowerCase().match(/<u>(.*)<\/u>/);if(key)
btn.accessKey=key[1];}}
function DbNetGrid_checkSql()
{var retVal=true;if(this.procedure!='')
return true;if(this.fromPart=='')
{alert("fromPart property has not been specified");return false;}
var tbc=this.totalBreakColumns;if(tbc.length>0)
{if(this.orderColumn=="1")
this.orderColumn="";var cn=" as dbnetgrid_total_break_";if(this.dataOnlyColumns.join("").indexOf(cn)==-1)
for(var i=0;i<tbc.length;i++)
this.dataOnlyColumns=this.dataOnlyColumns.concat(tbc[i]+cn+i)
for(var i=0;i<this.columnLookups.length;i++)
{for(var j=0;j<this.selectPart.length;j++)
{if(this.getColumnName(this.selectPart[j]).toLowerCase()==this.getColumnName(this.columnLookups[i].column).toLowerCase())
break;if(j==this.selectPart.length-1)
{for(var k=0;k<this.totalBreakColumns.length;k++)
if(this.getColumnName(this.totalBreakColumns[k]).toLowerCase()==this.getColumnName(this.columnLookups[i].column).toLowerCase())
{this.columnLookups[i].column="dbnetgrid_total_break_"+k.toString();break;}}}}}
else
{this.orderColumn=this.qualifyColumnName(this.orderColumn);}
this.qualifySelectPart();if(this.deferredColumns.length>0&&this.hiddenGridColumns.length==0)
{this.hiddenGridColumns=this.deferredColumns;this.hiddenGridHeadings=this.deferredHeadings;}
if(this.hiddenGridColumns.length>0)
{this.columnPicker=true;this.qualifyColumnNames(this.hiddenGridColumns);this.buildInitialGridColumns();}
return retVal;}
function DbNetGrid_sendRequest(mode,xml)
{if(typeof(xml)=='undefined')
xml="";xml+=this.serialise("headings");xml+=this.serialise("selectPart");xml+=this.serialise("sql");xml+=this.serialiseColumnFormat();xml+=this.serialise("columnLookups");xml+=this.serialise("imageLookups");xml+=this.createXmlNode("nestedChild",this.nestedChild);if(this.orderColumn==""&&this.selectPart.length>1&&this.totalBreakColumns.length==0)
this.orderColumn=this.selectPart[0];if((!this.pageInfo&&!this.buttonNavigation)||!this.displayToolbar)
this.pageSize=999999;if(this.procedure!="")
xml+=this.serialise("procedureParameters","queryParameters");else
xml+=this.serialise("queryParameters");xml+="<sortSequence>";if(this.useSortSequence)
xml+=this.orderByFromSortColumns();else if(this.orderColumn.indexOf(',')>-1)
xml+=this.orderColumn;xml+="</sortSequence>";xml+=this.serialise("dataOnlyColumns");xml+=this.serialise("textLoaded");if(this.dng_lang!="")
{this.language=this.dng_lang;this.dng_lang="";}
xml+=this.serialise("language");xml+=this.serialise("simpleSearchToken");switch(mode)
{case"print":case"copy":case"export":xml+=this.serialise(mode+"TemplatePath");xml+=this.serialise(mode+"PageSize");xml+=this.serialise("rowCount");xml+=this.serialise("htmlFormat");xml+=this.createXmlNode("format",this.toolbarElement("saveFormat").value);xml+=this.serialise("outputTemplateParameters");break;case"data":if(this.filterTable.rows.length==0)
xml+=this.serialise("filterColumns");break;}
return this.callService(xml,mode);}
function DbNetGrid_serialiseColumnFormat()
{var xml="";for(var c in this.columnProperties)
for(var p in this.columnProperties[c])
if(p=="format")
xml+=this.createXmlNode("item",this.columnProperties[c][p][0][0],{"name":c})
return"<columnFormat>"+xml+"</columnFormat>";}
function DbNetGrid_qualifyColumnName(columnName)
{return columnName;}
function DbNetGrid_qualifySelectPart()
{this.qualifyColumnNames(this.selectPart);}
function DbNetGrid_qualifyEditFields()
{this.qualifyColumnNames(this.editFields);}
function DbNetGrid_qualifySearchFields()
{this.qualifyColumnNames(this.searchFields);}
function DbNetGrid_qualifyColumnNames(columns)
{for(var i=0;i<columns.length;i++)
columns[i]=this.qualifyColumnName(columns[i]);}
function DbNetGrid_assignText()
{var nodeList=this.getNode("text").childNodes[0].childNodes;for(var i=0;i<nodeList.length;i++)
this.text[nodeList[i].nodeName]=textFromNode(nodeList[i]);}
function DbNetGrid_makeButton(id,img,text,style)
{var html=this.buttonContent(id,img,text,style);return'<button class=dbnetgridToolButton type="button" id='+id+'>'+html+'</button>';}
function DbNetGrid_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>";if(style!="text")
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 DbNetGrid_addToolbarButton(img,text,index,style,handler)
{var cell=this.toolbarElement("toolbar").rows[0].insertCell(index);cell.innerHTML=this.makeButton(null,img,text,style);var btn=cell.childNodes[0];if(handler)
btn.onclick=dbNetLink.assignHandler(handler);return btn;}
function DbNetGrid_gridElement(id,c)
{if(!c)
c=this.container;var e=getElementById(c,id);if(e)
{if(e.length)
return e[0];else
return e;}
else
{alert("Grid element ["+id+"] not found");}}
function DbNetGrid_selectPage(event)
{var e=event.srcElement;if(this.unappliedEdit())
{if(e.id=='pageNumber')
this.toolbarElement("pageNumber").value=this.pageNumber;return;}
switch(e.id)
{case'pageNumber':this.pageNumber=this.toolbarElement("pageNumber").value;break;case'first':this.pageNumber=1;break;case'next':this.pageNumber=parseInt(this.pageNumber)+1;break;case'prev':this.pageNumber=parseInt(this.pageNumber)-1;break;case'last':this.pageNumber=this.toolbarElement("pageCount").value;break;}
this.loadData();}
function DbNetGrid_updateRecord()
{if(this.linkedEditForm())
return;this.showEditWindow(false);}
function DbNetGrid_insertRecord()
{if(this.linkedEditForm())
{this.dbNetEdit.insertRecord();return;}
this.showEditWindow(true);}
function DbNetGrid_showEditWindow(newRecord)
{if(this.primaryKeyColumn=='')
return;var primaryKeyValue='';if(!newRecord)
primaryKeyValue=this.currentRow.id;if(this.columnDefined(this.foreignKeyColumn))
{this.setEditColumnProperty(this.foreignKeyColumn,'initialValue:'+this.foreignKeyValue);this.setEditColumnProperty(this.foreignKeyColumn,'editReadOnly:true');}
if(this.openingEditDialog)
return;if(windowOpen(this.editWindow))
{if(primaryKeyValue=='')
{if(typeof(this.editWindow.insert)=='undefined')
{this.dbNetEdit.insertRecord();return;}
this.editWindow.insert();}
this.editWindow.focus();return;}
this.openingEditDialog=true;var o=new Object();if(!this.setDialogColumns(o,this.editFields,this.editLabels,"edit"))
return;o.component=this;o.parentWindow=window;o.primaryKeyValue=primaryKeyValue;o.dbNetSpellVirtualDir=this.dbNetSpellVirtualDir;var url=(this.customEditDialog=='')?this.virtualDir+'edit_window.htm':this.customEditDialog;this.editWindow=this.openNonModalDialog(url,"edit_window",o);if(this.customEditDialog!='')
this.openingEditDialog=false;}
function DbNetGrid_showSearchWindow()
{if(windowOpen(this.searchWindow))
{this.searchWindow.focus();return;}
var o=new Object();o.connectionString=this.connectionString;if(!this.setDialogColumns(o,this.searchFields,this.searchLabels,"search"))
return;o.component=this;o.composite=false;o.content=this.searchDialogContent;o.parentWindow=window;var winName='search_window';switch(this.searchType)
{case'composite':o.composite=true;winName='composite_search_window';break;case'simple':winName='simple_search_window';break;}
this.searchWindow=this.openNonModalDialog(this.virtualDir+'common/'+winName+'.htm',winName,o);}
function DbNetGrid_showViewWindow()
{if(this.primaryKeyColumn=='')
return;if(windowOpen(this.viewWindow))
{this.viewWindow.focus();return;}
var o=new Object();o.primaryKeyValue=this.currentRow.id;o.parentWindow=window;if(!this.setDialogColumns(o,this.viewFields,this.viewLabels,"view"))
return;o.component=this;this.viewWindow=this.openNonModalDialog(this.virtualDir+'view_window.htm',"view_window",o);}
function DbNetGrid_showImageWindow(event)
{var id=event.srcElement.parentNode.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 DbNetGrid_updateImageWindow()
{for(var id in this.imageWindow)
{var w=this.imageWindow[id];if(windowOpen(w))
{var src=this.currentRow.cells[this.columnIndex(id)].childNodes[0].src;w.updateImage(src);w.focus();}}}
function DbNetGrid_showConfigWindow()
{var o=new Object();o.grid=this;this.openModalDialog(this.virtualDir+'config.htm','config',o);}
function DbNetGrid_showTraceWindow()
{if(windowOpen(this.traceWindow))
{this.traceWindow.focus();return;}
var o=new Object();o.caller=this;this.traceWindow=window.showModelessDialog(this.virtualDir+"trace.htm",o,'status=yes;help=no;resizable=yes');}
function DbNetGrid_deleteRecord()
{var validated;if(this.primaryKeyColumn==''||!this.deleteRow)
{return;}
if(this.deleteValidation!='')
{this.message="";this.msg="";if(typeof(eval('window.'+this.deleteValidation))=='undefined')
this.message="Delete validation function '"+this.deleteValidation+"()' not found";else
{this.message='Cannot delete this record';if(eval('validated = window.'+this.deleteValidation+'(this)'))
this.message="";}
if(this.msg!="")
this.message=this.msg;if(this.message!="")
{alert(this.message);return;}
else if(typeof(validated)=='boolean')
if(!validated)
return;}
if(eval(this.confirmDeletion))
if(confirm(this.text['confirmDelete'])==false)
return;var xml="";if(this.primaryKeyColumnForDeletion!='')
xml+=this.createXmlNode("primarykey",this.currentRow.id,{"name":this.primaryKeyColumnForDeletion})
else
xml+=this.createXmlNode("primarykey",this.currentRow.id,{"name":this.primaryKeyColumn})
var uploadColumns='';for(var columnName in this.editColumnProperties)
{if(typeof(this.editColumnProperties[columnName]['uploadRootFolder'])!='undefined')
{uploadColumns+='<item><fieldName>'+columnName+'</fieldName><rootFolder>'+this.editColumnProperties[columnName]['uploadRootFolder'][0][0]+'</rootFolder></item>';}}
xml+="<uploadColumns>"+uploadColumns+"</uploadColumns>";xml+=this.serialise('fromPart');if(!this.sendRequest('delete',xml))
return;this.errorMessage=this.getNodeValue("errorMessage");this.errorNumber=this.getNodeValue("errorNumber");if(this.errorMessage!='')
{if(this.deleteError!='')
if(typeof(eval('window.'+this.deleteError))=='undefined')
this.message="Delete error function '"+this.deleteError+"()' not found";else
eval('window.'+this.deleteError+'(this.errorMessage, this.errorNumber)');else
{this.fireCustomEvent(this.onDeleteError,this);if(this.errorMessage!='')
alert(this.errorMessage);}
return;}
this.fireCustomEvent(this.onDeleteApply,this);var rowIdx=this.currentRow.rowIndex;this.loadData(rowIdx);if(this.parentGrid)
this.parentGrid.configureToolBar(this.parentGrid.pageCount);}
function DbNetGrid_reorder(event)
{if(this.table.rows.length==1)
return;var e=event.srcElement;do
{e=e.parentNode;if(!e)
return;}
while((e.tagName!='TD')||(e.className!='headingCell'))
this.orderSequence="asc";var img=getElementById(e,"sortSequenceImg");try
{var cn=this.getColumnName(this.selectPart[parseInt(e.getAttribute("columnOrdinal"))-1]);for(var k in this.totalBreakInfo)
if(this.totalBreakInfo[k].column==cn)
return;}
catch(e){};if(img)
this.orderSequence=(img.src.indexOf("asc.gif")>-1)?"desc":"asc";else
this.orderColumn=e.getAttribute("columnOrdinal");this.useSortSequence=false;this.fireCustomEvent(this.onColumnSort,this);if(this.procedure=="")
this.loadData();}
function DbNetGrid_applyGridProperties(rows,source,rowIndex)
{var table=rows[0].parentNode.parentNode;for(var p in this.tableProperties)
{try
{table.style[p]=this.tableProperties[p];}
catch(e){}}
var selectPart=this.columnNames;if(this.isEncrypted(this.selectPart[0]))
for(var j=0;j<selectPart.length;j++)
selectPart[j]=this.encrypt(selectPart[j]);if(source)
if(dbNetLink.testArray(this[source+"Columns"]))
if(this[source+"Columns"].length>0)
selectPart=this[source+"Columns"];var cellCount=rows[0].cells.length;for(var i=0;i<cellCount;i++)
{var cell=rows[0].cells[i];for(var p in this.headingProperties)
{try
{cell.childNodes[0].rows[0].cells[0].style[p]=this.headingProperties[p];}
catch(e){}}}
if(this.procedure!='')
for(i in this.columnProperties)
{if(!isNaN(i))
this.columnProperties[this.selectPart[parseInt(i)]]=this.columnProperties[i];}
for(j=0;j<selectPart.length;j++)
{var cell=rows[0].cells[j];for(property in this.columnProperties[selectPart[j]])
if(property=='display')
cell.style.display='none';}
var startRow=(rowIndex)?rowIndex:this.firstDataRowIndex;var endRow=(rowIndex)?rowIndex+1:rows.length;for(var i=startRow;i<endRow;i++)
{var row=rows[i];switch(row.className.split(" ")[0])
{case"oddRow":case"evenRow":case"selectedRow":break;case"totalRow":row.onmouseover=this.assignHandler("highlightRow");row.onmouseout=this.assignHandler("unhighlightRow");continue;default:continue;}
if(!rowIndex&&source=="display")
{row.onclick=this.assignHandler("selectRow");row.onmouseover=this.assignHandler("highlightRow");row.onmouseout=this.assignHandler("unhighlightRow");if(this.onDoubleClick==null)
{if(eval(this.updateRow)&&eval(this.editRow))
row.ondblclick=this.toolbarElement("updateRow").onclick;else if(eval(this.view))
row.ondblclick=this.toolbarElement("view").onclick;}
else
{row.ondblclick=dbNetLink.assignHandler(this.onDoubleClick);}
if(this.selectableRow())
row.style.cursor='pointer';}
for(j=0;j<selectPart.length;j++)
{var offset=(this.nestedChild)?1:0;var cell=row.cells[j+offset];var cn=selectPart[j];for(property in this.columnProperties[cn])
{for(propertyValueIndex in this.columnProperties[cn][property])
{var pv=this.columnProperties[cn][property][propertyValueIndex];switch(property)
{case"decimalPlaces":cell.innerHTML=this.formatNumber(cell.innerHTML,pv[0]);break;case"noWrap":cell.style.whiteSpace="nowrap";break;case"modify":if(cell.innerHTML!='')
if(this.qualifyingValue(pv,cell.innerHTML))
cell.innerHTML=pv[0].replace(/{\$}/g,cell.innerHTML);break;case"transform":if(typeof(eval('window.'+pv[0]))!='undefined')
eval('window.'+pv[0]+'(cell, source)');break;case"imagePreview":if(eval(pv[0]))
if(cell.childNodes[0])
cell.childNodes[0].onclick=this.assignHandler("showImageWindow");break;default:applyProperty=this.qualifyingValue(pv,cell.innerHTML);if(applyProperty)
if(typeof(pv[2])!='undefined')
if(pv[2]==true)
row.style[property]=pv[0];else
cell.style[property]=pv[0];else
cell.style[property]=pv[0];}}}}}}
function DbNetGrid_highlightRow(event)
{row=getParentElement(event.srcElement,"tr");if(row.className=="selectedRow")
return;row.setAttribute("originalClassName",row.className);row.className+=" highlight";}
function DbNetGrid_unhighlightRow(event)
{row=getParentElement(event.srcElement,"tr");if(row.className=="selectedRow")
return;row.className=row.getAttribute("originalClassName");}
function DbNetGrid_selectRow(event,rowIdx,changesCancelled)
{if(this.openingEditDialog)
return;if(!this.selectableRow()||this.unappliedEdit(changesCancelled))
return;var row;if(typeof(rowIdx)=="number")
row=this.table.rows[rowIdx];else
row=getParentElement(event.srcElement,"tr");for(var i=0;i<this.table.rows.length;i++)
{var r=this.table.rows[i];if(r.className=='headingRow')
continue;if(r.className.indexOf("selectedRow")>-1)
{r.className=r.getAttribute("originalClassName");break;}}
row.setAttribute("originalClassName",row.className.replace(" highlight",""));row.className="selectedRow";this.currentRow=row;this.childGridLoadCount=0;for(var i=0;i<this.detailGridArray.length;i++)
{var grid=this.detailGridArray[i][0];if(this.currentRow.id==''&&!this.detailGridArray[i][2])
alert(this.text['noPrimaryKey']);else
{grid.foreignKeyValue=this.currentRow.id;var foreignKeyColumn=this.detailGridArray[i][1];if(foreignKeyColumn)
if(foreignKeyColumn!="")
{grid[grid.childFilterType+'Part']=foreignKeyColumn+" = @!@"+foreignKeyColumn;grid.queryParameters[foreignKeyColumn]=this.currentRow.id;}
grid.pageNumber=1;if(this.detailGridArray[i][2])
this.fireCustomEvent(this.detailGridArray[i][2],grid);grid.loadData();}}
this.configureToolBar(this.pageCount);this.updateEditWindow();this.updateViewWindow();this.updateImageWindow();this.srcElement=this.currentRow;this.fireCustomEvent(this.onRowSelected,this);this.fireCustomEvent(this.onRowSelectedDbNetEdit,this);}
function DbNetGrid_configureToolBar(newPageCount)
{this.toolbar.style.display=(this.displayToolbar)?'':'none';if(!this.isIE)
{this.copy=false;this.chart=false;this.mailMerge=false;}
if(this.primaryKeyColumn==""||!this.editRow)
{this.updateRow=false;this.insertRow=false;this.deleteRow=false;}
if(this.primaryKeyColumn=="")
this.view=false;for(var i=0;i<this.buttons.length;i++)
if(typeof(this[this.buttons[i]])=="boolean")
this.toolbarElement(this.buttons[i]).parentNode.style.display=eval(this[this.buttons[i]])?"":"none";for(var i=0;i<this.navButtons.length;i++)
this.toolbarElement(this.navButtons[i]+"Cell").style.display=this.buttonNavigation?"":"none";var a=["rowInfo","pageInfo","save","outputMode","profileSelect"];for(var i=0;i<a.length;i++)
this.toolbarElement(a[i]+"Cell").style.display=this[a[i]]?"":"none";if(this.toolbarElement("pageCount").value!=newPageCount)
{this.toolbarElement("pageCount").value=newPageCount;var html=new Array();for(var i=0;i<newPageCount;i++)
html[i]='<option value='+(i+1)+'>'+(i+1);this.toolbarElement("pageNumber").outerHTML='<select class=dbnetgrid id=pageNumber>'+html.join('')+'</select>';this.toolbarElement("pageNumber").onchange=this.assignHandler("selectPage");}
this.pageCount=parseInt(newPageCount);this.toolbarElement("rowCount").value=this.rowCount;this.toolbarElement("pageNumber").value=this.pageNumber;this.toolbarElement("first").disabled=eval(parseInt(this.pageNumber)<=1);this.toolbarElement("prev").disabled=eval(parseInt(this.pageNumber)<=1);this.toolbarElement("next").disabled=eval(parseInt(this.pageNumber)>=this.pageCount);this.toolbarElement("last").disabled=eval(parseInt(this.pageNumber)==this.pageCount||this.pageCount==0);this.toolbarElement("insertRow").disabled=false;this.toolbarElement("updateRow").disabled=(newPageCount==0);this.toolbarElement("view").disabled=(newPageCount==0);if(eval(this.allowLinkedDeletion))
this.toolbarElement("deleteRow").disabled=false;else
this.toolbarElement("deleteRow").disabled=eval(this.toolbarElement("updateRow").disabled||this.populatedDetailGrid());if(this.toolButtonStyle!="text")
{this.toolbarElement("deleteRowImg").style.filter=this.toolbarElement("deleteRow").disabled?'gray':'';this.toolbarElement("updateRowImg").style.filter=this.toolbarElement("updateRow").disabled?'gray':'';this.toolbarElement("viewImg").style.filter=this.toolbarElement("view").disabled?'gray':'';for(var i=0;i<this.navButtons.length;i++)
{var img=this.toolbarElement(this.navButtons[i]+'Img');var btn=this.toolbarElement(this.navButtons[i]);img.src=this.virtualDir+'images/'+this.navButtons[i]+(btn.disabled?'off':'')+'.gif';}}
this.toolbarElement("outputCurrentPageOnlyCb").checked=eval(this.outputCurrentPageOnly);this.toolbarElement("pageCount").size=this.pageCount.toString().length;this.toolbarElement("rowCount").size=this.toolbarElement("rowCount").value.length;if(newPageCount==0)
{this.closeWindow(this.editWindow);this.closeWindow(this.viewWindow);}}
function DbNetGrid_populatedDetailGrid()
{var retVal=false;for(var i=0;i<this.detailGridArray.length;i++)
if(this.detailGridArray[i][0].table)
if(this.detailGridArray[i][0].rowCount>0)
retVal=true;return retVal;}
function DbNetGrid_closeWindow(win)
{if(windowOpen(win))
win.close();}
function DbNetGrid_unappliedEdit(changesCancelled)
{if(typeof(changesCancelled)=="boolean")
if(changesCancelled)
return false;if(windowOpen(this.editWindow))
if(typeof(this.editControl.checkForChanges)!='undefined')
if(!this.editControl.checkForChanges())
return true;if(this.linkedEditForm())
if(!this.dbNetEdit.checkForChanges())
return true;return false;}
function DbNetGrid_updateEditWindow()
{if(this.linkedEditForm())
{this.dbNetEdit.primaryKeyValue=this.currentRow.id;this.dbNetEdit.retrieve();return;}
this.updateWindow(this.editWindow);}
function DbNetGrid_updateViewWindow()
{this.updateWindow(this.viewWindow);}
function DbNetGrid_updateWindow(win)
{if(this.currentRow.id=='')
return;if(windowOpen(win))
{if(typeof(win.retrieve)=='undefined')
{this.dbNetEdit.primaryKeyValue=this.currentRow.id;this.dbNetEdit.retrieve();return;}
win.focus();win.retrieve(this.currentRow.id);return;}}
function DbNetGrid_toolbarElement(id)
{var e=getElementById(this.toolbar,id);if(!e&&this.navigationControl)
e=getElementById(this.navigationControl,id);if(!e&&this.outputControl)
e=getElementById(this.outputControl,id);return e;}
function DbNetGrid_selectableRow()
{return eval(this.isMethodAssigned(this.onRowSelected)||this.isMethodAssigned(this.onRowSelectedDbNetEdit)||this.detailGridArray.length>0||eval(this.editRow)||this.nestedChild||eval(this.view)||this.dbNetEdit);}
function DbNetGrid_assignFilters()
{if(!this.getNode('filterColumnOptions'))
return;var filterOptions=this.getNode('filterColumnOptions').childNodes;if(filterOptions.length>0)
{this.forceFilterRefresh();var filterRow=this.filterTable.insertRow(-1);filterRow.className="dbnetgridFilterRow";for(var i=0;i<this.headingRow.cells.length;i++)
filterRow.insertCell(-1);var index;var options;for(var i=0;i<filterOptions.length;i++)
{index=this.columnIndex(filterOptions[i].nodeName.replace(/-/g," "));if(index>-1)
{var dataType=this.getDataType(this.headingRow.cells[index].getAttribute("dataType"));switch(dataType)
{case"string":case"numeric":case"boolean":case"date":break;default:continue;}
options=textFromNode(filterOptions[i]).replace('<option value="">','');options="<option value=''>"+options;filterRow.cells[index].innerHTML="<select class=dbnetgridFilter id=dbNetGridFilterSelect filterIndex="+i+" name='"+filterOptions[i].nodeName+"' class=filterSelect>"+options+"</select>";}}}}
function DbNetGrid_configureFilters()
{if(this.filterTable.rows.length==0)
return;var row=this.table.insertRow(1);row.parentNode.replaceChild(this.filterTable.rows[0].cloneNode(true),row);row=this.table.rows[1];var filters=row.getElementsByTagName('SELECT');for(var i=0;i<filters.length;i++)
{if(i<this.filterValues.length)
filters[i].value=this.filterValues[i];filters[i].onchange=this.assignHandler("applyFilter");filters[i].onfocus=this.assignHandler("setFilterFocus");if(this.isIE)
if(this.filterAutocomplete)
filters[i].addBehavior(this.virtualDir+"select.htc");}}
function DbNetGrid_makeHiddenIframe(name,url,win)
{if(!win)
win=window;if(win.frames[name])
return;var f=win.document.createElement("IFRAME");f.setAttribute("src",this.virtualDir+url+".htm");f.setAttribute("id",name);f.setAttribute("name",name);f.style.position="absolute";f.style.height="1px";f.style.width="1px";f.style.top="-100";f.style.left="-100";if(this.isIE)
{if(win.document.readyState=="complete")
win.document.body.appendChild(f);else
win.document.body.childNodes[0].appendChild(f);}
else
win.document.body.appendChild(f);}
function DbNetGrid_saveGrid()
{var saveFormat=this.toolbarElement("saveFormat").value;switch(saveFormat)
{case"xml":case"csv":break;default:if(this.saveType=='enhanced'||this.toolbarElement("outputCurrentPageOnlyCb").checked)
{this.enhancedSaveGrid();return;}
break;}
this.exportGrid();}
function DbNetGrid_exportGrid(html)
{var enhanced=(typeof(html)=="string");var form=window.frames["dbNetGrid__Export__Frame"].document.forms[0];form.action=this.virtualDir+this.server+"?mode="+((enhanced)?"enhancedsave":"save");var xml="";if(enhanced)
{xml+=this.createXmlNode("html",html);}
else
{if(!this.evaluate(this.fireCustomEvent(this["onBeforeGridSave"],this)))
return;xml+=this.serialiseRequiredProperties();if(this.saveColumns.length>0)
{xml+=this.createXmlNode("sql",this.modifySelectedColumns(this.sql,this.saveColumns));xml+=this.createXmlNode("headings",this.saveHeadings);}
else
{xml+=this.serialise("sql");xml+=this.serialise("headings");}
xml+=this.serialise("columnLookups");xml+=this.serialise("imageLookups");xml+=this.serialise("exportTemplatePath");xml+=this.serialise("exportPageSize");xml+=this.serialise("rowCount");xml+=this.serialise("outputTemplateParameters");xml+=this.serialise("language");xml+=this.serialise("selectPart");xml+=this.serialise("outputCurrentPageOnly");xml+=this.serialise("pageNumber");xml+=this.serialise("pageSize");xml+=this.serialiseColumnFormat();if(this.procedure!="")
xml+=this.serialise("procedureParameters","queryParameters");else
xml+=this.serialise("queryParameters");}
var saveFormat=this.toolbarElement("saveFormat").value;xml+=this.createXmlNode("format",saveFormat);xml+=this.serialise("htmlFormat");switch(saveFormat)
{case"word":case"csv":case"excel":xml+=this.createXmlNode("exportFilename",this[saveFormat+"ExportFilename"]);break;}
form["xml"].value=encodeURI(xml).replace(/\+/g,"%2B");form.submit();}
function DbNetGrid_copyGrid(event)
{var mode="Copy";if(typeof(event)=="string")
if(event=="datasource")
mode="Datasource";var frame=this.processDocument(mode);if(!frame)return;this.copyGridToClipboard(mode,frame);}
function DbNetGrid_copyGridToClipboard(mode,frame)
{var textRange=frame.document.body.createTextRange();textRange.execCommand('Copy');if(mode=="Datasource")
return;alert(this.text['clipboardCopy']);}
function DbNetGrid_printGrid(event)
{var frame=this.processDocument("Print");if(!frame)return;if(this.toolbarElement("outputCurrentPageOnlyCb").checked)
return;if(this.printDocument.images.length>0&&this.isIE)
window.setTimeout(this.checkPrintDocumentState,100);else
{frame.focus();frame.print();}}
function DbNetGrid_enhancedSaveGrid()
{var frame=this.processDocument("Save");if(!frame)return;this.exportGrid("<html>"+frame.document.getElementsByTagName("html")[0].innerHTML+"</html>");}
function DbNetGrid_outputPage(mode)
{var frame=window.frames["dbNetGrid__Printer__Frame"];var html=frame.document.getElementsByTagName("html")[0].innerHTML;html=html.replace(/<SCRIP.*\/SCRIPT>/i,"");html=html.replace(/<BODY onload=\"init\(\'\w*\'\)\">/i,"<BODY>");switch(mode)
{case"Print":frame.focus();frame.print();break;case"Save":this.exportGrid("<html>"+html+"</html>");break;case"Copy":this.copyGridToClipboard(mode,frame);break;}}
function DbNetGrid_processDocument(mode)
{var frame=window.frames["dbNetGrid__Printer__Frame"];this[mode.toLowerCase()+"Document"]=frame.document;if(mode!="Datasource")
if(!this.evaluate(this.fireCustomEvent(this["onBeforeGrid"+mode],this)))
return null;frame.document.clear();if(!this.toolbarElement("outputCurrentPageOnlyCb").checked)
{this.getAllRows(mode.toLowerCase());frame.document.write(this.allRows);}
else
{window.currentDbNetGrid=this
var html="<HTML><HEAD>";var css=this.virtualDir+"css/dbnetgrid_export_"+(mode.toLowerCase()=="save"?this.toolbarElement("saveFormat").value:mode.toLowerCase())+".css";this.httpRequest.get(css);html+="<style>"+this.xmlRequest.responseText+"</style>";html+="<scri"+"pt src='"+this.virtualDir+"single_page_output.js'></scr"+"ipt>";html+="</HEAD>";html+="<BODY onload=\"init('"+mode+"')\">"
html+=this.table.outerHTML;html+="</BODY></HTML>";frame.document.write(html);}
frame.document.close();if(mode=="Datasource")
return frame;if(this.toolbarElement("outputCurrentPageOnlyCb").checked)
{this["gridTo"+mode]=frame.document.getElementById("dbNetGridTable");this.fireCustomEvent(this["onGrid"+mode],this);return null;}
var pageSize=(mode.toLowerCase()=="save"?"export":mode.toLowerCase())+"PageSize";if(this[pageSize]!=0)
this["gridTo"+mode]=this.arrayOfElements(frame.document.getElementById("dbNetGridTable"));else
this["gridTo"+mode]=frame.document.getElementById("dbNetGridTable");if(this[mode.toLowerCase()+"Type"]=='enhanced')
if(this[pageSize]!=0)
for(var t=0;t<this["gridTo"+mode].length;t++)
this.applyGridProperties(this["gridTo"+mode][t].rows,mode.toLowerCase());else
this.applyGridProperties(this["gridTo"+mode].rows,mode.toLowerCase());this.fireCustomEvent(this["onGrid"+mode],this);return frame;}
function DbNetGrid_getAllRows(mode)
{var sql=this.sql;var headings=this.headings;if(this[mode+"Columns"].length>0)
{this.sql=this.modifySelectedColumns(this.sql,this[mode+"Columns"]);this.headings=this[mode+"Headings"];}
if(this.parentGrid)
{this.queryParameters=new Object();if(this.foreignKeyColumn!="")
this.queryParameters[this.foreignKeyColumn]=this.parentGrid.currentRow.id;}
var status=this.sendRequest((mode=="save")?"export":mode);this.sql=sql;this.headings=headings;if(status)
this.allRows=this.getNodeValue("html");}
function DbNetGrid_modifySelectedColumns(sql,columnList)
{var orderColumn='';var m=sql.match(/ order by (.*) /);if(m)
{var arr=new Array();var sortColumns=m[1].split(",");for(var i=0;i<sortColumns.length;i++)
{var sortParts=sortColumns[i].split(" ");if(!isNaN(sortParts[0]))
{var orderColumn=this.selectPart[parseInt(sortParts[0])-1];if(sortParts.length>1)
orderColumn+=(" "+sortParts[1]);arr[arr.length]=orderColumn;}}
if(arr.length>0)
sql=sql.replace(/ order by (.*) /," order by "+arr.join(",")+" ");}
var dataCols="";if(this.dataOnlyColumns.length>0)
{var temp=this.dataOnlyColumns;this.qualifyColumnNames(temp);dataCols=','+temp.join(',');}
return sql.replace(/select .* from/,"select "+columnList.join(',')+", '"+this.primaryKeyColumn+"' as dbnetgrid_id "+dataCols+" from");}
function DbNetGrid_checkPrintDocumentState()
{var frame=window.frames["dbNetGrid__Printer__Frame"];if(frame.document.readyState!='complete')
window.setTimeout(this.checkPrintDocumentState,100);else
{frame.focus();frame.print();}}
function DbNetGrid_showHelpWindow()
{if(windowOpen(this.helpWindow))
{this.helpWindow.focus();return;}
this.helpWindow=window.open(this.helpFile,'','status=yes;help=no;resizable=yes;dialogWidth=650px;');}
function DbNetGrid_selectColumns()
{var o=new Object();o.displayedColumns=this.selectPart;o.displayedHeadings=this.headings;o.columns=this.initialGridColumns;o.headings=this.initialGridHeadings;o.component=this;o.callback=this.columnsSelected;this.openModalDialog(this.virtualDir+'columns.htm','columns',o);}
function DbNetGrid_columnsSelected(selection)
{if(selection==null)
return;if(this.orderColumn!='')
if(!isNaN(this.orderColumn))
this.orderColumn=this.selectPart[parseInt(this.orderColumn)-1];this.selectPart=selection.displayedColumns.split('~');this.headings=selection.displayedHeadings.split('~');this.hiddenGridColumns=selection.hiddenColumns.split('~');this.hiddenGridHeadings=selection.hiddenHeadings.split('~');this.buildInitialGridColumns();this.forceFilterRefresh();this.loadData();this.selectedSortColumns=new Array();this.useSortSequence=false;this.fireCustomEvent(this.onColumnSelection,this);}
function DbNetGrid_sortData()
{var o=new Object();if(!this.setDialogColumns(o,this.sortColumns,this.sortLabels,"sort"))
return;o.sortColumns=this.selectedSortColumns;o.sortSequence=this.selectedSortSequence;o.sortHeadings=this.selectedSortLabels;o.columns=o.fields;o.headings=o.labels;o.component=this;o.callback=this.sortColumnsSelected;this.openModalDialog(this.virtualDir+'common/sort.htm','sort',o);}
function DbNetGrid_sortColumnsSelected(selection)
{if(!selection)
return;this.selectedSortColumns=selection.sortColumns.split('~');this.selectedSortSequence=selection.sortSequence.split('~');this.selectedSortLabels=selection.sortHeadings.split('~');this.useSortSequence=true;this.fireCustomEvent(this.onNestedColumnSort,this);if(this.procedure=='')
this.loadData();}
function DbNetGrid_runMailMerge()
{this.copyGrid('datasource');var url=this.virtualDir+"office/mailmerge.hta";url+="?document="+this.mailMergeDocument;url+="&execute="+this.mailMergeExecute;url+="&language="+this.language;window.document.location.href=url;}
function DbNetGrid_runCharting()
{this.copyGrid('datasource');var url=this.virtualDir+"office/chart.hta";url+="?document="+this.chartDocument;url+="&language="+this.language;url+="&plotby="+this.chartPlotBy;window.document.location.href=url;}
function DbNetGrid_headingDragStart(event)
{if(!eval(this.dragAndDrop))
return;var h=window.event.srcElement;if(h.tagName!='TD'||this.selectPart.length==1)
{window.event.returnValue=false;return;}
h=getParentElement(h.parentElement,"TD");var di=this.gridElement('dragIcon');di.innerHTML="<table class=dbnetgrid><tr class=headingRow>"+h.outerHTML+"</tr></table>";di.style.height=h.offsetHeight+'px';di.style.width=h.offsetWidth+'px';di.all.__headingText.innerText=h.innerText;di.all.__headingText.noWrap=true;di.style.pixelTop=window.event.clientY+window.document.body.scrollTop;di.style.pixelLeft=window.event.clientX+window.document.body.scrollLeft;di.style.display='';this.dragStarted=true;window.event.dataTransfer.setData("Text",String(h.sourceIndex));window.document.selection.empty();window.event.returnValue=true;}
function DbNetGrid_headingDrag()
{var di=this.gridElement('dragIcon');di.style.pixelTop=window.event.clientY+window.document.body.scrollTop;di.style.pixelLeft=window.event.clientX+window.document.body.scrollLeft;}
function DbNetGrid_headingDragEnd()
{this.gridElement('dragIcon').style.display='none';this.gridElement('insertionPoint').style.display='none';this.dragStarted=false;}
function DbNetGrid_headingDrop()
{this.gridElement('insertionPoint').style.display='none';this.applyColumnDrop(true);}
function DbNetGrid_headingDragEnter()
{}
function DbNetGrid_headingDragLeave()
{this.gridElement('insertionPoint').style.display='none';}
function DbNetGrid_headingDragOver()
{if(eval(this.dragStarted)==false)
{window.event.returnValue=true;return;}
var h=window.event.srcElement;var ip=this.gridElement('insertionPoint');ip.style.display='';var point=this.getPoint(h);ip.style.top=(point.y-6)+'px';var xLeft=(point.x-5);var xRight=(point.x-2)+h.offsetWidth;var x;if((xRight-window.event.clientX)<(window.event.clientX-xLeft))
x=xRight;else
x=xLeft;ip.style.left=x+'px';while(h.className!='headingCell'||h.tagName!='TD')
h=h.parentElement;ip.cellIndex=h.cellIndex;if(x==xRight)
ip.cellIndex+=1;window.event.returnValue=false;}
function DbNetGrid_getPoint(el)
{for(var lx=0,ly=0;el!=null;lx+=el.offsetLeft,ly+=el.offsetTop,el=el.offsetParent);return{x:lx,y:ly};}
function DbNetGrid_headingDragLeave()
{this.gridElement('insertionPoint').style.display='none';}
function DbNetGrid_headingMouseDown()
{var el=window.event.srcElement;while(el.className!='headingCell')
el=el.parentElement;var range=window.document.body.createTextRange();range.moveToElementText(el);range.select();}
function DbNetGrid_toolbarDragOver()
{window.event.returnValue=(!eval(this.dragStarted));}
function DbNetGrid_toolbarDragLeave()
{}
function DbNetGrid_toolbarDrop()
{this.applyColumnDrop(false);}
function DbNetGrid_applyColumnDrop(reassign)
{this.dragStarted=false;this.gridElement('dragIcon').style.display='none';window.document.selection.empty();window.event.returnValue=false;var sourceIndex=window.event.dataTransfer.getData("Text");var c=window.document.all[sourceIndex];if(!c)
return;while(c.className!='headingCell'||c.tagName!='TD')
c=c.parentElement;var sci=parseInt(c.cellIndex);if(this.nestedChild)
sci--;if(reassign)
{var tci=this.gridElement('insertionPoint').cellIndex;if(this.nestedChild)
tci--;if(tci==sci||(tci-1)==sci)
return;if(tci>sci)
tci-=1;}
var selectPart=this.selectPart;var headings=this.headings;if(this.orderColumn!='')
if(!isNaN(this.orderColumn))
this.orderColumn=selectPart[parseInt(this.orderColumn)-1];var scn=selectPart[sci];var sch=headings[sci];var gc=new Array();var gh=new Array();for(var i=0;i<selectPart.length;i++)
{if(i==tci&&tci<=sci&&reassign)
{gc[gc.length]=scn;gh[gh.length]=sch;}
if(i!=sci)
{gc[gc.length]=selectPart[i];gh[gh.length]=headings[i];}
if(i==tci&&tci>sci&&reassign)
{gc[gc.length]=scn;gh[gh.length]=sch;}}
if(!reassign)
{this.hiddenGridColumns[this.hiddenGridColumns.length]=scn;this.hiddenGridHeadings[this.hiddenGridHeadings.length]=sch;}
this.selectPart=gc;this.headings=gh;this.forceFilterRefresh();this.loadData();}
function DbNetGrid_buildInitialGridColumns()
{this.initialGridColumns=new Array();this.initialGridHeadings=new Array();for(var i=0;i<this.selectPart.length;i++)
{this.initialGridColumns[i]=this.selectPart[i];this.initialGridHeadings[i]=this.headings[i];}
for(var i=0;i<this.hiddenGridColumns.length;i++)
{this.initialGridColumns[this.initialGridColumns.length]=this.hiddenGridColumns[i];this.initialGridHeadings[this.initialGridColumns.length-1]=this.hiddenGridHeadings[i];}}
function DbNetGrid_forceFilterRefresh()
{while(this.filterTable.rows.length)
this.filterTable.deleteRow(0);}
function DbNetGrid_setColumnProperty(columnName,property,pattern,applyToRow)
{this.setColProp(this.columnProperties,columnName,property,"grid",pattern,applyToRow);}
function DbNetGrid_setColProp(propArray,columnName,property,propertyGroup,pattern,applyToRow)
{if(typeof(columnName)=='string')
if(columnName=='')
return;if(!this.isEncrypted(columnName))
{columnName=this.qualifyColumnName(columnName).toLowerCase().replace(/[\[\]`\']/g,"");columnName=this.getColumnName(columnName);}
if(typeof(propArray[columnName])=="undefined")
propArray[columnName]=new Array();var pn=property.split(':')[0];if(pn.indexOf('-')>-1)
{pn=this.propercase(pn.replace(/-/,' ')).replace(/ /,'');pn=pn.substr(0,1).toLowerCase()+pn.substr(1,pn.length-1);}
if(typeof(propArray[columnName][pn])=="undefined")
propArray[columnName][pn]=new Array();var propertyArray=propArray[columnName][pn];var p=property.split(':').slice(1,property.split(':').length).join(':');switch(pn)
{case"format":p=this.convertDateTimeFormat(p);break;case"imageThumbnail":if(propertyGroup=="grid")
{this.imageLookups[this.imageLookups.length]={"column":columnName,"resize":p};this.setColumnProperty(columnName,"format:image");}
break;}
switch(propertyGroup)
{case"grid":if(pattern||applyToRow)
propertyArray[propertyArray.length]=[p,pattern,applyToRow];else
propertyArray[0]=[p,pattern,applyToRow];if(pn=="imageThumbnail")
this.setViewColumnProperty(columnName,pn+":100%");else
this.setViewColumnProperty(columnName,property);break;default:propertyArray[0]=[p,pattern,applyToRow];break;}}
function DbNetGrid_getColumnName(c)
{var arr=c.split(".");return arr[arr.length-1];}
function DbNetGrid_getColumn(columnName)
{var idx=this.columnIndex(columnName);if(idx==-1)
return;var cg=this.gridElement("dbnetgrid_colgroup");return cg.childNodes[idx];}
function DbNetGrid_propercase(s)
{s=s.toLowerCase().replace(/_/g,' ');result='';for(var i=0;i<s.split(' ').length;i++)
{if(i>0)
result+=' ';result+=s.split(' ')[i].substr(0,1).toUpperCase()+s.split(' ')[i].substr(1,s.split(' ')[i].length-1);}
return result;}
function DbNetGrid_qualifyingValue(propertyValue,cellText)
{if(typeof(propertyValue[1])=='undefined')
return true;var applyProperty=false;if(propertyValue[1].toString().substr(0,1)=='/')
{if(cellText.search(propertyValue[1])>-1)
applyProperty=true;}
else
{try
{if(eval(propertyValue[1].replace(/{\$}/g,cellText)))
applyProperty=true;}
catch(e){}}
return applyProperty;}
function DbNetGrid_setEditColumnProperty(columnName,property)
{this.setColProp(this.editColumnProperties,columnName,property,"edit");if(!windowOpen(this.editWindow))
return;this.editControl.applyProperty(columnName,property);}
function DbNetGrid_addDetailGrid(grid,foreignKey,configFunction)
{if(typeof(grid.addDetailGrid)!="function")
{alert("addDetailGrid: first parameter is not a reference to a dbnetgrid object")
return}
if(typeof(foreignKey)=="string")
foreignKey=foreignKey.split(".")[foreignKey.split(".").length-1];this.detailGridArray[this.detailGridArray.length]=[grid,foreignKey,configFunction];grid.foreignKeyColumn=foreignKey;this.copyProperties(grid);grid.parentGrid=this;grid.text=this.text;}
function DbNetGrid_copyProperties(childGrid,parentGrid)
{if(!parentGrid)
parentGrid=this;var pa=['connectionString','DBMSName','language'];for(var p=0;p<pa.length;p++)
childGrid[pa[p]]=parentGrid[pa[p]];}
function DbNetGrid_clearRows()
{if(!this.table)
{var fp=this.filterPart;this.filterPart='1=2';this.loadData();this.filterPart=fp;}
else
{for(var i=this.table.rows.length;i>1;i--)
this.table.deleteRow(i-1);}
this.configureToolBar(0);this.toolbarElement("insertRow").disabled=true;for(var i=0;i<this.detailGridArray.length;i++)
this.detailGridArray[i][0].clearRows();}
function DbNetGrid_setDialogColumns(o,dialogFields,dialogLabels,mode)
{var labels=new Array();var fields=new Array();if(dialogFields.length==0)
{for(var i=0;i<this.selectPart.length;i++)
{if(mode!="view")
if(this.invalidContextColumn(this.selectPart[i],mode))
continue;labels[labels.length]=this.headings[i];fields[fields.length]=this.selectPart[i];}}
else
{for(var i=0;i<dialogFields.length;i++)
dialogFields[i]=this.qualifyColumnName(dialogFields[i]);labels=dialogLabels;fields=dialogFields;}
o.labels=labels;o.fields=fields;return eval(fields.length>0);}
function DbNetGrid_transposeColumns(type)
{var key=type+((type=="sort")?"Columns":"Fields");if(this[key].length>0)
return;for(var i=0;i<this.selectPart.length;i++)
{if(type!="view")
if(this.invalidContextColumn(this.selectPart[i],type))
continue;this[key][this[key].length]=this.selectPart[i];this[type+"Labels"][this[type+"Labels"].length]=this.headings[i];}}
function DbNetGrid_invalidContextColumn(c,type)
{return(c.search(this.specialCharRE)!=-1||(type!="sort"&&c.toLowerCase().search(/ as /)!=-1))}
function DbNetGrid_setSearchResult(fp,content,type)
{if(!this.pendingSearchCriteria)
this.pendingSearchCriteria=new Object();this.pendingSearchCriteria.filterPart=fp;this.pendingSearchCriteria.content=content;this.pendingSearchCriteria.type=type;}
function DbNetGrid_applySearchCriteria()
{switch(this.pendingSearchCriteria.type)
{case'simple':this.simpleSearchDialogContent=this.pendingSearchCriteria.content;break;default:this.searchDialogContent=this.pendingSearchCriteria.content;break;}
this.filterPart=this.pendingSearchCriteria.filterPart;this.forceFilterRefresh();this.pageNumber=1;this.loadData();}
function DbNetGrid_columnDefined(columnName)
{var columnName=this.qualifyColumnName(columnName);if(this.columnInList(this.selectPart,columnName))
return true;if(this.columnInList(this.editFields,columnName))
return true;if(this.columnInList(this.searchFields,columnName))
return true;if(this.columnInList(this.viewFields,columnName))
return true;if(this.columnInList(this.hiddenGridColumns,columnName))
return true;return false;}
function DbNetGrid_columnInList(a,c)
{for(var i=0;i<a.length;i++)
if(a[i].toUpperCase()==c.toUpperCase())
return true;return false;}
function DbNetGrid_updateCurrentRow()
{var xml=this.createXmlNode("primaryKeyValue",this.currentRow.id);if(!this.sendRequest('rowdata',xml))
return;var nodeList=this.getNode("rowData").childNodes;for(var i=0;i<nodeList.length;i++)
this.currentRow[textFromNode(nodeList[i].attributes.getNamedItem("name"))]=textFromNode(nodeList[i]);var nodeList=this.getNode("cellData").childNodes;var rowNum=parseInt(this.currentRow.getAttribute("rowNum"))-1;for(var i=0;i<nodeList.length;i++)
{var cellId=textFromNode(nodeList[i].attributes.getNamedItem("name"))+"_"+rowNum;var cell=getElementById(this.currentRow,cellId);if(cell)cell.innerHTML=textFromNode(nodeList[i]);}
this.applyGridProperties(this.table.rows,'display',this.currentRow.rowIndex);this.fireCustomEvent(this.onRowUpdated,this);}
function DbNetGrid_columnIndex(columnName)
{if(this.isEncrypted(columnName))
{for(var i=0;i<this.selectPart.length;i++)
if(columnName==this.selectPart[i])
return i+(this.nestedChild?1:0);return-1;}
var cell=this.getHeading(this.getColumnName(columnName));return(cell)?cell.cellIndex:-1;}
function DbNetGrid_arrayIndex(columnName,a)
{for(var i=0;i<a.length;i++)
if(columnName==a[i])
return i;return-1;}
function DbNetGrid_getHeading(columnName)
{return getElementById(this.headingRow,columnName.toLowerCase()+"_heading");}
function DbNetGrid_setSearchColumnProperty(columnName,property)
{this.setColProp(this.searchColumnProperties,columnName,property,"search");}
function DbNetGrid_setViewColumnProperty(columnName,property,pattern,applyToRow)
{this.setColProp(this.viewColumnProperties,columnName,property,"view",pattern,applyToRow);}
function DbNetGrid_setColumnLookup(column,fk,dc,tn,filter)
{this.columnLookups[this.columnLookups.length]=this.lookupObject(column,fk,dc,tn,filter);this.setViewColumnLookup(column,fk,dc,tn);}
function DbNetGrid_lookupObject(column,fk,dc,tn,filter)
{var o=new Object();o.column=this.qualifyColumnName(column);o.column=this.getColumnName(o.column);o.foreignKey=fk;o.displayColumn=dc;o.tableName=tn;o.filter=filter;return o;}
function DbNetGrid_setViewColumnLookup(column,fk,dc,tn)
{this.setViewColumnProperty(column,"lookup:select "+dc+" from "+tn+" where "+fk+" = @foreignKey");}
function DbNetGrid_loadSelectOptions(e,lookup,lookupWin,searchToken)
{if(!lookup)
lookup=e.getAttribute("lookup");var html=this.getSelectOptions(lookup,false,searchToken);var parentNode=e.parentNode;e.innerHTML="";var selectParts=e.parentNode.innerHTML.split('><');var emptyOption='';if(!lookupWin&&!e.required)
emptyOption='<option>';e.parentNode.innerHTML=selectParts[0]+'>'+emptyOption+html+'<'+selectParts[selectParts.length-1];return parentNode.childNodes[0];}
function DbNetGrid_getSelectOptions(lookup,tableFormat,searchToken)
{var html;if(lookup.indexOf('[[')>-1)
html=arrayToOptions(lookup,tableFormat);else
{var xml=this.createXmlNode('sql',lookup);xml+=this.createXmlNode('tableFormat',tableFormat);if(searchToken)
xml+=this.createXmlNode('searchToken',searchToken);if(!this.callService(xml,'selectoptions',this.XmlSelectData))
return;html=this.getNodeValue('html',this.XmlSelectData);}
return html;}
function DbNetGrid_getText(key)
{if(this.text[key])
return this.text[key];else
return key;}
function DbNetGrid_createSimpleSearch()
{if(this.simpleSearchFilter!="")
return;var a=new Array();for(var i=0;i<this.headingRow.cells.length;i++)
{if(this.getDataType(this.headingRow.cells[i].getAttribute("dataType"))!="string")
continue;a[a.length]=this.selectPart[i]+" like '%{token}%'";}
if(a.length>0)
this.simpleSearchFilter=new Array(new Array("",a.join(" or ")));}
function DbNetGrid_addNestedGrid(handler,foreignKey)
{this.onChildGridAdded=handler;this.childGridForeignKeyColumn=foreignKey;}
function DbNetGrid_assignTreeSelect()
{this.nestedChildGrids=new Object();var table=this.table;for(var r=0;r<table.rows.length;r++)
{if(table.rows[r].className=='headingRow')
continue;var cell=table.rows[r].cells[0];if(cell.className=="treeSelect")
{cell.parentNode.grid=this;cell.childNodes[0].onclick=this.assignHandler("openCloseLeaf");}}}
function DbNetGrid_openCloseLeaf(event)
{var img=event.srcElement;var row=img;while(row.tagName!='TR')
row=row.parentNode;var table=row.parentNode;while(table.tagName!='TABLE')
table=table.parentNode;var imgName=img.src.split("/")[img.src.split("/").length-1];if(imgName=="expand.gif")
{img.setAttribute("state","expand");img.src=this.virtualDir+"images/collapse.gif";var r=table.insertRow(row.rowIndex+1);r.className="nestedLevel"+(this.nestedLevel+1);var cell=r.insertCell(0);cell.className="treeSelect";var cell=r.insertCell(1);cell.className="treeContainer";cell.colSpan=row.cells.length-1;this.addGridNode(cell);}
else
{img.setAttribute("state","collapse");img.src=this.virtualDir+"images/expand.gif";delete this.nestedChildGrids[table.rows[row.rowIndex+1].cells[1].childNodes[0].id];table.deleteRow(row.rowIndex+1);}}
function DbNetGrid_addGridNode(cell)
{var parentRow=cell.parentNode.previousSibling;if(parentRow.id=="")
parentRow.id=new Date().valueOf();var gridId=parentRow.grid.id+"_"+parentRow.id;cell.style.textAlign='left';cell.innerHTML="<div id=\""+gridId+"\"></div>";__dbnetgrid=this;window.setTimeout("__dbnetgrid.loadNestedGrid(\""+gridId+"\","+cell.parentNode.rowIndex+")",1);}
function DbNetGrid_loadNestedGrid(gridId,rowIdx)
{var grid=new DbNetGrid(gridId);var parentRow=this.table.rows[rowIdx-1];grid.nestedLevel=parentRow.grid.nestedLevel+1;this.nestedChildGrids[gridId]=grid;grid.parentGrid=this;grid.parentRow=parentRow;var pa=['connectionString','DBMSName','language'];for(var p=0;p<pa.length;p++)
grid[pa[p]]=grid.parentGrid[pa[p]];this.childGrid=grid;if(this.childGridForeignKeyColumn)
if(this.childGridForeignKeyColumn!="")
{grid.foreignKeyColumn=this.childGridForeignKeyColumn;grid.foreignKeyValue=grid.parentRow.id;var paramName=grid.foreignKeyColumn.replace(".","_");grid.fixedFilterPart=grid.foreignKeyColumn+" = @!@"+paramName;grid.queryParameters[paramName]=grid.foreignKeyValue;}
this.fireCustomEvent(this.onChildGridAdded,this);}
function DbNetGrid_orderByFromSortColumns()
{if(this.selectedSortColumns[0]=="")
return"";var a=new Array();for(var i=0;i<this.selectedSortColumns.length;i++)
{var s=this.selectedSortColumns[i];if(this.sortColumns.length==0||(this.sortColumns.join("")==this.selectPart.join("")))
s=this.arrayIndex(s,this.selectPart)+1;if(isNaN(s))
if(this.invalidContextColumn(s,"sort"))
continue;a[a.length]=s+' '+this.selectedSortSequence[i];}
if(a.length>0)
return a.join(",");else
return"";}
function DbNetGrid_dBColumnName(columnName)
{return this.getColumnName(columnName.replace("[","").replace("]",""));}
function DbNetGrid_arrayOfElements(e)
{var a=new Array();if(e.length)
{for(var i=0;i<e.length;i++)
a[i]=e[i];}
else
a[0]=e;return a;}
function DbNetGrid_applyFilter(event)
{var fp="1=1";var filterRow=event.srcElement;while(filterRow&&filterRow.tagName!="TR")
filterRow=filterRow.parentElement;if(filterRow.tagName!="TR")
return;var filters=filterRow.getElementsByTagName('SELECT');for(var f=0;f<filters.length;f++)
{if(filters[f].value!="")
{if(this.filterType=="composite")
fp+=" and "+this.getFilterWhereClause(filters[f]);else
{if(filters[f]==event.srcElement)
fp+=" and "+this.getFilterWhereClause(filters[f]);else
filters[f].value="";}}
this.filterValues[f]=filters[f].value;}
this.filterPart=fp;this.currentFilterPart=fp;if(this.filterType=="composite")
this.forceFilterRefresh();this.pageNumber=1;this.loadData();}
function DbNetGrid_getFilterWhereClause(filterSelect)
{var index=filterSelect.parentNode.cellIndex;var dataType=this.getDataType(this.headingRow.cells[index].getAttribute("dataType"));var quote="";var value=filterSelect.value;switch(dataType)
{case'numeric':break;case'date':var a=filterSelect.value.split("-");value=this.dateQueryStringFormat.replace(/m/,a[1]).replace(/d/,a[2]).replace(/y/,a[0]);break;case'boolean':switch(this.DBMSName)
{case'MS Jet':(filterSelect.value=='No'||filterSelect.value=='False')?value='0':value='-1';break;case'Microsoft SQL Server':case'Microsoft Visual FoxPro':case'Pervasive.SQL':(filterSelect.value=='No'||filterSelect.value=='False')?value='0':value='1';break;}
break;default:quote="'";break;}
var offsetIndex=index-(this.headingRow.cells.length-this.selectPart.length);var selectColumn=this.selectPart[offsetIndex];var index=selectColumn.toLowerCase().indexOf(" as ");if(index>0)
selectColumn=selectColumn.substr(0,index);switch(dataType)
{case"date":selectColumn=this.dateQueryFunction.replace("{columnname}",selectColumn);break;case"string":value=value.replace(/\'/g,'\'\'');break;}
return selectColumn+" = "+quote+value+quote;}
function DbNetGrid_setFilterFocus(event)
{this.focusedFilter=event.srcElement.name;}
function DbNetGrid_setFilterFocus(event)
{this.focusedFilter=event.srcElement.name;}
function DbNetGrid_configureFixedHeader()
{var h1Div=this.gridElement("headingContainer");var h2Div=this.gridElement("listTable");var h1Table=h1Div.childNodes[0];var h2Table=h2Div.childNodes[0];if(h2Div.style.width)
h1Div.style.width=h2Div.offsetWidth-16;h1Table.style.width=h2Table.offsetWidth;if(h1Table.rows.length>0)
h1Table.deleteRow(0);var h1Row=h1Table.insertRow(0);var h2Row=h2Div.childNodes[0].rows[0];h1Row.parentNode.replaceChild(h2Row.cloneNode(true),h1Row);h1Row=h1Table.rows[0];for(var i=0;i<h2Row.cells.length;i++)
{var hc=h1Row.cells[i];var ht=hc;if(hc.childNodes.length>0)
ht=hc.childNodes[0];var c=h2Row.cells[i];if(c.childNodes.length>0)
ht.style.width=c.childNodes[0].offsetWidth;else
ht.style.width=c.offsetWidth;}
if(parseInt(this.getNodeValue('rowCount'))>0)
for(var c=0;c<h1Row.cells.length;c++)
if(this.isIE)
h2Table.rows[1].cells[c].style.width=h1Row.cells[c].offsetWidth;else
h2Table.rows[1].cells[c].style.width=h1Row.cells[c].offsetWidth-3;h2Table.style.width=h1Table.offsetWidth;h2Table.style.tableLayout="fixed";h2Table.deleteRow(0);h2Div.onscroll=this.assignHandler("updateHeaderScroll");this.headingRow=this.getHeadingRow();this.assignEventsToColumnHeadings(this.headingRow);this.updateHeaderScroll();}
function DbNetGrid_assignEventsToColumnHeadings(row)
{var cellCount=row.cells.length;for(var i=0;i<cellCount;i++)
{var cell=row.cells[i];if(cell.childNodes.length==0)
continue;var sortButton=cell.childNodes[0];if(this.wrapHeadings)
sortButton.rows[0].cells[0].style.whiteSpace="normal";if(sortButton.getAttribute("sortable")=="false")
{cell.title=this.text['noSort'];}
else
{sortButton.onclick=this.assignHandler("reorder");sortButton.onmousedown=function(){this.className="headingButtonDown"}
sortButton.onmouseup=function(){this.className="headingButton"}
sortButton.onmouseout=function(){this.className="headingButton"}
var h=i-((this.nestedChild)?1:0);var txt=(h<cell.cellIndex)?this.headings[h]:"";cell.title=this.text['sortBy']+' '+txt.replace('<br>',' ').replace('&nbsp;','');}
if(this.isIE)
{cell.ondragstart=this.assignHandler("headingDragStart");cell.onmousedown=this.assignHandler("headingMouseDown");cell.ondrag=this.assignHandler("headingDrag");cell.ondragend=this.assignHandler("headingDragEnd");cell.ondragenter=this.assignHandler("headingDragOver");cell.ondragleave=this.assignHandler("headingDragLeave");cell.ondragover=this.assignHandler("headingDragOver");cell.ondrop=this.assignHandler("headingDrop");}}}
function DbNetGrid_updateHeaderScroll(event)
{this.gridElement("headingContainer").scrollLeft=this.gridElement("listTable").scrollLeft;}
function DbNetGrid_getHeadingRow()
{if(this.gridElement("dbNetGridHeadingTable").rows.length>0)
return this.gridElement("dbNetGridHeadingTable").rows[0];else
return this.table.rows[0];}
function DbNetGrid_addTotalBreak(column,label,format)
{var k="dbnetgrid_total_break_"+this.totalBreakColumns.length;this.totalBreakInfo[k]={"column":this.getColumnName(column)};this.totalBreakInfo[k].label=(label)?label:"";this.totalBreakInfo[k].format=(format)?format:"";this.totalBreakColumns[this.totalBreakColumns.length]=column;}
function DbNetGrid_setTableProperty(p)
{this.tableProperties[p.split(':')[0]]=p.split(':')[1];}
function DbNetGrid_setHeadingProperty(p)
{this.headingProperties[p.split(':')[0]]=p.split(':')[1];}
function DbNetGrid_setRowStyle(row,backgroundColour,colour)
{try
{for(var i=0;i<row.cells.length;i++)
{var cell=row.cells[i];cell.style.backgroundColor=backgroundColour;cell.style.color=colour;}}
catch(e)
{}}
function DbNetGrid_getRowAttribute(name,row)
{if(!row)
row=this.currentRow;var attr=row.getAttribute(name);if(attr==null&&!this.isEncrypted(name))
attr=row.getAttribute(this.encrypt(name));return attr;}
function DbNetGrid_resetTotalColumns()
{this.totalBreakInfo=new Object();this.totalBreakColumns=new Array();this.totalDuplicatedColumns=new Array();this.dataOnlyColumns=new Array();this.totalDuplicatedColumns=new Array();this.pageNumber=1;this.orderColumn="";this.totalColumns=new Array();}
function DbNetGrid_linkedEditForm()
{if(this.dbNetEdit!=null)
if(typeof(this.dbNetEdit.linkStyle)=='string')
if(this.dbNetEdit.linkStyle=='singlepane')
return true;return false;}