//////////////////////////////////////////////////////////////////////////////////////////
// dbnetcombo.js
// copyright DbNetLink Ltd 2006
//////////////////////////////////////////////////////////////////////////////////////////
window.DbNetComboArray = new Object();

DbNetCombo.prototype = new Component();

DbNetCombo.prototype.addEmptyOption = false;
DbNetCombo.prototype.autoComplete = true;
DbNetCombo.prototype.buffer = "";
DbNetCombo.prototype.bufferTimeout = "2000";
DbNetCombo.prototype.combo = null;
DbNetCombo.prototype.comboId = '';
DbNetCombo.prototype.connectionString = '';
DbNetCombo.prototype.dateFormat = "d";
DbNetCombo.prototype.emptyOptionText = "";
DbNetCombo.prototype.linkedCombos = null;
DbNetCombo.prototype.onChange = null;
DbNetCombo.prototype.onLoaded = null;
DbNetCombo.prototype.properties = null;
DbNetCombo.prototype.queryParameters;
DbNetCombo.prototype.server = 'dbnetcombo.aspx';
DbNetCombo.prototype.sql = '';
DbNetCombo.prototype.text = '';
DbNetCombo.prototype.textColumn = '';
DbNetCombo.prototype.value = '';
DbNetCombo.prototype.valueColumn = '';
DbNetCombo.prototype.version = '3.0';
DbNetCombo.prototype.virtualDir = "/dbnetlink_components/dbnetcombo/";


var DbNetLinkBrowserDetect={init:function(){this.browser=this.searchString(this.dataBrowser)||"An unknown browser";this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||"an unknown version";this.OS=this.searchString(this.dataOS)||"an unknown OS";},searchString:function(data){for(var i=0;i<data.length;i++){var dataString=data[i].string;var dataProp=data[i].prop;this.versionSearchString=data[i].versionSearch||data[i].identity;if(dataString){if(dataString.indexOf(data[i].subString)!=-1)
return data[i].identity;}
else if(dataProp)
return data[i].identity;}},searchVersion:function(dataString){var index=dataString.indexOf(this.versionSearchString);if(index==-1)return;return parseFloat(dataString.substring(index+this.versionSearchString.length+1));},dataBrowser:[{string:navigator.userAgent,subString:"Chrome",identity:"Chrome"},{string:navigator.vendor,subString:"Apple",identity:"Safari"},{prop:window.opera,identity:"Opera"},{string:navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:navigator.userAgent,subString:"MSIE",identity:"Explorer",versionSearch:"MSIE"}],dataOS:[{string:navigator.platform,subString:"Win",identity:"Windows"},{string:navigator.platform,subString:"Mac",identity:"Mac"},{string:navigator.platform,subString:"Linux",identity:"Linux"}]};DbNetLinkBrowserDetect.init();HttpRequest.prototype.xmlHttpProgIds='MSXML2.XMLHTTP,Microsoft.XMLHTTP';HttpRequest.prototype.xmlRequest=null;HttpRequest.prototype.get=HttpRequest_get;function HttpRequest()
{if(window.XMLHttpRequest)
this.xmlRequest=new XMLHttpRequest();else
if(window.ActiveXObject)
{var arr=this.xmlHttpProgIds.split(",");for(var i=0;i<arr.length;i++)
{try
{this.xmlRequest=new ActiveXObject(arr[i]);}
catch(e)
{continue;}
break;}}}
function HttpRequest_get(url)
{this.xmlRequest.open("GET",url,false);this.xmlRequest.setRequestHeader("Content-Type","text/XML");this.xmlRequest.send("");}
DbNetLink.prototype.isIE='';DbNetLink.prototype.isSafari=false;DbNetLink.prototype.isFirefox=false;DbNetLink.prototype.IEVersion=-1;DbNetLink.prototype.FFVersion=-1;DbNetLink.prototype.xmlDocProgIds='MSXML2.XMLDOM,Microsoft.XMLDOM';DbNetLink.prototype.assignHandler=DbNetLink_assignHandler;DbNetLink.prototype.sizeDialog=DbNetLink_sizeDialog;DbNetLink.prototype.windowOpen=DbNetLink_windowOpen;DbNetLink.prototype.addClassName=DbNetLink_addClassName;DbNetLink.prototype.removeClassName=DbNetLink_removeClassName;DbNetLink.prototype.textFromNode=DbNetLink_textFromNode;DbNetLink.prototype.getElementById=DbNetLink_getElementById;DbNetLink.prototype.getNode=DbNetLink_getNode;DbNetLink.prototype.getNodeValue=DbNetLink_getNodeValue;DbNetLink.prototype.init=DbNetLink_init;DbNetLink.prototype.insertAdjacentHTML=DbNetLink_insertAdjacentHTML;DbNetLink.prototype.createXmlDocument=DbNetLink_createXmlDocument;DbNetLink.prototype.createXmlNode=DbNetLink_createXmlNode;DbNetLink.prototype.showMessage=DbNetLink_showMessage;DbNetLink.prototype.clearMessage=DbNetLink_clearMessage;DbNetLink.prototype.elementAttribute=DbNetLink_elementAttribute;DbNetLink.prototype.addStyleSheet=DbNetLink_addStyleSheet;DbNetLink.prototype.standardDateFormat=DbNetLink_standardDateFormat;DbNetLink.prototype.addToObjectPool=DbNetLink_addToObjectPool;DbNetLink.prototype.testArray=DbNetLink_testArray;DbNetLink.prototype.openHTMLEditor=DbNetLink_openHTMLEditor;DbNetLink.prototype.openModalDialog=DbNetLink_openModalDialog;DbNetLink.prototype.openDialog=DbNetLink_openDialog;DbNetLink.prototype.openNonModalDialog=DbNetLink_openNonModalDialog;DbNetLink.prototype.setCookie=DbNetLink_setCookie;DbNetLink.prototype.getCookie=DbNetLink_getCookie;DbNetLink.prototype.deleteCookie=DbNetLink_deleteCookie;function DbNetLink()
{this.isIE=false;if(document.all)
this.isIE=true;switch(DbNetLinkBrowserDetect.browser)
{case"Safari":case"Chrome":this.isSafari=true;break;case"Firefox":this.isFirefox=true;this.FFVersion=parseFloat(DbNetLinkBrowserDetect.version);break;case"Explorer":this.isIE=true;this.IEVersion=parseFloat(DbNetLinkBrowserDetect.version);break;}}
function DbNetLink_assignHandler(methodName,noSrcElement,returnValue,o)
{if(!o)
o=window;if(typeof(methodName)=="function")
{var fn=arguments[0].toString().split("(")[0].replace("function ","");if(fn=="function")
return methodName;else
methodName=fn;}
if(methodName=="")
return function(){};var call="o."+methodName+"("+((noSrcElement)?"":"getCoords(event)")+")";if(returnValue)
return function(event){return(eval(call))};else
return function(event){eval(call)};}
function DbNetLink_sizeDialog(centre)
{if(typeof(centre)=='undefined')
centre=true;if(this.isFirefox)
{window.sizeToContent();}
else
{var layout=document.getElementById('layout');if(!layout)
layout=document.body.childNodes[0];var xpad=0;var ypad=0;if(this.IEVersion<7&&!this.isSafari)
{xpad=this.elementAttribute(layout,"xpad",10);ypad=this.elementAttribute(layout,"ypad",30);}
var h=(parseInt(layout.offsetHeight)+parseInt(ypad));var w=(parseInt(layout.offsetWidth)+parseInt(xpad));if(typeof(window.dialogHeight)=="undefined")
{h+=(this.isSafari)?70:50;w+=20;window.resizeTo(w,h);}
else
{window.dialogHeight=h+"px";window.dialogWidth=w+"px";}}
if(centre&&!this.isSafari)
centreDialog();}
function DbNetLink_windowOpen(w)
{if(w)
if(!w.closed)
return true;return false;}
function DbNetLink_addClassName(e,className)
{if(e.className.indexOf(className)==-1)
e.className+=" "+className;}
function DbNetLink_removeClassName(e,className)
{var a=e.className.split(" ");var b=new Array();for(var i=0;i<a.length;i++)
if(a[i]!=className)
b[b.length]=a[i];e.className=b.join(" ").replace("  ","");}
function DbNetLink_textFromNode(n)
{if(n==null)
return'';if(n.text)
return n.text;if(n.childNodes.length>0)
{var returnText='';for(var i=0;i<n.childNodes.length;i++)
returnText+=n.childNodes[i].nodeValue;return(returnText);}
return'';}
function DbNetLink_addToObjectPool(obj)
{if(!document.__ObjectPool)
{document.__ObjectPool=new Object;document.__ObjectPool.Objects=new Array();document.__ObjectPool.length=0;}
obj.objectId=document.__ObjectPool.length++;document.__ObjectPool.Objects[obj.objectId]=obj;obj.toString=new Function("return 'document.__ObjectPool.Objects["+obj.objectId+"]'");}
function DbNetLink_getElementById(rootNode,id)
{if(rootNode==null)alert("root node is null "+id)
if(rootNode.all)
return rootNode.all[id];else
{if(rootNode.getElementsByTagName)
{var all=rootNode.getElementsByTagName('*');for(i=0;i<all.length;i++)
{if(all[i].getAttribute)
if(all[i].getAttribute('id'))
if(all[i].getAttribute('id').toLowerCase()==id.toLowerCase())
return all[i];}}}
return null;}
function DbNetLink_createXmlDocument()
{if(document.implementation&&document.implementation.createDocument)
return document.implementation.createDocument("","",null);var o=null;if(window.ActiveXObject)
{var arr=this.xmlDocProgIds.split(",");for(var i in arr)
{try
{o=new ActiveXObject(arr[i]);}
catch(e)
{continue;}
break;}}
return o;}
function DbNetLink_createXmlNode(nodeName,nodeValue,attributes)
{if(nodeValue==null)
nodeValue="";if(typeof(nodeName)!="string"||nodeName=="")
return"";var xml="<"+nodeName;if(attributes)
for(a in attributes)
{var attributeValue=attributes[a];switch(typeof(attributeValue))
{case"string":attributeValue=attributeValue.replace(/\&/g,'&amp;').replace(/\"/g,'&quot;').replace(/\>/g,'&gt;').replace(/\</g,'&lt;');break;}
xml+=" "+a+"=\""+attributeValue+"\"";}
xml+=">";switch(typeof(nodeValue))
{case"object":if(testArray(nodeValue))
{for(var i=0;i<nodeValue.length;i++)
xml+=this.createXmlNode("item",nodeValue[i]);}
else
{for(var p in nodeValue)
xml+=this.createXmlNode(p,nodeValue[p]);}
break;case"string":xml+=(nodeValue.indexOf("<![CDATA[")>-1)?nodeValue:"<![CDATA["+nodeValue+"]]>";break;default:xml+=nodeValue;break;}
xml+="</"+nodeName+">";return xml;}
function DbNetLink_showMessage(str)
{if(!$('messageLine'))
{alert(str);return;}
$('messageLine').innerHTML=str;addClassName($('messageLine'),'activeMessage');window.setTimeout('clearMessage()',3000);}
function DbNetLink_clearMessage()
{$('messageLine').innerHTML='&nbsp;';removeClassName($('messageLine'),'activeMessage');}
function DbNetLink_elementAttribute(e,id,v)
{if(e[id])
return e[id];else if(e.getAttribute(id))
return e.getAttribute(id);else
return(v)?v:null;}
function DbNetLink_insertAdjacentHTML(elem,sWhere,html)
{if(dbNetLink.isSafari)
{var node=document.createElement("SPAN");node.innerHTML=html;switch(sWhere)
{case"beforeEnd":elem.insertBefore(node,null);break;case"beforeBegin":elem.parentNode.insertBefore(node,elem);break;case"afterEnd":elem.parentNode.insertBefore(node,elem.nextSibling);break;}}
else
{elem.insertAdjacentHTML(sWhere,html);}}
function DbNetLink_addStyleSheet(url,doc)
{var addStyleSheet=true;for(var i=0;i<doc.styleSheets.length;i++)
{var tmp=doc.styleSheets[i].href;if(tmp)
if(tmp.toLowerCase().indexOf(url.toLowerCase())>-1)
addStyleSheet=false;}
if(addStyleSheet)
{if(this.isIE)
doc.createStyleSheet(url,0);else
{var sheet=doc.createElement('link');sheet.rel='stylesheet';sheet.href=url;var head=doc.getElementsByTagName("head")[0];head.insertBefore(sheet,head.firstChild);}}}
function DbNetLink_standardDateFormat(formatString)
{if(typeof(formatString)!='string')
return true;if(formatString=='')
return true;if(formatString.length!=1)
return false;var re=/^[dGgTt]$/;return re.test(formatString);}
function DbNetLink_testArray(obj)
{if(obj)
if(obj.constructor)
{if(dbNetLink.isSafari)
return(obj instanceof Array)
else
return(obj.constructor.toString().indexOf("function Array()")>=0);}
return false;}
function DbNetLink_openHTMLEditor(params)
{var comp;if(params.component.component)
comp=params.component.component;else
comp=params.component;var editor=comp.HTMLEditor;if(editor.toLowerCase().indexOf("tinymce")>-1)
{params.tinyMCEConfig=comp.tinyMCEConfig;editor="tinymce/tinymce_window.aspx";}
openModalDialog(params.component.virtualDir+'/common/editor/'+editor,'htmleditor',params,"resizable=yes");}
function DbNetLink_getNodeValue(doc,pattern)
{return dbNetLink.textFromNode(dbNetLink.getNode(doc,pattern));}
function DbNetLink_getNode(doc,pattern)
{if(pattern.indexOf("/")!=0)
pattern="//"+pattern;return doc.selectSingleNode(pattern);}
function DbNetLink_init(f)
{if(window.attachEvent)
window.attachEvent("onload",f)
else
document.addEventListener("DOMContentLoaded",f)}
function DbNetLink_setCookie(name,value,expires,path,domain,secure)
{var today=new Date();today.setTime(today.getTime());if(expires)
{expires=expires*1000*60*60*24;}
var expires_date=new Date(today.getTime()+(expires));document.cookie=name+"="+escape(value)+
((expires)?";expires="+expires_date.toGMTString():"")+
((path)?";path="+path:"")+
((domain)?";domain="+domain:"")+
((secure)?";secure":"");}
function DbNetLink_getCookie(check_name)
{var a_all_cookies=document.cookie.split(';');var a_temp_cookie='';var cookie_name='';var cookie_value='';var b_cookie_found=false;for(i=0;i<a_all_cookies.length;i++)
{a_temp_cookie=a_all_cookies[i].split('=');cookie_name=a_temp_cookie[0].replace(/^\s+|\s+$/g,'');if(cookie_name==check_name)
{b_cookie_found=true;if(a_temp_cookie.length>1)
{cookie_value=unescape(a_temp_cookie[1].replace(/^\s+|\s+$/g,''));}
return cookie_value;break;}
a_temp_cookie=null;cookie_name='';}
if(!b_cookie_found)
{return null;}}
function DbNetLink_deleteCookie(name,path,domain)
{if(this.getCookie(name))document.cookie=name+"="+
((path)?";path="+path:"")+
((domain)?";domain="+domain:"")+";expires=Thu, 01-Jan-1970 00:00:01 GMT";}
var dbNetLink=new DbNetLink();Component.prototype.clearTextTokens=null;Component.prototype.configLang='';Component.prototype.culture=null;Component.prototype.currentProfileId="";Component.prototype.isIE=null;Component.prototype.encryptedTokens=null;Component.prototype.filterText="";Component.prototype.filterTextObjectArray=null;Component.prototype.httpRequest=null;Component.prototype.messageLine=null;Component.prototype.profileCombo=null;Component.prototype.profileKey="";Component.prototype.profileRestore=true;Component.prototype.profileSelect=false;Component.prototype.profileSelectText="";Component.prototype.profileUser="";Component.prototype.profileWindow=null;Component.prototype.requiredProperties=null;Component.prototype.text=null;Component.prototype.trace=false;Component.prototype.traceArray=null;Component.prototype.traceArea=null;Component.prototype.xmlDocument=null;Component.prototype.xmlRequest=null;Component.prototype.xmlResponse=null;Component.prototype.instances=null;Component.prototype.instanceIndex=null;Component.prototype.callbackFunction=null;Component.prototype.toolButtonStyle='image';Component.prototype.openWindows=null;Component.prototype.tinyMCEConfig=null;Component.prototype.addUserProfileProperties=Component_addUserProfileProperties;Component.prototype.assignHandler=Component_assignHandler;Component.prototype.assignButtonHint=Component_assignButtonHint;Component.prototype.addCSSRule=Component_addCSSRule;Component.prototype.buttonContent=Component_buttonContent;Component.prototype.callService=Component_callService;Component.prototype.checkDOM=Component_checkDOM;Component.prototype.clearMessage=Component_clearMessage;Component.prototype.clearText=Component_clearText;Component.prototype.createXmlNode=Component_createXmlNode;Component.prototype.createXmlDocument=Component_createXmlDocument;Component.prototype.deleteUserProfile=Component_deleteUserProfile;Component.prototype.encrypt=Component_encrypt;Component.prototype.evaluate=Component_evaluate;Component.prototype.fireCustomEvent=Component_fireCustomEvent;Component.prototype.formatNumber=Component_formatNumber;Component.prototype.getChildNodes=Component_getChildNodes;Component.prototype.getDataType=Component_getDataType;Component.prototype.getNode=Component_getNode;Component.prototype.getNodeValue=Component_getNodeValue;Component.prototype.getText=Component_getText;Component.prototype.initialiseStyleSheet=Component_initialiseStyleSheet;Component.prototype.inspectCSSRule=Component_inspectCSSRule;Component.prototype.loadDocument=Component_loadDocument;Component.prototype.loadText=Component_loadText;Component.prototype.loadProfileCombo=Component_loadProfileCombo;Component.prototype.loadUserProfiles=Component_loadUserProfiles;Component.prototype.logTrace=Component_logTrace;Component.prototype.makeImageButton=Component_makeImageButton;Component.prototype.message=Component_message;Component.prototype.MSDB=Component_MSDB;Component.prototype.openDialog=Component_openDialog;Component.prototype.openNonModalDialog=Component_openNonModalDialog;Component.prototype.openModalDialog=Component_openModalDialog;Component.prototype.readOnlyDataType=Component_readOnlyDataType;Component.prototype.recordExists=Component_recordExists;Component.prototype.saveUserProfile=Component_saveUserProfile;Component.prototype.selectData=Component_selectData;Component.prototype.selectDate=Component_selectDate;Component.prototype.selectProfile=Component_selectProfile;Component.prototype.selectUserProfile=Component_selectUserProfile;Component.prototype.suggestData=Component_suggestData;Component.prototype.makeRequest=Component_makeRequest;Component.prototype.serialise=Component_serialize;Component.prototype.serialize=Component_serialize;Component.prototype.serialiseRequiredProperties=Component_serialiseRequiredProperties;Component.prototype.showError=Component_showError;Component.prototype.checkRequestState=Component_checkRequestState;Component.prototype.processResponse=Component_processResponse;Component.prototype.convertDateTimeFormat=Component_convertDateTimeFormat;Component.prototype.userProfileDialog=Component_userProfileDialog;Component.prototype.setAccessKey=Component_setAccessKey;Component.prototype.isEncrypted=Component_isEncrypted;Component.prototype.isMethodAssigned=Component_isMethodAssigned;Component.prototype.escape=Component_escape;Component.prototype.configureSimpleSearchFilter=Component_configureSimpleSearchFilter;Component.prototype.onBeforeProfileSaved=null;Component.prototype.onProfileSelected=null;Component.prototype.onProfileSaved=null;Component.prototype.onProfileDeleted=null;function Component()
{this.isIE=false;if(document.all)
this.isIE=true;this.requiredProperties=new Array();this.instances=new Array();this.openWindows=new Object();this.encryptedTokens=new Object();this.clearTextTokens=new Object();this.tinyMCEConfig=new Object();this.tinyMCEConfig.fileSelection=new Object();}
function initialiseComponent(o)
{if(window[o.componentName+"VirtualFolder"])
{o.virtualDir=window[o.componentName+"VirtualFolder"]+"/";o.virtualDir=o.virtualDir.replace("//","/");}
o.httpRequest=new HttpRequest();o.xmlRequest=o.httpRequest.xmlRequest;o.instanceIndex=o.instances.length;o.instances[o.instances.length]=o;dbNetLink.addToObjectPool(o);}
function Component_callService(xml,method,doc)
{xml+=this.serialiseRequiredProperties();var url=this.virtualDir+"/"+this.server+"?mode="+method;this.xmlDocument=doc;if(!this.makeRequest(url,xml))
return false;return true;}
function Component_checkDOM(id)
{if(document.readyState)
if(document.readyState!="complete")
{alert("Element with ID ["+id+"] not available. Use the window.onload event to create "+this.componentName);return;}
alert("The element with ID ["+id+"] not available. Check element has been defined or you are creating or use the window.onload event to create "+this.componentName);}
function Component_serialiseRequiredProperties()
{var xml="";for(var i=0;i<this.requiredProperties.length;i++)
xml+=this.serialize(this.requiredProperties[i]);return xml;}
function Component_makeRequest(url,xml)
{if(xml.indexOf('<root>')!=0)
xml='<root>'+xml+'</root>';url=url.replace(/\/\//g,'\/');try
{this.xmlRequest.open("POST",url,(this.callbackFunction)?true:false);}
catch(e)
{this.xmlRequest=new HttpRequest().xmlRequest;this.xmlRequest.open("POST",url,(this.callbackFunction)?true:false);}
this.xmlRequest.setRequestHeader("Content-Type","text/XML");if(this.callbackFunction)
this.xmlRequest.onreadystatechange=this.checkRequestState(this);else
this.xmlRequest.onreadystatechange=function(){};this.logTrace('out',url,xml);this.xmlRequest.send(xml);if(this.callbackFunction)
return true;if(this.xmlRequest.status!=200||this.xmlRequest.responseXML==null)
{this.showError(this.xmlRequest.responseText);return false;}
if(url)
this.logTrace('in',url,this.xmlRequest.responseXML.xml);return this.processResponse(url);}
function Component_processResponse(url)
{if(this.xmlRequest.status!=200||((this.xmlRequest.responseXML==null)||(this.xmlRequest.responseXML.xml=="")))
{this.showError(this.xmlRequest.responseText);return false;}
if(url)
this.logTrace('in',url,this.xmlRequest.responseXML.xml);if(typeof(this.xmlDocument)=='undefined')
this.xmlResponse=this.xmlRequest.responseXML;else
this.loadDocument(this.xmlDocument);return true;}
function Component_checkRequestState(component)
{return function()
{if(component.xmlRequest.readyState!=4)
return;if(component.processResponse())
if(component.callbackFunction)
component.callbackFunction();}}
function Component_logTrace(direction,url,xml)
{if(!this.trace)
return;if(!this.traceArray)
this.traceArray=new Array();if(this.traceArray.length==100)
this.traceArray=new Array();if(this.traceArea)
this.traceArea.value+=direction+":"+url+":"+xml;this.traceArray[this.traceArray.length]=direction+":"+url+":"+xml;}
function Component_loadDocument(doc,xml)
{if(document.implementation&&document.implementation.createDocument)
{if(typeof(xml)=='undefined')
{var objXMLSerializer=new XMLSerializer();xml=objXMLSerializer.serializeToString(this.xmlRequest.responseXML);}
if(xml=="")
xml="<root></root>";var objDOMParser=new DOMParser();var objDoc=objDOMParser.parseFromString(xml,"text/xml");while(doc.hasChildNodes())
doc.removeChild(doc.lastChild);for(var i=0;i<objDoc.childNodes.length;i++)
{var objImportedNode=doc.importNode(objDoc.childNodes[i],true);doc.appendChild(objImportedNode);}}
else
{if(typeof(xml)=='undefined')
xml=this.xmlRequest.responseXML.xml;doc.loadXML(xml);}}
function Component_createXmlDocument()
{return dbNetLink.createXmlDocument();}
function Component_getNode(pattern,doc)
{if(doc==null)
return dbNetLink.getNode(this.xmlResponse,pattern);return dbNetLink.getNode(doc,pattern);}
function Component_getNodeValue(pattern,doc)
{if(doc==null)
return dbNetLink.getNodeValue(this.xmlResponse,pattern);return dbNetLink.getNodeValue(doc,pattern);}
function Component_getChildNodes(pattern,doc)
{var n=this.getNode(pattern,doc);if(!n)
return null;return n.childNodes;}
function Component_showError(text)
{var leftPos=(screen.availWidth-500)/2;var topPos=(screen.availHeight-500)/2;var posStr=('left='+leftPos+',top='+topPos+',width=500,height=500,toolbars=no,scrollbars=yes,resizable=yes');var win=window.open("about:blank",null,posStr);if(!win)
alert("A popup-blocker has prevented the error window from opening\nPlease adjust the settings to allow popups from this site");else
{try
{win.document.open();}
catch(e)
{win.close();win=window.open("about:blank",null,posStr);win.document.open();}
win.document.write(text);win.document.close();}}
function Component_serialize(propertyName,nodeName)
{if(!nodeName)
nodeName=propertyName;var xml="";switch(typeof(this[propertyName]))
{case"undefined":break;case"object":xml=this.createXmlNode(nodeName,this[propertyName]);break;case"boolean":xml=this.createXmlNode(nodeName,this[propertyName].toString().toLowerCase());break;default:xml=this.createXmlNode(nodeName,this[propertyName]);break;}
return xml;}
function Component_createXmlNode(nodeName,nodeValue,attributes)
{return dbNetLink.createXmlNode(nodeName,nodeValue,attributes);}
function Component_loadText()
{if(!this.text)
this.text=new Object();else
if(typeof(this.text['true'])=='string')
return;var doc=this.createXmlDocument();var xml=this.serialise('configLang');if(!this.callService(xml,"loadtext",doc))
return;var nodeList=doc.documentElement.childNodes;for(var i=0;i<nodeList.length;i++)
this.text[nodeList[i].nodeName]=dbNetLink.textFromNode(nodeList[i]);}
function Component_getText(id)
{if(this.text[id])
return this.text[id];else
return id;}
function Component_message(messageText)
{if((this.messageLine)&&(messageText.length<100))
{this.messageLine.innerHTML=messageText;var color='gold';if(this.messageLine.backgroundColor)
color=this.messageLine.backgroundColor;this.messageLine.style.backgroundColor=color;if(this.isIE)
window.setTimeout('Component_clearMessage('+this.instanceIndex+',"'+this.componentName+'")',3000);else
window.setTimeout(this.clearMessage,3000,this);}
else
alert(messageText);}
function Component_clearMessage(objectReference)
{var o;if(!isNaN(objectReference))
{var index=arguments[0];var componentName=arguments[1];o=eval(componentName+'.prototype.instances['+index+']');}
else
o=arguments[0];o.messageLine.innerHTML='&nbsp;';o.messageLine.style.backgroundColor='';}
function Component_clearText(token)
{if(this.clearTextTokens[token])
return this.clearTextTokens[token];var xmlResponseSave=this.xmlResponse;var xml=this.createXmlNode("token",token);if(!this.callService(xml,"cleartext"))
return token;eToken=this.getNodeValue("token");this.clearTextTokens[token]=eToken;this.xmlResponse=xmlResponseSave;return eToken;}
function Component_assignHandler(methodName,noSrcElement,returnValue)
{return dbNetLink.assignHandler(methodName,noSrcElement,returnValue,this);}
function Component_formatNumber(expr,decplaces)
{if(isNaN(expr)||expr=='')
return expr;if(!decplaces)
decplaces=2;var str=""+Math.round(eval(expr)*Math.pow(10,decplaces));while(str.length<=decplaces)
{str="0"+str;}
var decpoint=str.length-decplaces;var decimalSeparator=this.decimalSymbol;if(this.culture)
if(this.culture.numberDecimalSeparator)
decimalSeparator=this.culture.numberDecimalSeparator;return str.substring(0,decpoint)+decimalSeparator+str.substring(decpoint,str.length);}
function Component_fireCustomEvent()
{switch(typeof(arguments[0]))
{case'string':functionName=arguments[0];break;case'function':var arr=arguments[0].toString().split("(");functionName=arr[0].replace("function ","");if(functionName=="function")
{arguments[0].apply();return;}
break;default:functionName='';break;}
if(functionName!='')
{if(typeof(eval("window."+functionName))!='undefined')
{var args=new Array();for(var i=1;i<arguments.length;i++)
args[args.length]=arguments[i];return(eval(functionName+".apply(this, args)"));}
else
alert("Handler '"+functionName+"' is undefined");}
return null;}
function Component_evaluate(value,defaultValue)
{if(typeof(value)=="boolean")
return value;else if(typeof(defaultValue)=="boolean")
return defaultValue;return true;}
function Component_selectDate(field,x,y,callback)
{if(field.disabled||field.readOnly)
return;var params=new Object();params.field=field;params.monthNames='';params.dayNames='';params.x=x;params.y=y;params.callback=callback;params.component=this;for(var i=1;i<=12;i++)
{if(i>1)
params.monthNames+=',';params.monthNames+=this.getText('month'+i);}
for(var i=1;i<=7;i++)
{if(i>1)
params.dayNames+=',';params.dayNames+=this.getText('day'+i);}
this.openModalDialog(this.virtualDir+'common/calendar.htm','calendar',params);}
function Component_MSDB()
{var MS=false;switch(this.DBMSName)
{case'MySQL':case'DB2/NT':case'Oracle':case'InterSystems Cache':case'Sybase SQL Server':case'Adaptive Server Anywhere':case'Microsoft Visual FoxPro':case'SAS':case'Informix':case'Advantage':case'Pervasive.SQL':case'OpenRDA DAM':case'Firebird':MS=false;break;default:MS=true;break;}
return MS;}
function Component_suggestData(sql,parameters,allRows,format,dbColumn,dbTable)
{var xmlResponseSave=this.xmlResponse;var data=new Array();var xml=this.createXmlNode("sql",sql);xml+=this.createXmlNode("parameters",parameters);xml+=this.createXmlNode("format",format);xml+=this.createXmlNode("column",dbColumn);xml+=this.createXmlNode("table",dbTable);if(!this.callService(xml,"suggestdata"))
return null;var rows=this.xmlResponse.documentElement.childNodes;for(var r=0;r<rows.length;r++)
{data[r]=new Object();var fields=rows[r].childNodes;for(var i=0;i<fields.length;i++)
data[r][fields[i].nodeName]=dbNetLink.textFromNode(fields[i]);}
this.xmlResponse=xmlResponseSave;if(allRows)
return data;else
return data[0];}
function Component_selectData(sql,parameters,allRows,format)
{var xmlResponseSave=this.xmlResponse;var data=new Array();var xml=this.createXmlNode("sql",sql);xml+=this.createXmlNode("parameters",parameters);xml+=this.createXmlNode("format",format);if(!this.callService(xml,"selectdata"))
return null;var rows=this.xmlResponse.documentElement.childNodes;for(var r=0;r<rows.length;r++)
{data[r]=new Object();var fields=rows[r].childNodes;for(var i=0;i<fields.length;i++)
data[r][fields[i].nodeName]=dbNetLink.textFromNode(fields[i]);}
this.xmlResponse=xmlResponseSave;if(allRows)
return data;else
return data[0];}
function Component_recordExists(sql,parameters)
{var xmlResponseSave=this.xmlResponse;var xml=this.createXmlNode("sql",sql);xml+=this.createXmlNode("parameters",parameters);if(!this.callService(xml,"recordexists"))
return false;var exists=(eval(this.getNodeValue("eof").toLowerCase())==false);this.xmlResponse=xmlResponseSave;return exists;}
function Component_encrypt(token)
{if(this.encryptedTokens[token])
return this.encryptedTokens[token];var xmlResponseSave=this.xmlResponse;var xml=this.createXmlNode("token",token);if(!this.callService(xml,"encrypttoken"))
return token;eToken=this.getNodeValue("token");this.encryptedTokens[token]=eToken;this.xmlResponse=xmlResponseSave;return eToken;}
function Component_makeImageButton(image,label,common,hint,e)
{var template='<table title="{title}" cellpadding=0 cellspacing=0><tr><td><img src="{file}"></td><td>&nbsp;{text}</td></tr></table>'
if(typeof(hint)!='string')
hint='';var filepath=this.virtualDir+'/'+(common?'common':'')+'/images/'+image+'.gif';filepath=filepath.replace(/\/\//g,'\/');str=template.replace('{title}',hint).replace('{file}',filepath).replace('{text}',label);if(e)
{e.innerHTML=str;e.childNodes[0].rows[0].cells[0].childNodes[0].src=filepath;}
else
{return str;}}
function Component_initialiseStyleSheet()
{var styleSheetUrl=this.virtualDir+"css/"+this.componentName+".css";dbNetLink.addStyleSheet(styleSheetUrl,window.document);}
function Component_buttonContent(id,img,text,style)
{if(!img)
img=this.virtualDir+"images/"+id.replace(/Row/,'')+".gif";if(!text)
text="";if(!style)
style=this.toolButtonStyle;var imgCell="<td id=buttonImg style=\"text-align:center;display:"+((style=="text")?"none":"")+"\"><img id="+id+"Img src=\""+img+"\"></img><td>";var textCell="<td id=buttonText style=\"text-align:center;display:"+((style=="image")?"none":"")+"\">"+text+"</td>";var html="<table cellpadding=0 cellspacing=0><tr>";html+=imgCell;switch(style)
{case"vertical":html+="</tr><tr>";break;case"horizontal":html+="<td>&nbsp;</td>";break;}
html+=textCell;html+="</tr></table>";return html;}
function Component_addCSSRule(ruleName,rule)
{var qualifiedName=ruleName;if(ruleName.indexOf('#')!=0)
qualifiedName='.'+ruleName;var found=false;for(var s=0;s<document.styleSheets.length;s++)
{var rules=(this.isIE)?document.styleSheets[s].rules:document.styleSheets[s].cssRules;for(var r=0;r<rules.length;r++)
{if(("#"+this.container.id+" "+qualifiedName==rules[r].selectorText)||(qualifiedName==rules[r].selectorText));{found=true;break;}}}
if(!found)
{var tmp="#"+this.container.id+" "+qualifiedName;if(this.isIE)
document.styleSheets[0].addRule(tmp,rule);else
document.styleSheets[0].insertRule(tmp+"{"+rule+"}",0);}}
function Component_inspectCSSRule(ruleName,property)
{var found=false;for(var s=0;s<document.styleSheets.length;s++)
{var rules=(this.isIE)?document.styleSheets[s].rules:document.styleSheets[s].cssRules;for(var r=0;r<rules.length;r++)
{if(("#"+this.container.id+" ."+ruleName==rules[r].selectorText)||("."+ruleName==rules[r].selectorText));{return(rules[r].style[property]);}}}
return(null);}
function Component_isMethodAssigned(p)
{switch(typeof(p))
{case"function":case"string":return true;}
return false;}
function Component_convertDateTimeFormat(f)
{if(f.match(/^[ymd].[ymd].[ymd] h:mi:s$/))
return"G";if(f.match(/^[ymd].[ymd].[ymd] h:mi$/))
return"g";if(f.match(/^[ymd].[ymd].[ymd]$/))
return"d";if(f.match(/^h:mi:s$/))
return"T";if(f.match(/^h:mi$/))
return"t";return f;}
function Component_readOnlyDataType(dataType)
{switch(dataType.toLowerCase())
{case"varbinary":case"binary":case"dbtype_binary":case"dbtype_longvarchar":case"dbtype_longvarbinary":case"dbtype_varbinary":case"image":case"blob":case"bytea":case"sql_variant":case"longbinary":return true;}
return false;}
function Component_getDataType(dbDataType)
{if(typeof(dbDataType)!="string")
return null;var dataType;switch(dbDataType.toLowerCase())
{case"dbtype_bool":case"bit":case"11":case"boolean":case"bool":dataType="boolean";break;case"dbtype_dbtime":case"time":case"134":dataType="time";break;case"dbtype_date":case"dbtype_dbdate":case"dbtype_dbtimestamp":case"date":case"datetime":case"smalldatetime":case"timestamp":case"133":case"135":case"7":dataType="date";break;case"dbtype_dbtimestamp":case"dbtype_wvarchar":case"dbtype_wlongvarchar":case"dbtype_varchar":case"dbtype_char":case"dbtype_longvarchar":case"dbtype_wchar":case"char":case"wchar":case"nchar":case"longchar":case"unichar":case"varchar":case"nvarchar":case"wvarchar":case"univarchar":case"long varchar":case"varchar2":case"nvarchar2":case"wvarchar2":case"text":case"ntext":case"memo":case"sysname":case"129":case"200":case"130":case"201":case"202":case"203":case"clob":case"bpchar":case"longtext":dataType="string";break;case"72":case"uniqueidentifier":dataType="guid";break;case"128":case"varbinary":case"blob":case"bytea":dataType="blob";break;default:if(dbDataType.toLowerCase().indexOf("time ")==0)
dataType="time";else if(dbDataType.toLowerCase().indexOf("timestamp ")==0)
dataType="date";else
dataType="numeric";}
return dataType;}
function Component_openModalDialog(url,winName,args,features)
{return this.openDialog(url,winName,args,true,features);}
function Component_openNonModalDialog(url,winName,args,features)
{return(this.openDialog(url,winName,args,false,features));}
function Component_openDialog(url,winName,args,modal,optFeatures)
{if(window.showModalDialog)
{return openDialog(url,winName,args,modal,optFeatures);}
else
{var w=this.openWindows[winName];if(dbNetLink.windowOpen(w))
{window.dialogArguments[winName]=args;w.focus();}
else
{w=dbNetLink.openDialog(url,winName,args,modal,optFeatures);this.openWindows[winName]=w;}
return w;}}
function Component_assignButtonHint(btn,t)
{if(this.isIE)
btn.childNodes[0].title=this.getText(t);else
btn.title=this.getText(t);}
function Component_userProfileDialog()
{if(windowOpen(this.profileWindow))
{this.profileWindow.focus();return;}
var o=new Object();o.grid=this;this.profileWindow=this.openNonModalDialog(this.virtualDir+'common/profile.aspx','profile_window',o);}
function Component_saveUserProfile(title,id)
{this.fireCustomEvent(this.onBeforeProfileSaved,this);var a=new Array();for(var i=0;i<this.userProfileProperties.length;i++)
{var p=this.userProfileProperties[i];if(typeof(this[p])=="undefined")
{var e;if(this.componentName=="DbNetGrid")
e=this.toolbarElement(p);if(typeof(e)=="undefined"||e==null)
e=document.getElementById(p);if(e)
if(e.tagName=="INPUT"&&e.type=="checkbox")
a[a.length]=this.createXmlNode(p,e.checked.toString().toLowerCase());else
a[a.length]=this.createXmlNode(p,e.value);else if(typeof(window[p])!="undefined")
a[a.length]=this.createXmlNode(p,window[p]);}
else
a[a.length]=this.serialize(p);}
var xml=this.createXmlNode("profileTitle",title);xml+=this.createXmlNode("profileId",id);xml+=this.serialize("profileKey");xml+=this.serialize("profileUser");xml+="<profile>"+a.join("")+"</profile>";if(!this.callService(xml,'saveuserprofile'))
return
this.currentProfileId=this.getNodeValue('id');this.loadProfileCombo();this.fireCustomEvent(this.onProfileSaved,this);return this.getNodeValue('html');}
function Component_deleteUserProfile(id)
{var xml=this.createXmlNode("profileId",id);xml+=this.serialize("profileKey");xml+=this.serialize("profileUser");if(!this.callService(xml,'deleteuserprofile'))
return"";this.currentProfileId="";this.loadProfileCombo();this.fireCustomEvent(this.onProfileDeleted,this);return this.getNodeValue('html');}
function Component_loadProfileCombo()
{if(this.profileCombo!=null)
{this.loadUserProfiles(this.profileCombo,this.profileSelectText);this.profileCombo.value=this.currentProfileId;}}
function Component_selectUserProfile(id)
{if(this.profileRestore)
dbNetLink.setCookie(this.profileKey,id);var xml=this.createXmlNode("profileId",id);if(!this.callService(xml,'selectuserprofile'))
return;for(var i=0;i<this.userProfileProperties.length;i++)
{var p=this.userProfileProperties[i];if(!this.getNode(p))
continue;if(typeof(this[p])!="undefined")
{switch(p)
{case"searchDialogContent":case"simpleSearchDialogContent":this[p]=xmlFromNode(this.getNode(p));break;case"filterPart":this[p]=this.getNodeValue("/root/profile/"+p);break;default:if(dbNetLink.testArray(this[p]))
{var nl=this.getNode(p).childNodes;var a=new Array();for(var n=0;n<nl.length;n++)
a[a.length]=dbNetLink.textFromNode(nl[n]);this[p]=a;}
else
this[p]=this.getNodeValue(p);break;}}
else
{var e;if(this.componentName=="DbNetGrid")
e=this.toolbarElement(p);if(typeof(e)=="undefined"||e==null)
e=document.getElementById(p);if(e)
if(e.tagName=="INPUT"&&e.type=="checkbox")
e.checked=eval(this.getNodeValue(p));else
e.value=this.getNodeValue(p)
else if(typeof(window[p])!="undefined")
window[p]=this.getNodeValue(p);}}
this.currentProfileId=id;this.fireCustomEvent(this.onProfileSelected,this);if(this.componentName=="DbNetGrid")
this.loadData();else
this.initialiseNavigator();if(this.profileCombo!=null)
this.profileCombo.value=this.currentProfileId;}
function Component_loadUserProfiles(e,emptyOption)
{var xml=this.serialize("profileKey");xml+=this.serialize("profileUser");if(!this.callService(xml,'loaduserprofiles'))
return"";if(e!=null)
{e.innerHTML="";var onchange=e.onchange;var p=e.parentNode;var tags=e.parentNode.innerHTML.split('><');p.innerHTML=tags[0]+">"+((typeof(emptyOption)=="string")?"<option value=\"\">"+emptyOption:"")+this.getNodeValue('html')+"</select>";p.childNodes[0].onchange=onchange;this.profileCombo=p.childNodes[0];}
return this.getNodeValue('html');}
function Component_addUserProfileProperties(p)
{if(!dbNetLink.testArray(p))
p=p.split(",");this.userProfileProperties=this.userProfileProperties.concat(p);}
function Component_setAccessKey(el)
{var txt=el.innerHTML;var accessKey=txt.toLowerCase().match(/<u>(.*)<\/u>/);if(accessKey)
el.accessKey=accessKey[1];}
function Component_isEncrypted(s)
{if(typeof(s)=="string")
return(s.indexOf("___")==0);else
return false;}
function Component_escape(s)
{return escape(s).replace(/\+/g,"%2B");}
function Component_selectProfile()
{if(this.profileCombo.value!="")
this.selectUserProfile(this.profileCombo.value);else if(this.profileRestore)
dbNetLink.deleteCookie(this.profileKey);}
function Component_configureSimpleSearchFilter()
{var f=this.simpleSearchFilter;if(typeof(f)=="string")
f=new Array(new Array("",f));if(typeof(f[0])=="string")
f=new Array(new Array(f[0],f[1]));this.simpleSearchFilter=f;}
cultureInfo.prototype.dpRE=null;cultureInfo.prototype.dateTimeSeparator=' ';cultureInfo.prototype.numberDecimalSeparator='.';cultureInfo.prototype.formattedDate=cultureInfo_formattedDate;cultureInfo.prototype.formatHint=cultureInfo_formatHint;cultureInfo.prototype.isDate=cultureInfo_isDate;cultureInfo.prototype.isDateTime=cultureInfo_isDateTime;cultureInfo.prototype.isNumeric=cultureInfo_isNumeric;cultureInfo.prototype.isTime=cultureInfo_isTime;cultureInfo.prototype.sizeDateTimeField=cultureInfo_sizeDateTimeField;cultureInfo.prototype.stringToJavascriptDateObject=cultureInfo_stringToJavascriptDateObject;cultureInfo.prototype.stringToDate=cultureInfo_stringToJavascriptDateObject;cultureInfo.prototype.javascriptDateObjectToString=cultureInfo_javascriptDateObjectToString;cultureInfo.prototype.dateToString=cultureInfo_javascriptDateObjectToString;function cultureInfo(comp,doc)
{var cultureInfoNode=comp.getNode('CultureInfo',doc);if(cultureInfoNode)
{for(var i=0;i<cultureInfoNode.childNodes.length;i++)
{var node=cultureInfoNode.childNodes[i];this[node.nodeName]=dbNetLink.textFromNode(node);}}
this.dpRE=new RegExp('\\'+((this.numberDecimalSeparator=='')?'.':this.numberDecimalSeparator));}
function cultureInfo_formatHint(format)
{var hint='';switch(format)
{case'd':hint=this.shortDatePattern;break;case'g':hint=this.shortDatePattern+' '+this.shortTimePattern;break;case'G':hint=this.shortDatePattern+' '+this.longTimePattern;break;case't':hint=this.shortTimePattern;break;case'T':hint=this.longTimePattern;break;default:hint=this.shortDatePattern;break;}
return hint.toLowerCase();}
function cultureInfo_stringToJavascriptDateObject(str,format)
{if(!format)
format="d";var d=null;var o=this.isDateTime(str,format,true);if(o)
{switch(format)
{case'G':var d=new Date(o.year,o.month-1,o.day,o.hour,o.mins,o.secs);break;case'g':var d=new Date(o.year,o.month-1,o.day,o.hour,o.mins,0);break;default:var d=new Date(o.year,o.month-1,o.day);break;}}
return d;}
function cultureInfo_javascriptDateObjectToString(o,format)
{if(!format)
format="d";return this.formattedDate(format,o.getFullYear(),o.getMonth()+1,o.getDate(),o.getHours(),o.getMinutes());}
function cultureInfo_isNumeric(str)
{if(this.numberDecimalSeparator!='.')
if(str.indexOf('.')>=0)
return false;return!isNaN(str.replace(this.dpRE,'.'));}
function cultureInfo_isDateTime(dateTimeValue,format,returnObject)
{if(typeof(returnObject)=='undefined')
returnObject=false;if(dateTimeValue=='')
return(returnObject)?null:false;if(typeof(format)=='undefined')
format='d';else
{var validFormats="dgGtT";if(format==''||validFormats.indexOf(format)<0)
format='d';}
var dateTimeParts=dateTimeValue.split(this.dateTimeSeparator);var rv;switch(format.toLowerCase())
{case'g':if(dateTimeParts.length==2)
{if(returnObject)
{rv=this.isDate(dateTimeParts[0],format,true);if(rv!=null)
{var o=this.isTime(dateTimeParts[1],format,true);if(o!=null)
for(var i in o)
rv[i]=o[i];}}
else
{rv=false;if(this.isDate(dateTimeParts[0],format,false))
if(this.isTime(dateTimeParts[1],format,false))
rv=true;}}
break;case'd':rv=this.isDate(dateTimeParts[0],format,returnObject);break;case't':rv=this.isTime(dateTimeParts[0],format,returnObject);break;}
return rv;}
function cultureInfo_isDate(dateValue,format,returnObject)
{if(typeof(returnObject)=='undefined')
returnObject=false;var formatParts=this.shortDatePattern.split(this.dateSeparator);var dateParts=dateValue.split(this.dateSeparator);for(var i=0;i<dateParts.length;i++)
{if(isNaN(dateParts[i]))
return(returnObject)?null:false;dateParts[i]=parseInt(dateParts[i],10);}
var obj=new Object();if(dateParts.length!=formatParts.length)
return(returnObject)?null:false;var d1=new Date();obj.month=d1.getMonth()+1;obj.year=d1.getFullYear();obj.day=d1.getDate();for(var i=0;i<formatParts.length;i++)
{switch(formatParts[i].toLowerCase())
{case'd':case'dd':obj.day=dateParts[i];break;case'y':case'yy':case'yyyy':obj.year=dateParts[i];break;case'm':case'mm':obj.month=dateParts[i];break;}}
var d2=new Date(obj.year,obj.month-1,obj.day);if(d2.getFullYear()!=obj.year||d2.getMonth()!=(obj.month-1)||d2.getDate()!=obj.day)
return(returnObject)?null:false;return(returnObject)?obj:true;}
function cultureInfo_isTime(timeValue,format,returnObject)
{if(typeof(returnObject)=='undefined')
returnObject=false;var obj=new Object();var formatParts;if(format=='g'||format=='t')
formatParts=this.shortTimePattern.split(this.timeSeparator);else
formatParts=this.longTimePattern.split(this.timeSeparator);var timeParts=timeValue.split(this.timeSeparator);for(var i=0;i<timeParts.length;i++)
{if(isNaN(timeParts[i]))
return(returnObject)?null:false;timeParts[i]=parseInt(timeParts[i],10);}
if(timeParts.length!=formatParts.length)
return(returnObject)?null:false;obj.hour=0;obj.mins=0;obj.secs=0;for(var i=0;i<formatParts.length;i++)
{switch(formatParts[i].toLowerCase())
{case'h':case'hh':obj.hour=timeParts[i];break;case'm':case'mm':obj.mins=timeParts[i];break;case's':case'ss':obj.secs=timeParts[i];break;}}
if(obj.hour>23||obj.hour<0||obj.mins>59||obj.mins<0||obj.secs>59||obj.secs<0)
return(returnObject)?null:false;return(returnObject)?obj:true;}
function cultureInfo_formattedDate(format,year,month,day,hour,min)
{var datePart='';var timePart='';if(format=='d'||format=='g'||format=='G')
{var formatParts=this.shortDatePattern.split(this.dateSeparator);var arr=new Array();for(var i=0;i<formatParts.length;i++)
{switch(formatParts[i].toLowerCase())
{case'd':case'dd':arr[arr.length]=day;break;case'm':case'mm':arr[arr.length]=month;break;case'y':case'yy':case'yyyy':arr[arr.length]=year;break;}}
datePart=arr.join(this.dateSeparator);}
if(format.toLowerCase()=='g'||format.toLowerCase()=='t')
{arr=new Array();if(format=='g'||format=='t')
formatParts=this.shortTimePattern.split(this.timeSeparator);else
formatParts=this.longTimePattern.split(this.timeSeparator);for(var i=0;i<formatParts.length;i++)
{switch(formatParts[i].toLowerCase())
{case'h':case'hh':arr[arr.length]=lz(hour);break;case'm':case'mm':arr[arr.length]=lz(min);break;case's':case'ss':arr[arr.length]='00';break;}}
timePart=arr.join(this.timeSeparator);}
if(datePart!='')
return datePart+' '+timePart;return timePart;}
function cultureInfo_sizeDateTimeField(field)
{var format='d';if(typeof(field.format!='undefined'))
if(field.format!='')
format=field.format;switch(format)
{case'd':l=10;break;case'g':l=16;break;case'G':l=19;break;case't':l=5;break;case'T':l=8;break;default:l=20;break;}
field.size=l;field.maxLength=20;}
function getElementById(rootNode,id)
{return dbNetLink.getElementById(rootNode,id);}
function disableElementById(rootNode,id,disabled)
{var el=dbNetLink.getElementById(rootNode,id);if(el)
el.disabled=disabled;}
function hideElementById(rootNode,id,visible)
{var el=dbNetLink.getElementById(rootNode,id);if(el)
el.style.display=(visible)?'block':'none';}
function setElementStyleById(rootNode,id,styleName,styleValue)
{var el=dbNetLink.getElementById(rootNode,id);if(el)
el.style[styleName]=styleValue;}
function getElementsByClassName(node,className,tagName)
{if(tagName==undefined||tagName==null)
tagName="*";var arr=node.getElementsByTagName(tagName);var ret=new Array();for(var i=0;i<arr.length;i++)
if(arr[i].className.toLowerCase()==className.toLowerCase())
ret[ret.length]=arr[i];return ret;}
function textFromNode(n)
{return dbNetLink.textFromNode(n);}
function xmlFromNode(n)
{if(n==null)
return'';if(typeof(n.xml)=='string')
return n.xml;var s=new XMLSerializer();return(s.serializeToString(n));}
function getNodeValue(doc,pattern)
{return dbNetLink.getNodeValue(doc,pattern);}
function getNode(doc,pattern)
{return dbNetLink.getNode(doc,pattern);}
function addOption(select,text,value)
{var opt=document.createElement("OPTION");opt.value=value;if(document.all)
opt.text=text;else
opt.innerHTML=text;select.options.add(opt);}
function setAccessKey(el)
{var txt=el.innerHTML;var accessKey=txt.toLowerCase().match(/<u>(.*)<\/u>/);if(accessKey)
el.accessKey=accessKey[1];}
function lz(num)
{if(num<10)
return'0'+num.toString();else
return num.toString();}
function testArray(obj)
{return dbNetLink.testArray(obj);}
function sizeDialog(centre)
{dbNetLink.sizeDialog(centre);}
function windowOpen(w)
{return dbNetLink.windowOpen(w);}
function DbNetLink_openModalDialog(url,winName,args,features)
{return dbNetLink.openDialog(url,winName,args,true,features);}
function DbNetLink_openNonModalDialog(url,winName,args,features)
{return(dbNetLink.openDialog(url,winName,args,false,features));}
function openModalDialog(url,winName,args,features)
{return dbNetLink.openDialog(url,winName,args,true,features);}
function openNonModalDialog(url,winName,args,features)
{return(dbNetLink.openDialog(url,winName,args,false,features));}
function openDialog(url,winName,args,modal,optFeatures)
{return dbNetLink.openDialog(url,winName,args,modal,optFeatures);}
function DbNetLink_openDialog(url,winName,args,modal,optFeatures)
{var top=(parseInt(window.screen.availHeight)-100)/2;var left=(parseInt(window.screen.availWidth)-100)/2;winName=winName+dbNetLink.isIE?"":"_"+new Date().valueOf();var features;if(typeof(optFeatures)=='undefined')
optFeatures='';var standardWindow=false;if(args)
standardWindow=eval(args.standardWindow)
if(window.showModalDialog&&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(typeof(window.dialogTop)!="undefined")
{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,top
if(window.outerWidth)
{left=(w-window.outerWidth)/2;top=(h-window.outerHeight)/2;}
else
{left=(w-document.getElementsByTagName('body')[0].offsetWidth)/2;top=(h-document.getElementsByTagName('body')[0].offsetHeight)/2;}
window.moveTo(left,top);}}
function repositionDialog(args)
{if(args==null)
return;if(window.dialogTop)
{window.dialogTop=args.y;window.dialogLeft=args.x;}
else
window.moveTo(args.x,args.y);}
function viewSource()
{var o=new Component();initialiseComponent(o);o.xmlRequest.open("GET",document.location.href,false);o.xmlRequest.setRequestHeader("Content-Type","text/XML");o.xmlRequest.send(null);var params=new Object();params.source=o.xmlRequest.responseText;openModalDialog('../common/viewsource.htm','viewsource',params);}
function getCoords(event)
{var o=new Object();if(!event)
{o.srcElement=window.event.srcElement;o.x=window.event.screenX;o.y=window.event.screenY;o.event=window.event;}
else
{o.srcElement=event.target||event.srcElement;o.x=event.screenX;o.y=event.screenY;o.event=event;}
return o;}
function getWindowArguments()
{try
{if(opener)
if(opener.dialogArguments)
return opener.dialogArguments[window.name];}
catch(e){}
if(window.dialogArguments)
return window.dialogArguments;return null;}
function addClassName(e,className)
{dbNetLink.addClassName(e,className);}
function removeClassName(e,className)
{dbNetLink.removeClassName(e,className);}
function $(id)
{return document.getElementById(id);}
function sleep(millisecs)
{if(window.showModalDialog)
{}
else
java.lang.Thread.sleep(millisecs);}
function arrayToOptions(str)
{var arr=eval(str);var html=new Array();for(var i=0;i<arr.length;i++)
{if(arr[i].length<2)
continue;var option="<option value='"+arr[i][0]+"'>"+arr[i][1];html[html.length]=option;}
return html.join("");}
function showMessage(str)
{dbNetLink.showMessage(str);}
function clearMessage()
{dbNetLink.clearMessage();}
function createChildNodeObject(node)
{var nodeObj=new Object();for(var j=0;j<node.childNodes.length;j++)
nodeObj[node.childNodes[j].nodeName]=dbNetLink.textFromNode(node.childNodes[j]);return(nodeObj);}
function getParentElement(e,tagName)
{while(e.tagName!=tagName.toUpperCase())
{if(e.parentNode)
e=e.parentNode;else
break;}
return e;}
if(typeof(DOMParser)!="undefined")
_loadMozillaCompatLayer();function _loadMozillaCompatLayer()
{if(typeof HTMLElement!="undefined"&&!HTMLElement.prototype.insertAdjacentElement)
{HTMLElement.prototype.insertAdjacentElement=function(where,parsedNode)
{switch(where)
{case'beforeBegin':this.parentNode.insertBefore(parsedNode,this);break;case'afterBegin':this.insertBefore(parsedNode,this.firstChild);break;case'beforeEnd':this.appendChild(parsedNode);break;case'afterEnd':if(this.nextSibling)
this.parentNode.insertBefore(parsedNode,this.nextSibling);else
this.parentNode.appendChild(parsedNode);break;}}
HTMLElement.prototype.insertAdjacentHTML=function(where,htmlStr)
{var r=this.ownerDocument.createRange();r.setStartBefore(this);var parsedHTML=r.createContextualFragment(htmlStr);this.insertAdjacentElement(where,parsedHTML);}
HTMLElement.prototype.insertAdjacentText=function(where,txtStr)
{var parsedText=document.createTextNode(txtStr);this.insertAdjacentElement(where,parsedText);}}
if(document.implementation&&document.implementation.createDocument)
{XMLDocument.prototype.selectNodes=function(sExpr,contextNode)
{var oResult=this.evaluate(sExpr,(contextNode?contextNode:this),this.createNSResolver(this.documentElement),XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);var nodeList=new Array(oResult.snapshotLength);nodeList.expr=sExpr;for(i=0;i<nodeList.length;i++)
nodeList[i]=oResult.snapshotItem(i);return nodeList;};Element.prototype.selectNodes=function(sExpr)
{var doc=this.ownerDocument;if(doc.selectNodes)
return doc.selectNodes(sExpr,this);else
throw"Method selectNodes is only supported by XML Nodes";};XMLDocument.prototype.selectSingleNode=function(sExpr,contextNode)
{var ctx=contextNode?contextNode:null;sExpr+="[1]";var nodeList=this.selectNodes(sExpr,ctx);if(nodeList.length>0)
return nodeList[0];else
return null;};Element.prototype.selectSingleNode=function(sExpr)
{var doc=this.ownerDocument;if(doc.selectSingleNode)
return doc.selectSingleNode(sExpr,this);else
throw"Method selectSingleNode is only supported by XML Nodes";};HTMLElement.prototype.__defineGetter__("parentElement",function()
{return(this.parentNode==this.ownerDocument)?null:this.parentNode;});var _emptyTags={"IMG":true,"BR":true,"INPUT":true,"META":true,"LINK":true,"PARAM":true,"HR":true};HTMLElement.prototype.__defineGetter__("outerHTML",function(){var attrs=this.attributes;var str="<"+this.tagName;for(var i=0;i<attrs.length;i++)
str+=" "+attrs[i].name+"=\""+attrs[i].value+"\"";if(_emptyTags[this.tagName])
return str+">";return str+">"+this.innerHTML+"</"+this.tagName+">";});HTMLElement.prototype.__defineSetter__("outerHTML",function(sHTML){var r=this.ownerDocument.createRange();r.setStartBefore(this);var df=r.createContextualFragment(sHTML);this.parentNode.replaceChild(df,this);});HTMLElement.prototype.__defineGetter__("innerText",function(){var tmp=this.innerHTML.replace(/<br>/gi,"\n");return tmp.replace(/<[^>]+>/g,"");});HTMLElement.prototype.__defineSetter__("innerText",function(txtStr){var parsedText=document.createTextNode(txtStr);this.innerHTML="";this.appendChild(parsedText);});HTMLElement.prototype.click=function(){var evt=this.ownerDocument.createEvent('MouseEvents');evt.initMouseEvent('click',true,true,this.ownerDocument.defaultView,1,0,0,0,0,false,false,false,false,0,null);this.dispatchEvent(evt);}}}
DbNetCombo.prototype.componentName='DbNetCombo';DbNetCombo.prototype.configLang='default';DbNetCombo.prototype.addLinkedCombo=DbNetCombo_addLinkedCombo;DbNetCombo.prototype.build=DbNetCombo_build;DbNetCombo.prototype.clear=DbNetCombo_clear;DbNetCombo.prototype.getAttribute=DbNetCombo_getAttribute;DbNetCombo.prototype.load=DbNetCombo_load;DbNetCombo.prototype.processOnChange=DbNetCombo_processOnChange;DbNetCombo.prototype.send=DbNetCombo_send;DbNetCombo.prototype.setAutoComplete=DbNetCombo_setAutoComplete;DbNetCombo.prototype.showErrorWin=DbNetCombo_showErrorWin;DbNetCombo.prototype._text=DbNetCombo_text;DbNetCombo.prototype._value=DbNetCombo_value;function DbNetCombo(id,connectionString,sql)
{var e=id;initialiseComponent(this);switch(typeof(id))
{case"string":e=$(e);break;}
if(!e)
{this.checkDOM(id);return;}
this.combo=e;this.queryParameters=new Object();this.linkedCombos=new Array();if(this.combo.onchange==null)
this.combo.onchange=this.assignHandler("processOnChange");if(this.combo)
{this.combo.DbNetCombo=this;this.setAutoComplete();}}
function DbNetCombo_send(xml,mode)
{xml+=this.serialize("connectionString");xml+=this.serialize("dateFormat");return this.callService(xml,mode);}
function DbNetCombo_showErrorWin(text)
{try
{var w=window.open("about:blank",null,'status=no,resizable=yes');w.document.write(text);}
catch(e)
{alert("Cannot create error window.");}}
function DbNetCombo_load(addEmptyOption)
{var msg='';if(this.combo==null)
msg='Combo property has not been assigned';else if(this.sql=='')
msg='SQL property has not been assigned';if(msg!='')
{alert(msg);return false;}
var xml=this.serialize("sql");xml+=this.serialize("queryParameters",null,true);xml+=this.serialize("textColumn");xml+=this.serialize("valueColumn");if(typeof(addEmptyOption)=="boolean")
this.addEmptyOption=addEmptyOption;if(!this.send(xml,'data'))
return null;this.build();}
function DbNetCombo_build()
{this.comboId=this.combo.id;var propertyList;if(this.properties==null)
{this.properties=new Object();propertyList=this.combo;}
else
propertyList=this.properties;for(p in propertyList)
{if(typeof(this.combo[p])=='function')
this.properties[p]=this.combo[p];}
this.clear();var restoreProperties=false;if(!this.isIE)
{var selectParts=this.combo.outerHTML.split('><');this.combo.outerHTML=selectParts[0]+'>'+(this.addEmptyOption?'<option>'+this.emptyOptionText:'')+this.getNodeValue("html")+'<'+selectParts[1];restoreProperties=true;}
else if(dbNetLink.isSafari)
{this.combo.innerHTML=(this.addEmptyOption?'<option>'+this.emptyOptionText:'')+this.getNodeValue("html");}
else
{if(this.combo.parentNode.childNodes.length==1)
{var selectParts=this.combo.parentNode.innerHTML.split('><');this.combo.parentNode.innerHTML=selectParts[0]+'>'+(this.addEmptyOption?'<option>'+this.emptyOptionText:'')+this.getNodeValue("html")+'<'+selectParts[1];restoreProperties=true;}
else
{var re=/ ([\w ]*)=\"([^\"]*)\"/;var options=this.getNodeValue("html").split("<option");for(var i in options)
{var properties=new Object();while(true)
{var m=options[i].match(re);if(m==null)
break;properties[m[1]]=m[2];options[i]=options[i].replace(m[0],"");}
if(options[i]=="")
continue;var opt=document.createElement("option");for(p in properties)
opt[p]=properties[p];opt.innerHTML=options[i].replace(">","");this.combo.options.add(opt);}}}
this.combo=$(this.comboId);this.combo.DbNetCombo=this;if(restoreProperties)
for(p in this.properties)
this.combo[p]=this.properties[p];var o=this;this.setAutoComplete();if(this.combo.options.length>0)
this.combo.selectedIndex=0;this.fireCustomEvent(this.onLoaded,this);this.processOnChange();}
function DbNetCombo_clear()
{if($(this.comboId)==null)
return;if(document.all)
this.combo.outerHTML=this.combo.outerHTML.replace(/<option(.*)<\/select>/i,'</select>');else
this.combo.innerHTML="";this.combo=$(this.comboId);this.processOnChange();}
function DbNetCombo_getAttribute(name)
{if(this.combo.selectedIndex==-1)
return"";else
return this.combo.options[this.combo.selectedIndex].getAttribute(name);}
function DbNetCombo_text()
{if(this.combo.selectedIndex==-1)
return"";else
return this.combo.options[this.combo.selectedIndex].text;}
function DbNetCombo_value()
{if(this.combo.selectedIndex==-1)
return"";else
return this.combo.value;}
function DbNetCombo_setAutoComplete(ac)
{if(ac)
this.autoComplete=eval(ac);if(eval(this.autoComplete)&& !this.isIE)
this.combo.addBehavior(this.virtualDir+"select.htc");}
function DbNetCombo_addLinkedCombo(combo,parameterName)
{var o=new Object;o.combo=combo;o.parameterName=parameterName;this.linkedCombos[this.linkedCombos.length]=o;}
function DbNetCombo_processOnChange()
{this.text=this._text();this.value=this._value();for(var i=0;i<this.linkedCombos.length;i++)
{var o=this.linkedCombos[i];if(this.combo.options.length>0&&this.combo.value!="")
{o.combo.queryParameters[o.parameterName]=this.combo.value;o.combo.load();}
else
{o.combo.clear();}}
this.fireCustomEvent(this.onChange,this);}