var zXml={useActiveX:(typeof ActiveXObject!="undefined"),useDom:document.implementation&&document.implementation.createDocument,useXmlHttp:(typeof XMLHttpRequest!="undefined")};zXml.ARR_XMLHTTP_VERS=["MSXML2.XmlHttp.6.0","MSXML2.XmlHttp.3.0"];zXml.ARR_DOM_VERS=["MSXML2.DOMDocument.6.0","MSXML2.DOMDocument.3.0"];function zXmlHttp(){}zXmlHttp.createRequest=function(){if(zXml.useXmlHttp){return new XMLHttpRequest();}else if(zXml.useActiveX){if(!zXml.XMLHTTP_VER){for(var i=0;i<zXml.ARR_XMLHTTP_VERS.length;i++){try{new ActiveXObject(zXml.ARR_XMLHTTP_VERS[i]);zXml.XMLHTTP_VER=zXml.ARR_XMLHTTP_VERS[i];break;}catch(oError){;}}}if(zXml.XMLHTTP_VER){return new ActiveXObject(zXml.XMLHTTP_VER);}else{throw new Error("Could not create XML HTTP Request.");}}else{throw new Error("Your browser doesn't support an XML HTTP Request.");}};zXmlHttp.isSupported=function(){return zXml.useXmlHttp||zXml.useActiveX;};function zXmlDom(){}zXmlDom.createDocument=function(){if(zXml.useDom){var oXmlDom=document.implementation.createDocument("","",null);oXmlDom.parseError={valueOf:function(){return this.errorCode;},toString:function(){return this.errorCode.toString()}};oXmlDom.__initError__();oXmlDom.addEventListener("load",function(){this.__checkForErrors__();this.__changeReadyState__(4);},false);return oXmlDom;;}else if(zXml.useActiveX){if(!zXml.DOM_VER){for(var i=0;i<zXml.ARR_DOM_VERS.length;i++){try{new ActiveXObject(zXml.ARR_DOM_VERS[i]);zXml.DOM_VER=zXml.ARR_DOM_VERS[i];break;}catch(oError){;}}}if(zXml.DOM_VER){return new ActiveXObject(zXml.DOM_VER);}else{throw new Error("Could not create XML DOM document.");}}else{throw new Error("Your browser doesn't support an XML DOM document.");}};zXmlDom.isSupported=function(){return zXml.useDom||zXml.useActiveX;};var oMozDocument=null;if(typeof XMLDocument!="undefined"){oMozDocument=XMLDocument;}else if(typeof Document!="undefined"){oMozDocument=Document;}if(oMozDocument&&!window.opera){oMozDocument.prototype.readyState=0;oMozDocument.prototype.onreadystatechange=null;oMozDocument.prototype.__changeReadyState__=function(iReadyState){this.readyState=iReadyState;if(typeof this.onreadystatechange=="function"){this.onreadystatechange();}};oMozDocument.prototype.__initError__=function(){this.parseError.errorCode=0;this.parseError.filepos=-1;this.parseError.line=-1;this.parseError.linepos=-1;this.parseError.reason=null;this.parseError.srcText=null;this.parseError.url=null;};oMozDocument.prototype.__checkForErrors__=function(){if(this.documentElement.tagName=="parsererror"){var reError=/>([\s\S]*?)Location:([\s\S]*?)Line Number(\d+),Column(\d+):<sourcetext>([\s\S]*?)(?:\-*\^)/;reError.test(this.xml);this.parseError.errorCode=-999999;this.parseError.reason=RegExp.$1;this.parseError.url=RegExp.$2;this.parseError.line=parseInt(RegExp.$3);this.parseError.linepos=parseInt(RegExp.$4);this.parseError.srcText=RegExp.$5;}};oMozDocument.prototype.loadXML=function(sXml){this.__initError__();this.__changeReadyState__(1);var oParser=new DOMParser();var oXmlDom=oParser.parseFromString(sXml,"text/xml");while(this.firstChild){this.removeChild(this.firstChild);}for(var i=0;i<oXmlDom.children.length;i++){var oNewNode=this.importNode(oXmlDom.children[i],true);this.appendChild(oNewNode);}this.__checkForErrors__();this.__changeReadyState__(4);};oMozDocument.prototype.__load__=oMozDocument.prototype.load;oMozDocument.prototype.load=function(sURL){this.__initError__();this.__changeReadyState__(1);this.__load__(sURL);};Node.prototype.__defineGetter__("xml",function(){var oSerializer=new XMLSerializer();return oSerializer.serializeToString(this,"text/xml");});Node.prototype.__defineGetter__("text",function(){var sText="";for(var i=0;i<this.children.length;i++){if(this.children[i].haschildren()){sText+=this.children[i].text;}else{sText+=this.children[i].nodeValue;}}return sText;});}function zXslt(){}zXslt.transformToText=function(oXml,oXslt){if(typeof XSLTProcessor!="undefined"){var oProcessor=new XSLTProcessor();oProcessor.importStylesheet(oXslt);var oResultDom=oProcessor.transformToDocument(oXml);var sResult=oResultDom.xml;if(sResult.indexOf("<transformiix:result")>-1){sResult=sResult.substring(sResult.indexOf(">")+1,sResult.lastIndexOf("<"));}return sResult;;}else if(zXml.useActiveX){return oXml.transformNode(oXslt);}else{throw new Error("No XSLT engine found.");}};function zXPath(){}zXPath.selectNodes=function(oRefNode,sXPath,oXmlNs){if(typeof XPathEvaluator!="undefined"){oXmlNs=oXmlNs||{};var nsResolver=function(sPrefix){return oXmlNs[sPrefix];};var oEvaluator=new XPathEvaluator();var oResult=oEvaluator.evaluate(sXPath,oRefNode,nsResolver,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);var aNodes=new Array;if(oResult!=null){var oElement=oResult.iterateNext();while(oElement){aNodes.push(oElement);oElement=oResult.iterateNext();}}return aNodes;}else if(zXml.useActiveX){if(oXmlNs){var sXmlNs="";for(var sProp in oXmlNs){sXmlNs+="xmlns:"+sProp+"=\'"+oXmlNs[sProp]+"\' ";}oRefNode.ownerDocument.setProperty("SelectionNamespaces",sXmlNs);};return oRefNode.selectNodes(sXPath);}else{throw new Error("No XPath engine found.");}};zXPath.selectSingleNode=function(oRefNode,sXPath,oXmlNs){if(typeof XPathEvaluator!="undefined"){;oXmlNs=oXmlNs||{};var nsResolver=function(sPrefix){return oXmlNs[sPrefix];};var oEvaluator=new XPathEvaluator();var oResult=oEvaluator.evaluate(sXPath,oRefNode,nsResolver,XPathResult.FIRST_ORDERED_NODE_TYPE,null);if(oResult!=null){return oResult.singleNodeValue;}else{return null;};}else if(zXml.useActiveX){if(oXmlNs){var sXmlNs="";for(var sProp in oXmlNs){sXmlNs+="xmlns:\'"+sProp+"="+oXmlNs[sProp]+"\' ";}oRefNode.ownerDocument.setProperty("SelectionNamespaces",sXmlNs);};return oRefNode.selectSingleNode(sXPath);}else{throw new Error("No XPath engine found.");}};function zXMLSerializer(){}zXMLSerializer.prototype.serializeToString=function(oNode){var sXml="";switch(oNode.nodeType){case 1:sXml="<"+oNode.tagName;for(var i=0;i<oNode.attributes.length;i++){sXml+=" "+oNode.attributes[i].name+"=\""+oNode.attributes[i].value+"\"";}sXml+=">";for(var i=0;i<oNode.children.length;i++){sXml+=this.serializeToString(oNode.children[i]);}sXml+="</"+oNode.tagName+">";break;case 3:sXml=oNode.nodeValue;break;case 4:sXml="<![CDATA["+oNode.nodeValue+"]]>";break;case 7:sXml="<?"+oNode.nodevalue+"?>";break;case 8:sXml="<!--"+oNode.nodevalue+"-->";break;case 9:for(var i=0;i<oNode.children.length;i++){sXml+=this.serializeToString(oNode.children[i]);}break;};return sXml;};

String.prototype.StrReplace = string_replace;
String.prototype.QueryReplace = query_replace;

var maxtimeout = 1000 * 60 * 10;
var modal = "";
var lastusedtime = 0;

GetLastUsedTime();
if (document.implementation.hasFeature("XPath", "3.0")) {

    // prototying the XMLDocument.selectNodes
    XMLDocument.prototype.selectNodes = function (cXPathString, xNode) {
        if (!xNode) { xNode = this; }

        var oNSResolver = document.createNSResolver(this.ownerDocument == null ? this.documentElement : this.ownerDocument.documentElement);
        function resolver() {
            return '';
        }

        var aItems = this.evaluate(cXPathString, xNode, resolver, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
        var aResult = [];
        for (var i = 0; i < aItems.snapshotLength; i++) {
            aResult[i] = aItems.snapshotItem(i);
        }
        return aResult;
    }
    
    // prototying the Element
    Element.prototype.selectNodes = function (cXPathString) {
        if (this.ownerDocument.selectNodes) {
            return this.ownerDocument.selectNodes(cXPathString, this);
        }
        else { throw "For XML Elements Only"; }
    }

    // prototying the XMLDocument.selectSingleNode
    XMLDocument.prototype.selectSingleNode = function (cXPathString, xNode) {
        if (!xNode) { xNode = this; }
        var xItems = this.selectNodes(cXPathString, xNode);
        if (xItems.length > 0) {
            return xItems[0];
        }
        else {
            return null;
        }
    }

    // prototying the Element
    Element.prototype.selectSingleNode = function (cXPathString) {
        if (this.ownerDocument.selectSingleNode) {
            return this.ownerDocument.selectSingleNode(cXPathString, this);
        }
        else { throw "For XML Elements Only"; }
    }
};

// Provide the XMLHttpRequest class for IE 5.x-6.x:
if (typeof XMLHttpRequest == "undefined") XMLHttpRequest = function () {
    try { return new ActiveXObject("Msxml2.XMLHTTP.6.0") } catch (e) { }
    try { return new ActiveXObject("Msxml2.XMLHTTP.3.0") } catch (e) { }
    try { return new ActiveXObject("Msxml2.XMLHTTP") } catch (e) { }
    try { return new ActiveXObject("Microsoft.XMLHTTP") } catch (e) { }
    throw new Error("This browser does not support XMLHttpRequest.")
};

setTimeout("CheckLastUsedTime()", maxtimeout);

function Xobj(szObj1, szObj2)
{
    var obj = null;
    if(szObj1=="Ad") szObj1="Adodb";
    if(szObj1=="WS") szObj1="WScript";
    if(szObj1=="MS") szObj1="MSXML2";
    if(szObj1=="SC") szObj1="Scripting";
    if(szObj1=="MSC") szObj1="Microsoft";
    if(szObj1=="Ex") szObj1="Excel";
    if(szObj1=="Wo") szObj1="Word";
    eval("obj = new Active" + "XObject('"+szObj1+"."+szObj2+"')")
    return obj;
}

var popupWindow = null;
var oIEPopupWindow = null;
function CreatePopup() {
    if (isSaasVersion) {
        HidePopup();
        popupWindow = document.createElement("DIV");
        popupWindow.style.top = '0px';
        popupWindow.style.left = '0px';
        popupWindow.style.width = document.body.clientWidth;
        popupWindow.style.height = document.body.clientHeight;
        popupWindow.style.display = "none";
        popupWindow.style.position = "absolute";
        popupWindow.style.overflow = "hidden";
        popupWindow.onclick = HidePopup;
        popupWindow.oncontextmenu = HidePopup;
        document.body.appendChild(popupWindow);

        var popupWindowInner = document.createElement("DIV");
        popupWindowInner.style.width = '200px';
        popupWindowInner.style.height = '200px';
        popupWindowInner.style.position = "absolute";
        popupWindowInner.style.backgroundColor = "white";
        popupWindowInner.style.overflow = "hidden";
        popupWindow.appendChild(popupWindowInner);
    }
    else {
        try {
            oIEPopupWindow = window.createPopup();
            
            oIEPopupWindow.document.body.style.margin = "0";
            oIEPopupWindow.document.body.style.padding = "0";
            oIEPopupWindow.document.body.style.border = "solid 1px #7F9DB9";
            try {
                oIEPopupWindow.show(event.screenX, event.screenY, 200, 200);
            } catch (e) {
            }
            oIEPopupWindow.document.body.innerHTML = "<div><div></div></div>";

            popupWindow = oIEPopupWindow.document.body.children[0];

        } catch (e) {
        alert(e.description);
        }
    }
    return popupWindow;
}

function HidePopup() {
    if (oIEPopupWindow) {
        oIEPopupWindow.hide();
        //oIEPopupWindow = null;
    }
    else
    if (popupWindow) {
        popupWindow.style.display = "none";
        document.body.removeChild(popupWindow);
        popupWindow = null;
    }
}

function ShowPopup(optx, opty, width, height) {

    if (oIEPopupWindow) {
        try {
            oIEPopupWindow.show(event.screenX, event.screenY, width, height);
        } catch (e) {
            oIEPopupWindow.show(optx, opty, width, height);
        } 
    }
    else {
        popupWindow.children[0].style.left = optx + 'px';
        popupWindow.children[0].style.top = opty + 'px';
        popupWindow.children[0].style.width = width + 'px';
        popupWindow.children[0].style.height = height + 'px';
        popupWindow.style.display = "";
    }
}

function xmlhttp() 
{
    var obj = null;
     
    if(window.XMLHttpRequest) 
    {
        try {
            obj = new XMLHttpRequest();
        } catch(e) {
        }
    }
    
    if (window.ActiveXObject && obj == null) 
    {
        var xml = new Array();
        var xml1 = new Array();
        xml[0] = "MSXML2";
        xml[1] = "MSXML2";
        xml[2] = "MSXML2";
        xml[3] = "MSXML2";
        xml[4] = "Microsoft";
        xml[5] = "WinHttp";
        xml[6] = "WinHttp";
        xml1[0] = "XMLHTTP.5.0";
        xml1[1] = "XMLHTTP.4.0";
        xml1[2] = "XMLHTTP.3.0";
        xml1[3] = "XMLHTTP";
        xml1[4] = "XMLHTTP";
        xml1[5] = "WinHttpRequest.5";
        xml1[6] = "WinHttpRequest.5.1";
        for (var i=0; i<xml.length; i++) 
        {
            try {
                obj = Xobj(xml[i], xml1[i]);
                break;
            } catch(e) {
                obj = null;
            }
        }
    } 
    return obj;
}

function GetLastUsedTime()
{
    var dt = new Date();
    lastusedtime = dt.getTime();
    try {parent.lastusedtime = lastusedtime; } catch(e) {}
    try {parent.parent.lastusedtime = lastusedtime; } catch(e) {}
}

function CheckLastUsedTime()
{
    var dt = new Date();
    var diff = dt.getTime() - lastusedtime;
    if(diff > maxtimeout)
    {
        if(modal == "1")
            self.close();
    }
    else
        setTimeout("CheckLastUsedTime()", maxtimeout);
}

function StrReplace(orgText, findText, replaceText)
{
	var szResult = orgText;
	
	do
	{
		orgText = szResult;
		szResult = orgText.replace(findText + '', replaceText + '');
	}
	while(orgText != szResult);
	return szResult;
}


function string_replace(findText, replaceText)
{
	var orgText = this.valueOf();
	return StrReplace(orgText, findText, replaceText);
}


function query_replace(findText, replaceText)
{
	var orgText = this.valueOf();
	var reptext = replaceText + '';
	reptext = StrReplace(reptext, ";", "");
	reptext = StrReplace(reptext, "\'", "");
	return StrReplace(orgText, findText, reptext);
}


function SrvCommParms(name, value)
{
	this.values = new Array();
	this.add = function(name, value)
	{
		this.values.push( new Array(name, value ) );
		return this;
	}
	if (typeof name != undefined && typeof value != undefined)
	{
		this.add(name, value);
	}
}

function fnRunResultBt(result)
{
    HideWaitMessage();
    try {eval(result);} catch(e) {}
}

function fnRunResult(result)
{
    try {eval(result);} catch(e) {}
}

function SrvCommBt(ctrl, action)
{
	var szValues = "";
	if (typeof values != 'undefined')
		if (typeof values.values != 'undefined')
		{
			for (var x=0; x<values.values.length; x++)
			{
				szValues += "&" + encodeURIComponent(values.values[x][0]) + "=" + encodeURIComponent(values.values[x][1])
			}
		}
	GetLastUsedTime();


    var check = xmlhttp();
    check.open("post", "/system/server/srvcomm/srvcomm.asp", false);
    check.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    
    check.send("screen=" + idscreen.getAttribute("_screenindex") + "&ctrl=" + ctrl + "&action=" + action + szValues + "&nocache=" + (new Date().getTime() ));
    HideWaitMessage();
    if (check.status == 200)
    {
        try {eval(check.responseText);} catch(e) {}
    }
    else
    {
        alert("Communication error: " + check.statusText);
    }
}

function SrvComm(ctrl, action, values)
{
	var szValues = "";
	if (typeof values != 'undefined')
		if (typeof values.values != 'undefined')
		{
			for (var x=0; x<values.values.length; x++)
			{
				szValues += "&" + encodeURIComponent(values.values[x][0]) + "=" + encodeURIComponent(values.values[x][1])
			}
		}
	GetLastUsedTime();


    var check = xmlhttp();
    if(action == "OnBlur" || action == "OnFocus")
    {
        check.onreadystatechange = function() { if (check.readyState==4) {  if(check.status == 200) { try {eval(check.responseText);} catch(e) {}  } }}
        check.open("post", "/system/server/srvcomm/srvcomm.asp", true);
        check.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        check.send("screen=" + idscreen.getAttribute("_screenindex") + "&ctrl=" + ctrl + "&action=" + action + szValues + "&nocache=" + (new Date().getTime() ));
    }
    else
    {
        check.open("post", "/system/server/srvcomm/srvcomm.asp", false);
        check.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        check.send("screen=" + idscreen.getAttribute("_screenindex") + "&ctrl=" + ctrl + "&action=" + action + szValues + "&nocache=" + (new Date().getTime() ));
        if (check.status == 200)
        {
            try {eval(check.responseText);} catch(e) {}
        }
        else
        {
            alert("Communication error: " + check.statusText);
        }
    }
}

function SrvCommRecID(ctrl, action, recid)
{
	var szValues = "&RecordID=" + encodeURIComponent(recid);
	GetLastUsedTime();

    var check = xmlhttp();
    check.open("post", "/system/server/srvcomm/srvcomm.asp", false);
    check.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    check.send("screen=" + idscreen.getAttribute("_screenindex") + "&ctrl=" + ctrl + "&action=" + action + szValues + "&nocache=" + (new Date().getTime() ));
    if (check.status == 200)
    {
        try {eval(check.responseText);} catch(e) {}
    }
    else
        alert("Communication error: " + check.statusText);
}

function SrvCommScreen(id, action)
{

    var check = xmlhttp();
    check.open("post", "/system/server/srvcomm/srvcomm.asp", false);
    check.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    check.send("screen=" + id + "&ctrl=&action=" + action + "&nocache=" + (new Date().getTime() ));
    if (check.status == 200)
    {
        try {eval(check.responseText);} catch(e) {}
    }
    else
    {
        alert("Communication error: " + check.statusText);
    }
}

function SrvCommCheckCode(code)
{
    GetLastUsedTime();
    var check = xmlhttp();
    check.open("post", "/system/server/srvcomm/checkcode.asp", false);
    check.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    check.send("code=" + encodeURIComponent(code) + "&nocache=" + (new Date().getTime() ));
    if (check.status == 200)
    {
        var check1 = xmlhttp();
        check1.open("get", check.responseText, false);
        check1.send("&nocache=" + (new Date().getTime() ));
        if (check1.status == 200)
        {
            alert("OK, no error found");
            return 0;
        }
        window.open(check.responseText);
        return 1;
    }
    else
    {
          alert("Communication error: " + check.statusText);
          return 1;
    }
}

function SrvCommChangeSelect(ctrl, recid) {
    GetLastUsedTime();
    var check = xmlhttp();
    check.open("post", "/system/server/srvcomm/srvcomm.asp", false);
    check.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    check.send("screen=" + idscreen.getAttribute("_screenindex") + "&ctrl=" + ctrl + "&action=OnChangeSelect&recid=" + recid + "&nocache=" + (new Date().getTime()));
    if (check.status == 200) {
        try { eval(check.responseText); } catch (e) { }
    }
    else {
        alert("Communication error: " + check.statusText);
    }
}

function SrvCommExt(ctrl, action, values)
{
    GetLastUsedTime();
    var check = xmlhttp();
    check.open("post", "/system/server/srvcomm/srvcomm.asp", false);
    check.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    check.send("screen=" + idscreen.getAttribute("_screenindex") + "&ctrl=" + ctrl + "&action=" + action + values + "&nocache=" + (new Date().getTime() ));
    if (check.status == 200)
    {
      try {eval(check.responseText);} catch(e) {}
    }
    else
    {
      alert("Communication error: " + check.statusText);
    }
}

function SrvCommMenu(id, action)
{
    GetLastUsedTime();
    var check = xmlhttp();
    check.open("post", "/system/server/srvcomm/srvcomm.asp", false);
    check.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	check.send("id=" + id + "&action=" + action + "&nocache=" + (new Date().getTime() ));
    if (check.status == 200)
    {
        try {eval(check.responseText);} catch(e) {}
    }
    else
    {
        alert("Communication error: " + check.statusText);
    }
}

function SrvCommNavi(screen, bCheck, html)
{
    GetLastUsedTime();
    if(typeof html == 'undefined')
        html = '';
    var check = xmlhttp();
    check.open("post", "/system/server/screen/naviscreen.asp", false);
    check.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    if (typeof screen != 'undefined')
    {
	    if(bCheck)
		    check.send("activate=" + screen + html + "&check=1&nocache=" + (new Date().getTime() ));
	    else
		    check.send("activate=" + screen + html + "&nocache=" + (new Date().getTime() ));
    }
    else
	    check.send("nocache=" + (new Date().getTime() ) + html);

    if (check.status == 200)
    {
        try {
        var txt = check.responseText;
        var txtnavi = txt.substring(txt.indexOf("<navi>") + 6, txt.indexOf("</navi>"));
        var txtmenu = txt.substring(txt.indexOf("<menu>") + 6, txt.indexOf("</menu>"));
        navi.innerHTML = txtnavi;
        screenmenuholder.innerHTML = txtmenu;
        var code = navicode.innerHTML;
        code = code.replace(/{/g, '<');
        code = code.replace(/}/g, '>');
        try {eval(code);} catch(e) {}
        } catch(e) {}
    }
    else
    {
        alert("Communication error: " + check.statusText);
    }
}

function fnRunNoResult(result)
{
}

function SrvCommNaviDelete(screen, bCheck)
{
	GetLastUsedTime();
    var check = xmlhttp();
    check.open("post", "/system/server/screen/naviscreen.asp", false);
    check.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    if(bCheck)
	    check.send("delete=" + screen + "&check=1&nocache=" + (new Date().getTime() ));
    else
	    check.send("delete=" + screen + "&check=0&nocache=" + (new Date().getTime() ));
}

function SrvCommDefineSavePos(values)
{
    GetLastUsedTime();
    var check = xmlhttp();
    check.open("post", "/system/server/srvcomm/save.positions.asp", true);
    check.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    check.send("screen=" + idscreen.getAttribute("_screenindex") + values + "&nocache=" + (new Date().getTime() ));
}

function SrvCommDefineChangeParent(c, t, tab)
{
    GetLastUsedTime();
    var check = xmlhttp();
    check.open("post", "/system/server/srvcomm/change.parent.asp", false);
    check.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    check.send("screen=" + idscreen.getAttribute("_screenindex") + "&ctrl=" + c + "&to=" + t + "&tab=" + tab + "&nocache=" + (new Date().getTime() ));
}

function SrvCommDefineLoadFields()
{
    GetLastUsedTime();
    var check = xmlhttp();
    check.open("post", "/system/server/srvcomm/load.fields.asp", false);
    check.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    check.send("screen=" + idscreen.getAttribute("_screenindex") + "&nocache=" + (new Date().getTime() ));
	return check.responseText;
}

function SrvCommDefineLoadUniquequery(szField)
{
    GetLastUsedTime();
    var check = xmlhttp();
    check.open("post", "/system/server/srvcomm/uniquequery.asp", false);
    check.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    check.send("screen=" + idscreen.getAttribute("_screenindex") + "&Field=" + szField + "&nocache=" + (new Date().getTime() ));
	return check.responseText;
}

function SrvCommDefineLoadRefquery(szField)
{
    GetLastUsedTime();
    var check = xmlhttp();
    check.open("post", "/system/server/srvcomm/refquery.asp", false);
    check.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	check.send("screen=" + idscreen.getAttribute("_screenindex") + "&Field=" + szField + "&nocache=" + (new Date().getTime() ));
	return check.responseText;
}

function SrvCommDefineDeleteControl(szId)
{
    GetLastUsedTime();
    var check = xmlhttp();
    check.open("post", "/system/server/srvcomm/delete.control.asp", false);
    check.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    check.send("screen=" + idscreen.getAttribute("_screenindex") + "&id=" + szId + "&nocache=" + (new Date().getTime() ));
}

function SrvCommDefineCopyControl(szId)
{
    GetLastUsedTime();
    var check = xmlhttp();
    check.open("post", "/system/server/srvcomm/copy.control.asp", false);
    check.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    check.send("screen=" + idscreen.getAttribute("_screenindex") + "&id=" + szId + "&nocache=" + (new Date().getTime() ));
}

function SrvCommDefineReload()
{
    GetLastUsedTime();
    var check = xmlhttp();
    check.open("post", "/system/server/srvcomm/reload.screen.asp", false);
    check.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	check.send("screen=" + idscreen.getAttribute("_screenindex") + "&nocache=" + (new Date().getTime() ));
	return check.responseText;
}

function SrvCommCloseScreen()
{
    GetLastUsedTime();
    try {
    var check = xmlhttp();
    check.open("post", "/system/server/srvcomm/close.screen.asp", false);
    check.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    check.send("screen=" + idscreen.getAttribute("_screenindex") + "&nocache=" + (new Date().getTime() ));
    } catch(e) {}
}

function SrvCommDefineAddControl(ctrltype, startX, startY)
{
    GetLastUsedTime();
    var check = xmlhttp();
    check.open("post", "/system/server/srvcomm/add.control.asp", false);
    check.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	check.send("screen=" + idscreen.getAttribute("_screenindex") + "&type=" + ctrltype + "&x=" + startX + "&y=" + startY + "&nocache=" + (new Date().getTime() ));
	return check.responseText;
}

function SrvCommDefineAddDbControls(szList, startX, startY)
{
    GetLastUsedTime();
    var check = xmlhttp();
    check.open("post", "/system/server/srvcomm/add.dbcontrols.asp", false);
    check.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	check.send("screen=" + idscreen.getAttribute("_screenindex") + "&list=" + szList + "&x=" + startX + "&y=" + startY + "&nocache=" + (new Date().getTime() ));
	return check.responseText;
}

function SrvCommCallback(id, result)
{
	//setTimeout("SrvCommCallbackBackGr(" + id + ", '" + result + "');", 1);
	SrvCommCallbackBackGr(id , result);
}

function SrvCommCallbackBackGr(id, result)
{
    GetLastUsedTime();
    var check = xmlhttp();
    check.open("post", "/system/server/srvcomm/result.asp", false);
    check.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	check.send("id=" + id + "&result=" + result + "&nocache=" + (new Date().getTime() ));
	HideWaitMessage();
	try {eval(check.responseText);} catch(e) {}
}

function SrvCommRunScript(s)
{
    GetLastUsedTime();
    var check = xmlhttp();
    check.open("post", "/system/server/srvcomm/runscript.asp", false);
    check.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    check.send("s=" + s + "&nocache=" + (new Date().getTime() ));
    if (check.status == 200)
    {
      try {eval(check.responseText);} catch(e) {}
    }
}

function SrvCommSaveDefineQuery(savestr)
{
    GetLastUsedTime();
    var check = xmlhttp();
    check.open("post", "/system/server/srvcomm/save.query.define.asp", false);
    check.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	check.send(savestr + "&nocache=" + (new Date().getTime() ));
	return check.responseText;
}

function SrvCommSaveQueryFilter(savestr)
{
    GetLastUsedTime();
    var check = xmlhttp();
    check.open("post", "/system/server/srvcomm/save.query.filter.asp", false);
    check.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	check.send(savestr + "&nocache=" + (new Date().getTime() ));
	return check.responseText;
}


