function AjaxDialogHandler(a,b){this.Dialog=null;this.Parent=parent;this.URL=a;this.Target=b;var c=this;this.onchanged=function(){};this.initdialog=function(a){this.Dialog=a;this.Dialog.SetDefaultValues()};this.oncommand=function(a){clearLastError();a=="input_cancel"?this.Dialog.Hide():a=="input_ok"&&this.Dialog.Validate()&&(HideDialogForLoading(this.Dialog.GetElement().id),BSMakePOSTRequest(this.URL,this,this.Dialog.GetValues()))};this.onkeypressed=function(){return true};this.Edit=function(a){this.Dialog.SetValues(a);
this.Dialog.Show()};this.New=function(){this.Dialog.SetDefaultValues();this.Dialog.Show()};this.OnError=function(a){BSAlert(a);c.Dialog.Hide()};this.OnResponse=function(){c.Dialog.Hide();c.Target&&c.Target.Reload()}};function AjaxTable(a,b,c,d,e){this.Recordset=new Recordset(a,e);this.savedScroll=null;this.qc=this.Recordset.QueryContext;this.URL=b;var f=this;this.Renderer=new RecordsetRenderer(c,this.qc.items);this.OnSort=function(a){f.qc.sortcolumn=a;f.qc.sortdirection=f.qc.sortdirection=="ASC"?"DESC":"ASC";f.Reload()};this.OnNavigate=function(a){f.qc.from=Number(a)*f.qc.items;f.Reload()};this.OnStartLoading=function(){f.savedScroll=BSGetScroll();f.Renderer.RenderMessage(f.qc.items,d)};this.ReloadEx=function(a,
b){this.URL=b;for(var c in a)this.qc[c]=a[c];this.Reload()};this.Reload=function(){f.OnStartLoading();BSMakePOSTRequest(f.URL,f,f.qc)};this.ReloadFrom=function(a,b){var c=this.URL;this.ReloadEx(a,b);this.URL=c};this.Render=function(){this.Renderer.Render(this.Recordset,this.OnSort,this.OnNavigate)};this.Update=function(a){f.Recordset.LoadFromObject(a);null!=f.savedScroll&&window.scrollTo(f.savedScroll.x,f.savedScroll.y);f.Render()};this.OnResponse=function(a){f.Update(a)}}
function AjaxTableNoEmptyRows(a,b,c,d){this.inheritFrom=AjaxTable;this.inheritFrom(a,b,c,d);this.Renderer=new AjaxTableNoEmptyRowsRenderer(c,this.Recordset.QueryContext.items);this.OnStartLoading=function(){}}function AjaxSetMessages(a,b,c,d){this.inheritFrom=AjaxTable;this.inheritFrom(a,b,c,d);this.OnSort=null;this.Renderer=new CommentsRenderer(c,this.Recordset.QueryContext.items);this.OnStartLoading=function(){}}
function AjaxSetPersonalInfo(a,b,c,d){this.inheritFrom=AjaxTable;this.inheritFrom(a,b,c,d);this.OnSort=null;this.Renderer=new PersonalInfoRenderer(c,this.Recordset.QueryContext.items);this.OnStartLoading=function(){}}function AjaxTableArtefactsByExample(a,b,c,d){this.inheritFrom=AjaxTable;this.inheritFrom(a,b,c,d);this.Renderer=new AjaxTableNoEmptyRowsRenderer(c,this.Recordset.QueryContext.items);this.OnStartLoading=function(){};this.OnNavigate=this.OnSort=null}
function AjaxTableHandbookData(a,b,c,d){this.inheritFrom=AjaxTable;this.inheritFrom(a,b,c,d);this.LinkedRecordset=new Recordset("");var e=this;this.OnResponse=function(a){a.linked&&e.LinkedRecordset.LoadFromArray(a.linked);e.Update(a)};this.GetRecord=function(a){var b=this.Recordset.GetRecord(a);return b?b:this.LinkedRecordset.GetRecord(a)}};function open_flash_chart_data(){var a={dispname:"",chartKind:1},b=[];a.name="column1";b.column1=a;a.name="column2";b.column2=a;return JsonChartData([],b)}function flash_chart_reload(a,b){var c=document.getElementById(a);c.firstChild.load?c.firstChild.load(b):setTimeout('flash_chart_reload("'+a+"\", '"+b+"')",100)}
function flash_navigation_reload(a,b){var c=document.getElementById(a+"_navigation"),d=0,e;for(e in c.childNodes)if(c.childNodes[e].style)c.childNodes[e].style.backgroundColor=d==b?"grey":c.style.backgroundColor,c.childNodes[e].style.color=d==b?"white":"blue",d++}
function Slices(a,b){var c=0,d=-1,e;for(e in b)b[e].chartKind<2?d++:c++;4==c&&d++;0==d&&d++;e=a.length;var d=d==1?40:Math.ceil(100/d),c=Math.ceil(e/d),d=Math.ceil(e/c),f=[];for(e=0;e<c;++e)f[e]=JsonChartData(a.slice(e*d,(e+1)*d),b);return f}function QuoteQuotes(a){return a=a.replace(/\"/g,"&quot;")}
function JsonChartData(a,b){function c(a,b){if(void 0==a)return 0;if(0==a.length)return 0;var c=0;do{var d;a:{d=true;var j=void 0;for(j in b)if(d)d=false;else{d=a[c][j];break a}d=0}if(isFinite(d))return d}while(++c<a.length);return 0}function d(a,b,c,d,j){var m={};a:{switch(d){case 2:d="line";break a;case 3:case 4:case 5:case 6:break a}d="bar_filled"}m.type=d;m.alpha=0.5;m.colour=j;m.text=c;m["font-size"]=10;m.values=[];for(var r in a)c=a[r],isFinite(c[b])?(c[b]>e&&(e=c[b]),c[b]<f&&null!=c[b]&&(f=
c[b]),m.values[m.values.length]=c[b]):m.values[m.values.length]=null;return m}var e=c(a,b),f=c(a,b),g=false,h="",i="#76A4FB,#224499,#FF0000,80C65A,#BB00BB,00BBBB".split(","),k={title:{}};k.title.text="";k.title.style="{font-size: 20px; color:#0000ff; font-family: Verdana; text-align: center;}";k.y_legend={};k.y_legend.text="";k.y_legend.style="{color: #736AFF; font-size: 12px;}";k.x_axis={};k.x_axis.stroke=1;k.x_axis.tick_height=10;k.x_axis.colour="#999999";k.x_axis.grid_colour="#999999";k.x_axis.labels=
{};k.x_axis.labels.rotate=270;k.x_axis.labels.labels=function(a,b){var c=[],d="",j;for(j in b){d=j;h=b[j].dispname;break}for(j in a)c[c.length]=String(a[j][d]);return c}(a,b);k.x_legend={};k.x_legend.text=h;k.x_legend.style="{color: #736AFF; font-size: 12px;}";k.elements=function(a,b){var c=[],e=[],j=0,m=true,f;for(f in b)m?m=false:b[f].chartKind<=2?(c[c.length]=d(a,f,b[f].dispname,b[f].chartKind,i[j%i.length]),j++):e[e.length]=d(a,f,b[f].dispname,b[f].chartKind,i[j%i.length]);if(4==e.length){m=c.length;
f=i[j%i.length];j=i[(j+1)%i.length];g=true;var k={type:"candle"};k.colour=f;k["negative-colour"]=j;k.tip="#x_label#<br>#high#<br>#open#<br>#close#<br>#low#";k.values=[];for(var h in e)for(var q in e[h].values)if(void 0==k.values[q]&&(k.values[q]={}),e[h].type==3)k.values[q].top=e[h].values[q];else if(e[h].type==4)k.values[q].high=e[h].values[q];else if(e[h].type==5)k.values[q].low=e[h].values[q];else if(e[h].type==6)k.values[q].bottom=e[h].values[q];c[m]=k}return c}(a,b);k.y_axis=function(a,b,c){var d=
{stroke:1,tick_length:3,colour:"#999999",grid_colour:"#999999",offset:0};a&&b!=c&&Math.abs(c-b)/c<0.05?(d.min=b,d.max=c,d.steps=(c-b)/10):(d.min=b<0?b:0,d.max=c>10?Math.ceil(c):c,d.steps=c>10?Math.ceil(c/10):c/10);return d}(g,f,e);return Value2Json(k)}
function BarDiagram(a,b,c){this.Header=new RecordsetHeader;this.m_destination=document.getElementById(a);if(!this.m_destination.firstChild)this.m_destination.innerHTML=BSInsertFlash(700,300,a)+'<div id="'+a+'_navigation"></div>';this.m_numberOfSections=c;this.Render=function(b){if(0!=b.length){b=Slices(b,this.Header.Columns);this.m_destination.firstChild.load?this.m_destination.firstChild.load(b[0]):setTimeout('flash_chart_reload("'+a+"\", '"+b[0]+"')",100);var c=document.getElementById(a+"_navigation");
if(b.length>1){for(var f="",g=0;g<b.length;++g)f+="<a href=\"javascript:flash_chart_reload('"+a+"', '"+QuoteQuotes(b[g])+"');flash_navigation_reload('"+a+"',"+g+');">'+(g+1)+"</a>&nbsp;";c.innerHTML=f}else c.innerHTML=""}}};function BSAdviseEvent(a,b,c,d){window.addEventListener?a.addEventListener(b,function(a){c(d);return BSPreventDefaultAction(a)},false):a.attachEvent("on"+b,function(a){c(d);return BSPreventDefaultAction(a)})}function BSCreateXMLHttpRequest(){if(window.XMLHttpRequest)return new XMLHttpRequest;else if(window.ActiveXObject)return new ActiveXObject("Microsoft.XMLHTTP")}function BSGetDataSourceDomain(){return typeof dataSourceDomain!="undefined"?dataSourceDomain:document.domain}
function BSAlert(a){alert(a)}function BSJson2Object(a){return eval("("+a+")")}function ProcessResponseError(a,b){null!=a.OnError?a.OnError(b):BSAlert("Error occured:"+b)}function ProcessResponseData(a,b){b.error?ProcessResponseError(a,b.error):a.OnResponse(b)}
function BrowserResponse(a,b){this.OnResponse=function(){if(a.readyState==4)if(a.status==200)if(b.OnResponseText)b.OnResponseText(a.responseText);else{var c=BSJson2Object(a.responseText);ProcessResponseData(b,c)}else BSAlert("There was a problem retrieving the data from server:\n"+a.statusText)}}
function GGResponse(a){this.OnResponse=function(b){!b.text||b.text==""?ProcessResponseError(a,b.errors):a.OnResponseText?a.OnResponseText(b.text):(ProcessResponseData(a,b.data),gadgets.window.adjustHeight())}}
function BSMakePOSTRequest(a,b,c){if(typeof gadgets!="undefined"&&typeof gadgets.io!="undefined"){var d={};d[gadgets.io.RequestParameters.METHOD]=gadgets.io.MethodType.POST;c=gadgets.io.encodeValues(c);d[gadgets.io.RequestParameters.POST_DATA]=c;d[gadgets.io.RequestParameters.CONTENT_TYPE]=gadgets.io.ContentType.JSON;gadgets.io.makeRequest(a,(new GGResponse(b)).OnResponse,d)}else d=BSCreateXMLHttpRequest(),d.onreadystatechange=(new BrowserResponse(d,b)).OnResponse,d.open("POST",a,true),d.setRequestHeader("Content-Type",
"application/x-www-form-urlencoded"),d.send(c?SaveObjectToURLParams(c):null)}function BSPoint(a,b){this.x=a;this.y=b;this.xpx=a+"px";this.ypx=b+"px"}function BSGetMouseXYFromEvent(a){if(!a)a=window.event;var b=0,c=0;if(a)if(a.pageX||a.pageY)b=a.pageX,c=a.pageY;else if(a.clientX||a.clientY)b=a.clientX+document.body.scrollLeft,c=a.clientY+document.body.scrollTop;return new BSPoint(b,c)}
function BSGetWindowSize(){var a=0,b=0;if(typeof window.innerWidth=="number")a=window.innerWidth,b=window.innerHeight;else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight))a=document.documentElement.clientWidth,b=document.documentElement.clientHeight;else if(document.body&&(document.body.clientWidth||document.body.clientHeight))a=document.body.clientWidth,b=document.body.clientHeight;return new BSPoint(a,b)}
function BSGetScroll(){var a=0,b=0;if(typeof window.pageYOffset=="number")b=window.pageYOffset,a=window.pageXOffset;else if(document.body&&(document.body.scrollLeft||document.body.scrollTop))b=document.body.scrollTop,a=document.body.scrollLeft;else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop))b=document.documentElement.scrollTop,a=document.documentElement.scrollLeft;return new BSPoint(a,b)}function BSSetScroll(a){window.scrollTo(a.x,a.y)}
function BSGetPageSize(){var a,b;window.innerHeight&&window.scrollMaxY?(a=document.body.scrollWidth,b=window.innerHeight+window.scrollMaxY):document.body.scrollHeight>document.body.offsetHeight?(a=document.body.scrollWidth,b=document.body.scrollHeight):(a=document.body.offsetWidth,b=document.body.offsetHeight);var c=BSGetWindowSize();return new BSPoint(a<c.x?c.x:a,b<c.y?c.y:b)}function BSGetElementSize(a){return new BSPoint(a.clientWidth,a.clientHeight)}
function BSGetEventTarget(a){if((a=a.target?a.target:a.srcElement)&&(a.nodeType==3||a.nodeType==4))a=a.parentNode;return a}function BSPreventDefaultAction(a){a.preventDefault&&a.preventDefault();return false}function BSSetDimmedSELECTsVisibility(a,b){if(document.all){for(var c=document.getElementsByTagName("SELECT"),d=0;d<c.length;++d)c[d].style.display=b?"inline":"none";c=a.getElementsByTagName("SELECT");for(d=0;d<c.length;++d)c[d].style.display=b?"none":"inline"}}
function BSGetTextSelection(a){var b={};if(typeof a.selectionStart!="undefined")b.selectionStart=a.selectionStart,b.selectionEnd=a.selectionEnd;else{a.focus();var c=a.createTextRange();c.moveToBookmark(document.selection.createRange().getBookmark());for(var d=c.text.length,e=a.value,f=e.length,g=f-1;g>=0;--g){var h=e.charCodeAt(g);if(h==10||h==13)f--;else break}c.moveEnd("character",a.value.length);b.selectionStart=f-c.text.length;c.moveEnd("character",-c.text.length+d);b.selectionEnd=b.selectionStart+
d}return b}function BSTextAreaInsert(a,b){a.focus();var c=BSGetTextSelection(a),d=a.scrollTop;a.value=a.value.substring(0,c.selectionStart)+b+a.value.substring(c.selectionEnd,a.value.length);a.focus();a.scrollTop=d;if(typeof a.selectionStart!="undefined")d=c.selectionStart+b.length,a.selectionStart=d,a.selectionEnd=d;else{d=a.createTextRange();d.collapse();for(var e=c=c.selectionStart,f=0;f<e;++f)a.value.charCodeAt(f)==10&&c--;d.moveStart("character",c+b.length);d.select()}}
function BSTextAreaInsertMarks(a,b,c,d){a.focus();var e=BSGetTextSelection(a),f=false,g=c;e.selectionEnd-e.selectionStart&&(g=a.value.substring(e.selectionStart,e.selectionEnd),f=true);g=g.charAt(g.length-1)==" "?b+g.substring(0,g.length-1)+d+" ":b+g+d;d=a.scrollTop;a.value=a.value.substring(0,e.selectionStart)+g+a.value.substring(e.selectionEnd,a.value.length);a.focus();a.scrollTop=d;if(typeof a.selectionStart!="undefined")f?(b=e.selectionStart+g.length,a.selectionStart=b,a.selectionEnd=b):(a.selectionStart=
e.selectionStart+b.length,a.selectionEnd=a.selectionStart+c.length);else{d=a.createTextRange();d.collapse();for(var h=e=e.selectionStart,i=0;i<h;++i)a.value.charCodeAt(i)==10&&e--;f?d.moveStart("character",e+g.length):(d.moveStart("character",e+b.length),d.moveEnd("character",c.length));d.select()}}function BSGetPressedKeyCode(a){if(window.event)return a.keyCode;else if(a.which)return a.which}var DOMVirtualKeys="DOM_VK_UNDEFINED,DOM_VK_RIGHT_ALT,DOM_VK_LEFT_ALT,DOM_VK_LEFT_CONTROL,DOM_VK_RIGHT_CONTROL,DOM_VK_LEFT_SHIFT,DOM_VK_RIGHT_SHIFT,DOM_VK_LEFT_META,DOM_VK_RIGHT_META,DOM_VK_CAPS_LOCK,DOM_VK_DELETE,DOM_VK_END,DOM_VK_ENTER,DOM_VK_ESCAPE,DOM_VK_HOME,DOM_VK_INSERT,DOM_VK_NUM_LOCK,DOM_VK_PAUSE,DOM_VK_PRINTSCREEN,DOM_VK_SCROLL_LOCK,DOM_VK_LEFT,DOM_VK_RIGHT,DOM_VK_UP,DOM_VK_DOWN,DOM_VK_PAGE_DOWN,DOM_VK_PAGE_UP,DOM_VK_F1,DOM_VK_F2,DOM_VK_F3,DOM_VK_F4,DOM_VK_F5,DOM_VK_F6,DOM_VK_F7,DOM_VK_F8,DOM_VK_F9,DOM_VK_F10,DOM_VK_F11,DOM_VK_F12,DOM_VK_F13,DOM_VK_F14,DOM_VK_F15,DOM_VK_F16,DOM_VK_F17,DOM_VK_F18,DOM_VK_F19,DOM_VK_F20,DOM_VK_F21,DOM_VK_F22,DOM_VK_F23,DOM_VK_F24".split(",");
function BSGetPressedKey(a){var b={};if(typeof a.which!="undefined")b.charCode=a.which;else if(window.event)b.charCode=a.keyCode;else for(var c=0;c<DOMVirtualKeys.length;++c)if(a[DOMVirtualKeys[c]]==a.keyCode)b.vk=DOMVirtualKeys[c];return b}function BSGetElementTextNS(a,b,c){return(a=b.getElementsByTagName(a)[c])?a.childNodes.length>1?a.childNodes[1].nodeValue:a.firstChild?a.firstChild.nodeValue:"n/a":"n/a"}function BSGetTextContent(a){return a.textContent?a.textContent:a.innerText}
function BSReplaceOptions(a,b){if(a.outerHTML){var c=a.outerHTML,d=c.search(/<option/i);a.outerHTML=-1==d?c.replace(/<\/select>/i,b+"</select>"):c.substr(0,d)+b+"</select>"}else a.innerHTML=b}function BSBookmark(a,b,c){window.sidebar?window.sidebar.addPanel(b,c,""):window.opera?(a.setAttribute("href",c),a.setAttribute("title",b),a.setAttribute("rel","sidebar"),a.click()):document.all&&window.external.AddFavorite(c,b)}function BSBookmarkThis(a){BSBookmark(a,document.title,location.href)}
function BSGetMaxWidthProperty(){return document.all?"width":"max-width"}function BSAddSelectOption(a,b,c){var d=document.createElement("option");d.text=c;d.value=b;window.ActiveXObject?a.add(d):a.add(d,null)}function trim(a){for(var a=a.replace(/^\s+/,""),b=a.length-1;b>=0;b--)if(/\S/.test(a.charAt(b))){a=a.substring(0,b+1);break}return a}function leftpad(a,b,c){for(a=new String(a);a.length<c;)a=b+a;return a}
function String2Date(a){var b=new Date;if(typeof a=="string"){if(ret=TryString2Date(a),ret instanceof Date)return ret}else b=new Date(a);return b}function TryString2Date(a){var b=trim(a);if(a=b.match(/^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})( BC$|$)/i))b=new Date(Number(a[1]),Number(a[2])-1,a[3],a[4],a[5],a[6]),a[7]==" BC"?b.setFullYear(1-Number(a[1])):b.setFullYear(a[1]);return b}
function Date2String(a){var b=a.getFullYear(),c=b<=0?" BC":"";b<=0&&(b=1-b);return leftpad(b,"0",4)+"-"+leftpad(a.getMonth()+1,"0",2)+"-"+leftpad(a.getDate(),"0",2)+" "+leftpad(a.getHours(),"0",2)+":"+leftpad(a.getMinutes(),"0",2)+":"+leftpad(a.getSeconds(),"0",2)+c}function BSDateParse(a){return String2Date(a)}
function BSInsertFlash(a,b,c){return document.all?'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+a+'" height="'+b+'" id="'+c+'_chart" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="wmode" value="opaque"/><param name="movie" value="/open-flash-chart.swf" /><param name="quality" value="high" /></object>':'<embed src="/open-flash-chart.swf" quality="high" bgcolor="#FFFFFF" width="'+
a+'" height="'+b+'" name="open-flash-chart" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="opaque"/>'}function BSIsSystemKey(a){return a.charCode==120||a.charCode==99||a.charCode==118};var BACK_SPACE_ASCII_CODE=8,ENTER_ASCII_CODE=13,TAB_ASCII_CODE=9;function DialogResult(){this.ok="DialogResultOK";this.cancel="DialogResultCancel"}function ShowWindow(a){(new DialogWorker(a)).OpenWindow()}function HideWindow(a){(new DialogWorker(a)).HideWindow()}function ShowDialog(a){(new DialogWorker(a)).Show()}function HideDialog(a){(new DialogWorker(a)).Hide()}function HideDialogForLoading(a){(new DialogWorker(a)).HideForLoading()}function SetDialogBusy(a){(new DialogWorker(a)).SetBusy()}
function SetDialogFree(a){(new DialogWorker(a)).SetFree()}function EnableLoadingImage(a,b){var c=BSGetWindowSize();PlaceLoadingImage(a,0,0,c.x,c.y,b)}function PlaceLoadingImage(a,b,c,d,e,f){var g=document.getElementById("loading_image");if(g){if(a)g.style.zIndex=f,g.style.left=b+d/2-g.style.width/2+"px",g.style.top=c+e/3-g.style.height/2+"px";g.style.display=a?"block":"none"}}
function DialogWorker(a){function b(a){a.style.display="block";a.style.position="absolute";a.style.zIndex=c++}var c=100,d=document.getElementById(a);this.OpenWindow=function(){b(d);d.style.left=document.documentElement.offsetWidth-d.offsetWidth+"px";d.style.top=document.documentElement.scrollTop+"px"};this.HideWindow=function(){d.style.display="none"};this.Show=function(){var a=BSGetScroll(),f=document.body,g=document.createElement("div");f.insertBefore(g,f.firstChild);f=f.firstChild;f.style.overflow=
"hidden";if(f.style.overflowX)f.style.overflowX="hidden";if(f.style.overflowY)f.style.overflowY="hidden";document.body.scroll="no";if(document.body.scroll)f.scroll="no";g.setAttribute("id","dimmer");g.style.display="block";g.style.position="absolute";g.style.top="0";g.style.left="0";g.style.zIndex=c++;g.style.width="100%";f=BSGetPageSize();g.style.height=f.ypx;b(d);d.style.left=(document.documentElement.offsetWidth-d.offsetWidth)/2+"px";var g=BSGetWindowSize(),f=BSGetScroll(),h=d.offsetHeight;d.style.top=
Math.floor(h>g.y?0:(g.y-h)/2+f.y)+"px";BSSetDimmedSELECTsVisibility(d,false);EnableLoadingImage(false);BSSetScroll(a)};this.Hide=function(){var a=document.body;a.removeChild(a.firstChild);d.style.display="none";BSSetDimmedSELECTsVisibility(d,true);EnableLoadingImage(false)};this.HideForLoading=function(){d.style.display="none";EnableLoadingImage(true,c+10)};this.SetBusy=function(){var a=document.body,b=document.createElement("div");a.insertBefore(b,a.firstChild);b.setAttribute("id","dimmer");b.style.display=
"block";b.style.position="absolute";var a=d,g=curtop=0;if(a.offsetParent){do g+=a.offsetLeft,curtop+=a.offsetTop;while(a=a.offsetParent)}a=[g,curtop];b.style.left=a[0]+"px";b.style.top=a[1]+"px";b.style.width=d.offsetWidth+"px";b.style.height=d.offsetHeight+"px";b.style.zIndex=c++;PlaceLoadingImage(true,a[0],a[1],d.offsetWidth,d.offsetHeight,c+10)};this.SetFree=function(){var a=document.body;a.removeChild(a.firstChild);PlaceLoadingImage(false)}}
function GetSelectOptionsAsArray(a){for(var a=a.childNodes,b=[],c=0;c<a.length;++c){var d=a[c];if("OPTION"==d.nodeName)b[b.length]=d.value,b[b.length]=d.firstChild.nodeValue}return b}
function ElementAccessorRadio(){this.GetElement=function(){return document.getElementById(this.id+"0")};this.GetValue=function(){for(var a=0;;){var b=document.getElementById(this.id+a++);if(!b)break;if(b.checked)return b.value}};this.ResetValue=function(){for(;;){var a=document.getElementById(this.id+index++);if(!a)break;if(a.defaultChecked)a.checked=true}};this.SetValue=function(a){for(var b=0;;){var c=document.getElementById(this.id+b++);if(!c)break;c.checked=c.value==a}};this.GetParent=function(){return this.GetElement().parentNode.parentNode}}
function ElementAccessorCheckbox(){this.GetElement=function(){return document.getElementById(this.id)};this.ResetValue=function(){var a=this.GetElement();a.checked=a.defaultChecked};this.GetValue=function(){return this.GetElement().checked?1:0};this.SetValue=function(a){this.GetElement().checked=a?1:0};this.GetParent=function(){return this.GetElement().parentNode.parentNode}}
function ElementAccessorDefault(){this.GetElement=function(){return document.getElementById(this.id)};this.GetValue=function(){return this.GetRawValue()};this.GetRawValue=function(){return this.GetElement().value};this.ResetValue=function(){var a=this.GetElement();a.value=a.defaultValue};this.SetValue=function(a){var b=this.GetElement();typeof b.type=="undefined"?b.innerHTML=a:b.value=a};this.GetParent=function(){return this.GetElement().parentNode}}
function ElementAccessorNumber(){this.inheritFrom=ElementAccessorDefault;this.inheritFrom();this.GetValue=function(){return Number(this.GetElement().value.replace(",","."))}}function ElementAccessorImage(){this.inheritFrom=ElementAccessorDefault;this.inheritFrom();this.GetRawValue=function(){return this.GetElement().src};this.ResetValue=function(){};this.SetValue=function(a){this.GetElement().src=a}}
function ElementAccessorSelect(){this.GetElement=function(){return document.getElementById(this.id)};this.GetValue=function(){return this.GetElement().value};this.ResetValue=function(){for(var a=this.GetElement(),b=0;b<a.options.length;++b){var c=a.options[b];if(c.defaultSelected){this.SetValue(c.value);return}}a.options.length&&this.SetValue(a.options[0].value)};this.SetValue=function(a){for(var b=this.GetElement(),c="",d=false,e=0;e<b.options.length;++e){var f=b.options[e];if(f.value==a){d=true;
break}else if(f.text==a)c=f.value}if(d)b.value=a;else if(c!="")b.value=c};this.GetParent=function(){return this.GetElement().parentNode}}
function ElementAccessorDate(){function a(a){for(;a.options.length;)a.remove(0)}this.YearsGap=100;this.CenturyGap=25;this.GetElement=function(){return document.getElementById(this.id)};this.GetControls=function(){return{d:document.getElementById(this.id+"_day"),m:document.getElementById(this.id+"_month"),y:document.getElementById(this.id+"_year"),c:document.getElementById(this.id+"_century"),h:document.getElementById(this.id+"_hour"),n:document.getElementById(this.id+"_minute")}};this.GetValue=function(){var a=
this.GetControls(),c=a.y?a.y.value:a.c?a.c.value:0,d=new Date(c,a.m?a.m.value:0,a.d?a.d.value:1,a.h?a.h.value:0,a.n?a.n.value:0);a.m&&d.getMonth()!=a.m.value&&d.setMonth(a.m.value);d.setFullYear(c);return d};this.ResetValue=function(){this.SetValue(eval(this.id+"_init"))};this.SetValue=function(a){var a=new Date(String2Date(a)),c=this.GetControls(),d=c.m,e=a.getMonth();if(d)d.value=e;d=c.d;e=a.getDate();if(d)d.value=e;d=c.h;e=a.getHours();if(d)d.value=e;c=c.n;d=a.getMinutes();if(c)c.value=d;this.UpdateY(a);
this.UpdateD(a)};this.GetParent=function(){return this.GetElement().parentNode};this.UpdateY=function(b){var c=this.GetControls(),d=document.getElementById("b_c"),d=d?" "+d.innerHTML:"";if(c.y){a(c.y);for(var e=-this.YearsGap;e<=this.YearsGap;++e){var f=b.getFullYear()+e,g=f;f<=0&&(g=1-f+d);BSAddSelectOption(c.y,f,g)}c.y.value=b.getFullYear()}if(c.c){a(c.c);for(var b=b.getFullYear(),h=" "+document.getElementById("century").innerHTML,e=-this.CenturyGap;e<=this.CenturyGap;++e)f=b+e*100,g=Math.floor((f-
1)/100),g=g>=0?g+1+h:-g+h+d,BSAddSelectOption(c.c,f,g);c.c.value=b}};this.UpdateD=function(b){var c=this.GetControls();if(c.d){a(c.d);for(var d=1;d<=31;++d){var e=new Date(b);e.setDate(d);if(b.getMonth()!=e.getMonth())break;BSAddSelectOption(c.d,d,document.getElementById("dow_"+e.getDay()).innerHTML+", "+d)}c.d.value=b.getDate()}};this.Initialize=function(b){var c=this.GetControls();if(c.h){a(c.h);for(var d=0;d<24;++d)BSAddSelectOption(c.h,d,d);c.h.value=b.getHours()}if(c.n){a(c.n);for(d=0;d<60;++d)BSAddSelectOption(c.n,
d,(d<10?"0":"")+d);c.n.value=b.getMinutes()}if(c.m){a(c.m);for(d=0;d<12;++d)BSAddSelectOption(c.m,d,document.getElementById("mon_"+d).innerHTML);c.m.value=b.getMonth()}this.UpdateY(b);this.UpdateD(b)}}
function ElementAccessorDynamicSelect(a,b,c,d,e,f,g){if(a)this.URL="http://"+BSGetDataSourceDomain()+a;this.PatchDefaultValue=function(a){if(typeof a=="object")return a;var b='({"'+this.pkFieldName+'" : ',c=typeof a=="string"?'"':"";b+=c+a+c;b+="})";eval(b);return eval(b)};this.params=b;this.fieldid=c;this.pkFieldName=""==e?c:e;this.initialvalue=this.currentvalue=this.PatchDefaultValue(d);this.valuesarray=[];this.sort=g;this.m_handlerVarName=f;this.URL&&BSMakePOSTRequest(this.URL,this,this.params);
this.SetParams=function(a){this.params=a;this.URL&&BSMakePOSTRequest(this.URL,this,this.params)};this.Query=function(a,b){this.params=b;this.URL="http://"+BSGetDataSourceDomain()+a;BSMakePOSTRequest(this.URL,this,this.params)};this.OnResponse=function(a){if(this.sort){var b=new Recordset;b.LoadFromArray(a);b.SortAsc(this.fieldid);this.valuesarray=b.GetRecordArray()}else this.valuesarray=a;for(var a="",c=b=false,d=0;d<this.valuesarray.length;++d){var e=this.valuesarray[d],f="";this.currentvalue[this.pkFieldName]==
e[this.pkFieldName]?(f='selected="selected"',b=true):!b&&this.currentvalue[this.pkFieldName]==e[this.fieldid]&&(f="%selectedbyname%",c=true);a+='<OPTION VALUE="'+d+'" '+f+">"+e[this.fieldid]+"</OPTION>"}c&&(a=a.replace("%selectedbyname%",b?"":'selected="selected"'));if(a.length&&(BSReplaceOptions(this.GetElement(),a),eval(this.m_handlerVarName)))this.GetElement().onchange()};this.GetElement=function(){return document.getElementById(this.id)};this.ResetValue=function(){this.SetValue(this.initialvalue)};
this.GetValue=function(){var a=this.GetElement().value;return void 0!=this.valuesarray[a]?this.valuesarray[a]:""};this.SetValue=function(a){if(typeof this.GetElement().type!="undefined")this.currentvalue=this.PatchDefaultValue(a),void 0!=this.valuesarray[a]?this.OnResponse(this.valuesarray):this.URL&&BSMakePOSTRequest(this.URL,this,this.params)};this.GetParent=function(){return this.GetElement().parentNode}}
function ElementAccessorInputTable(a){this.GetElement=function(){return document.getElementById(this.id)};this.GetRecordset=function(){return eval(a+".Recordset")};this.GetValue=function(){return this.GetRecordset().GetRecordArray()};this.ResetValue=function(){return this.GetRecordset().Clear()};this.SetValue=function(b){this.GetRecordset().LoadFromArray(b);eval(a+".Refresh();")}}
function ElementAccessorFormula(){this.value="";this.GetElement=function(){return document.getElementById(this.id)};this.ResetValue=function(){};this.GetValue=function(){return this.value};this.SetValue=function(a){this.value=a;var b=typeof a=="object"?PCM.getTeX(a):a;b==""?this.GetElement().innerHTML="":(a=typeof a=="object"?PCM.getMath(a):a,this.GetElement().innerHTML='<img src="/cgi-bin/mimetex.cgi?'+b+'" alt="'+a+'"/>')};this.GetParent=function(){return this.GetElement().parentNode}}
function ElementAccessorPrecision(){this.GetElement=function(){return document.getElementById(this.id)};this.ResetValue=function(){};this.GetValue=function(){return PCF.getCalcPrecision()};this.SetValue=function(a){PCF.setCalcPrecision(a)};this.GetParent=function(){return this.GetElement().parentNode}}
function ElementAccessorResource(){this.GetElement=function(){return document.getElementById(this.id)};this.ResetValue=function(){};this.GetValue=function(){return eval("("+this.id+"_data)")};this.SetValue=function(){};this.GetParent=function(){return this.GetElement().parentNode}}
function ElementAccessorDegrees(){this.GetElement=function(){return document.getElementById(this.id)};this.ResetValue=function(){this.SetValue(document.getElementById(this.id+"_value").defaultValue)};this.GetValue=function(){var a=document.getElementById(this.id+"_value");return Number(a.value)};this.SetValue=function(a){this.SetDegreesValue(a)};this.SetDegreesValue=function(a){document.getElementById(this.id+"_value").value=a;var a=Number(a),b="";a<0&&(a=-a,b="-");document.getElementById(this.id+
"_sec").value=Math.floor(a*3600)%60;document.getElementById(this.id+"_min").value=Math.floor(a*60)%60;document.getElementById(this.id+"_deg").value=b+Math.floor(Number(a))};this.GetParent=function(){return this.GetElement().parentNode}}
function ElementAccessorCoordinate(){this.inheritFrom=ElementAccessorDegrees;this.inheritFrom();this.SetValue=function(a){var b=Number(a);document.getElementById(this.id+"_side1").checked=b>=0;document.getElementById(this.id+"_side2").checked=b<0;b<0&&(b=-b);this.SetDegreesValue(b);document.getElementById(this.id+"_value").value=a}}
function DialogInput(a,b,c,d){this.id=a;this.dialog=b;this.validator=c;this.formatter=null;this.elementAccessor=d;this.elementAccessor.id=b.GetElement().id+"_"+this.id;this.GetElement=function(){return this.elementAccessor.GetElement()};this.GetElementAccessor=function(){return this.elementAccessor};this.ResetValue=function(){this.elementAccessor.ResetValue()};this.SetValue=function(a){this.elementAccessor.SetValue(this.formatter?this.formatter.Format(a):a)};this.GetValue=function(){return this.elementAccessor.GetValue()};
this.GetElementToShow=function(){return this.elementAccessor.GetParent()};this.Show=function(){this.GetElementToShow();return this.GetElementToShow().style.display="block"};this.Hide=function(){return this.GetElementToShow().style.display="none"};this.ShowError=function(a){return this.dialog.ShowError(this.GetElement(),a)};this.ClearError=function(){return clearError(this.GetElement())};this.ShowOrClearError=function(a){if(a=="")return clearError(this.GetElement()),true;this.ShowError(a);return false};
this.Validate=function(){return this.validator?this.ShowOrClearError(this.validator.Validate(this.elementAccessor.GetRawValue?this.elementAccessor.GetRawValue():this.elementAccessor.GetValue())):true};this.ValidateCurrent=function(){return this.validator?this.Validate(this.GetValue()):true};this.GetOptions=function(){return GetSelectOptionsAsArray(this.GetElement())};this.Load=function(a){var b=this.GetElement().name;b&&(a=a[b],typeof a!="undefined"&&this.SetValue(a))}}
function HTTPParameters(){this.Parameters={};this.SetParameter=function(a,b){this.Parameters[a]=b};var a=(new String(document.URL)).split("?");if(a.length>1)for(var a=a[1].split("&"),b=0;b<a.length;++b){var c=a[b].split("="),d="";c.length==2&&(d=c[1]);this.SetParameter(c[0],decodeURIComponent(d))}}
function SaveObjectToURLParams(a){var b="",c;for(c in a){var d=a[c];typeof d=="object"&&(d=Value2Json(d,true));typeof d!="undefined"&&(b+="&"+c+"="+encodeURIComponent(d))}return b.length?b.substring(1):b}
function CookieParameters(){function a(a){return a.replace(/^[\s\t]+/,"").replace(/[\s\t]+$/,"")}this.Parameters={};this.SetParameter=function(a,b){this.Parameters[a]=b};for(var b=document.cookie.split(";"),c=0;c<b.length;++c){var d=b[c].split("="),e=a(d[0]);if("field_"==e.substring(0,6)){var e=e.substring(6),f="";d.length>1&&(f=a(d[1]));this.SetParameter(e,f)}}b=new Date;b.setTime(b.getTime()+2592E6);this.expires="expires="+b.toGMTString();this.Save=function(){for(var a in this.Parameters)document.cookie=
"field_"+a+"="+this.Parameters[a]+";"+this.expires}}function getControlValueAfterChange(a,b){var c=BSGetTextSelection(b),d=b.value,e=d.substring(0,c.selectionStart);a.charCode==BACK_SPACE_ASCII_CODE?e.length&&(e=e.substring(0,e.length-1)):a.charCode&&(e+=String.fromCharCode(a.charCode));e+=d.substring(c.selectionEnd,d.length);return e}
function handleOnKeyPressed(a,b,c,d){var e=BSGetPressedKey(a);if(typeof e=="undefined"||e.charCode==BACK_SPACE_ASCII_CODE||e.charCode==ENTER_ASCII_CODE||e.charCode==TAB_ASCII_CODE||e.charCode==0||BSIsSystemKey(e))return true;e=getControlValueAfterChange(e,b);return showOrClearError(b,c.Validate(e),d)?true:BSPreventDefaultAction(a)};var PCF=function(){function a(b,c){if(b.childNodes)for(var d in b.childNodes){var h=b.childNodes[d];if(h.nodeType==1)if(h.name&&h.name.substr(0,9)=="precision"){var i=h.name.substr(9);c(h,i)}else a(h,c)}}var b,c=[],d=[];return{advisePrecisionmeter:function(e,f,g){typeof b=="undefined"&&(b=f);c[c.length]=e;d[d.length]=g;a(e,function(a,b){BSAdviseEvent(a,"click",PCF.changeCalcPrecision,b)});a(e,function(a,b){if(b!="Plus"&&b!="Minus")a.className=Number(b)<=f?"selected":""})},getMaxPrecision:function(){return 20},
getCalcPrecision:function(){return b},setCalcPrecision:function(a){b=a},changeCalcPrecision:function(e){var f=Number(b);e=="Plus"?f<PCF.getMaxPrecision()&&(f+=1):e=="Minus"?f>0&&(f-=1):f=Number(e);b=f;for(e=0;e<c.length;++e){var f=c[e],g=eval(d[e]);a(f,function(a,c){if(c!="Plus"&&c!="Minus")a.className=Number(c)<=b?"selected":""});g.onchanged("precisionmeter")}}}}();
function GetDateParts(a){return[a.getFullYear(),a.getMonth()+1,a.getDate(),a.getHours(),a.getMinutes(),a.getSeconds(),a.getMilliseconds()]}
function FormatDate(a,b){if(b=="0000-00-00 00:00:00"||!b)return"";var c=typeof b=="string"?String2Date(b):new Date(b),d=6;a.search("%8")==-1?d=4:a.search("%9")==-1&&(d=5);var d=GetDateParts(c,d),e=d[0]<=0?" "+getFormattedMessage("b_c"):"";d[0]<=0&&(d[0]=1-d[0]);c=Math.ceil(c.getFullYear()/100)+" "+getFormattedMessage("century")+e;return formatMessage(a,leftpad(d[0],"0",4),leftpad(d[1],"0",2),leftpad(d[2],"0",2),e,c,leftpad(d[3],"0",2),leftpad(d[4],"0",2),leftpad(d[5],"0",2),leftpad(d[6],"0",3))}
function FormatAbsDegrees(a){a<0&&(a=-a);var b=Math.floor(a)+"&#176;";if(a=Math.round((a-Math.floor(a))*3600))b=b+Math.floor(a/60)+"'",a%60&&(b=b+a%60+'"');return b}function FormatterDegrees(){this.Format=function(a){a=Number(a);return(a<0?"-":"")+FormatAbsDegrees(a)}}function FormatterCoordinate(a){var b=a=="lat"?["latitudeN","latitudeS"]:["longitudeE","longitudeW"];this.Format=function(a){var a=Number(a),d=getFormattedMessage(b[a<0?1:0]);return FormatAbsDegrees(a)+" "+d}}
function FormatterDate(){this.Format=function(a){return FormatDate("date_format",a)}}function FormatterBoolean(){this.Format=function(a){return getFormattedMessage(a?"yes":"no")}}function FormatterDateFlags(a){var b=getFormattedMessage("date_format"),c=getFormattedMessage("date_time_format"),d=["",b,"%6:%7",c,"%5","%5 "+b,"%5 %6:%7","%5 "+c];this.Format=function(b){return FormatDate(d[a],b)}}
function FormatterImage(a){this.Format=function(b){return b!=""?'<img src="'+b+'" alt="'+a+'" title="'+a+'"/>':""}}function FormatterFormula(){this.Format=function(a){var b=typeof a=="object"?PCM.getTeX(a):a,a=typeof a=="object"?PCM.getMath(a):a;return b!=""?'<img src="/cgi-bin/mimetex.cgi?'+b+'" alt="'+a+'"/>':""}}function FormatterSimpleURL(){this.Format=function(a){if(a!=""){var b=a;b.substr(0,4)!="http"&&(b="http://"+b);return'<a href="'+b+'" />'+a+"</a>"}return""}}
function FormatterDateOnly(){this.Format=function(a){if(a=="0000-00-00 00:00:00"||!a)return"";else{var a=String2Date(a),b=a.getTime();b-=6E4*a.getTimezoneOffset();a.setTime(b);return a.getFullYear()+"."+(a.getMonth()+1<10?"0"+(a.getMonth()+1):a.getMonth()+1)+"."+a.getDate()}}}
function FormatterTimeSpan(){function a(a,c){var d=c=Number(c).toFixed(0);if(c>=10&&c<=20)return c+" "+getFormattedMessage(a+"1X")+" "+getFormattedMessage("ago");else c>20&&(d=c%10);return c+" "+getFormattedMessage(a+d.toString())+" "+getFormattedMessage("ago")}this.Format=function(b){if(b=="0000-00-00 00:00:00"||!b)return"";else{var b=String2Date(b),c=b.getTime();c-=6E4*b.getTimezoneOffset();b.setTime(c);b=b.getTime();c=(new Date).getTime();return c-b<36E5?a("minute_",(c-b)/6E4):c-b<864E5?a("hour_",
(c-b)/36E5):c-b<26784E5?a("day_",(c-b)/864E5):c-b<321408E5?a("month_",(c-b)/26784E5):a("year_",(c-b)/321408E5)}}}function FormatterMap(a){for(var b=[],c=0;c<a.length;c+=2)b[a[c]]=a[c+1];this.Format=function(a){a=b[a];return typeof a=="undefined"?"":a}}function DoubleFormatterMap(a){for(var b=[],c=0;c<a.length;c+=2)b[a[c]]=a[c+1];this.Formatter=new FormatterSame;this.Format=function(a){a=b[a];return typeof a=="undefined"?"":this.Formatter.Format(a)}}
function FormatterLabel(a){this.Format=function(){return a}}function FormatterPrefix(a,b){this.Format=function(c){return a+(b!=null?b.Format(c):c)}}function FormatterEmptyLabel(a){this.Format=function(b){return typeof b=="undefined"?a:b}}function FormatterSame(){this.Format=function(a){return a}}function FormatterNumber(a){this.Format=function(b){var b=new Number(b),c=a;c&&(c=PCF.getCalcPrecision(),typeof c=="undefined"&&(c=a));return b.toFixed(c)}}
function FormatterPersent(a){this.Format=function(b){return(b*100).toFixed(a)}}function FormatterMatrix(a){this.Format=function(b){for(var c="<table>",d=0;d<b.length;++d){var e=b[d];c+="<tr>";for(var f=0;f<e.length;++f){c+="<td>";if(isNaN(e[f]))c+=e[f];else{var g=new Number(e[f]),h=a;h&&(h=PCF.getCalcPrecision(),typeof h=="undefined"&&(h=a));c+=g.toFixed(h)}c+="</td>"}c+="</tr>"}c+="</table>";return c}};function ValidatorNonempty(){this.Validate=function(a){return a==""?getFormattedMessage("err_must_be_not_empty"):""}}function ValidatorEmail(){this.Validate=function(a){return a.indexOf("@")==-1?getFormattedMessage("err_invalid_email",a):""}}function ValidatorEqual(a,b){this.Validate=function(c){return a.value!=c?getFormattedMessage("err_must_be_the_same_as",b):""}}
function ValidatorTextSize(a,b){this.Validate=function(c){c=c.length;if(c<a)return getFormattedMessage("err_must_be_at_least_x_chars_long",a);else if(c>b)return getFormattedMessage("err_must_be_less_or_equal_x_chars",b);return""}}function ValidatorCharset(a){this.Validate=function(b){for(var c=0;c<b.length;++c){var d=b.substring(c,c+1);if(a.indexOf(d)==-1)return getFormattedMessage("err_invalid_symbol",a)}return""}}
function ValidatorComplex(){var a=arguments;this.Validate=function(b){for(var c="",d=0;d<a.length;++d){var e=a[d].Validate(b);e!=""&&(c!=""&&(c+="<br/>"),c+=e)}return c}}
function ValidatorImport(){var a=arguments,b=null,c=0,d=0;this.ParseData=function(e,f){b=null;d=c=0;var g="\r\n";f.search(g)==-1&&(g="\n");g=f.split(g);if(!g.length)return"";if(a.length>1){a:{for(var h=g[0],i=a.length,k=["\t",";",","],n=0;n<k.length;++n){var l=k[n];if(h.split(l).length==i){b=l;break a}}b=null}if(!b)return getFormattedMessage("err_import_cannot_find_separator")}for(h=0;h<g.length;++h)if(i=[],k=g[h],b?i=k.split(b):i[0]=k,++c,i=e.ProcessRow(i),i!="")return i;return""};this.Validate=
function(a){return this.ParseData(this,a)};this.ProcessRow=function(b){for(d=0;d<a.length;++d){var f=a[d];if(f){var g=b[d],f=f.Validate(g);if(f!="")return getFormattedMessage("err_import_error",c,g,f)}}return""}}function removeInvalidDigits(a,b,c){for(var d=false,e="",f=0;f<a.length;++f){var g=a.substring(f,f+1);if("0123456789+-*/".indexOf(g)==-1)if(g=="-")b&&f==0&&(e+=g);else{if((g=="."||g==",")&&c&&f!=0&&!d)d=true,e+=g}else e+=g}return e}
function ValidatorNumber(a,b){this.Validate=function(c){return c!=""&&removeInvalidDigits(c,a,b)!=c?a&&b?getFormattedMessage("err_invalid_number"):!a&&b?getFormattedMessage("err_invalid_positive_number"):a&&!b?getFormattedMessage("err_invalid_integer_number"):getFormattedMessage("err_invalid_integer_positive_number"):""}}function ValidatorRange(a,b){this.Validate=function(c){c=Number(c);return c<a||c>b?getFormattedMessage("err_range_error",a,b):""}}
function ValidatorFirstAlpha(){this.Validate=function(a){return a.length&&(a=a.substring(0,1),a>="a"&&a<="z"||a>="A"&&a<="Z")?"":getFormattedMessage("err_first_char_must_be_alpha")}}
function ValidatorCalculatorScript(a){this.Prohibited=[];for(var b=1;b<arguments.length;++b)this.Prohibited[b-1]=arguments[b];this.Validate=function(b){for(var b=a+b+"}",d=0;d<this.Prohibited.length;++d){var e=this.Prohibited[d];if(b.indexOf(e)!=-1)return getFormattedMessage("err_prohibited_features",e)}try{eval(b)}catch(f){return getFormattedMessage("err_script_compilation_error",f.message)}return""}}
function ValidatorUpload(a){var b=a.toLowerCase().split(",");this.Validate=function(c){if(!c||c=="")return"";var d=c.lastIndexOf(".");if(d!=-1){c=c.substr(d+1).toLowerCase();for(d=0;d<b.length;++d)if(c==b[d])return""}return getFormattedMessage("err_invalid_upload_extension",a)}};var hideSubmenu={};function SetMenuStyle(a,b,c){document.getElementById(a+"_p").className=c;document.getElementById(a).style.display=b}function ShowSubmenu(a){hideSubmenu[a]&&(hideSubmenu[a]=false);SetMenuStyle(a,"block","msubitem_s")}function HideSubmenu(a){hideSubmenu[a]=true;setTimeout('DoHideSubmenu("'+a+'")',300)}function DoHideSubmenu(a){hideSubmenu[a]&&(hideSubmenu[a]=false,SetMenuStyle(a,"none","msubitem"))};function formatMessage(a){for(var b=new String(a),c=1;c<arguments.length;++c)b=b.replace("%"+c.toString(),arguments[c]);return b}function getFormattedMessage(a){var b=document.getElementById(a);if(null==b)return"Error message "+a+" is not included by server-side code. Contact site support";for(var b=b.innerHTML,c=1;c<arguments.length;++c)b=b.replace("%"+c.toString(),arguments[c]);return b}var lastErrorObject=null,lastErrorObjectBorderColor="",lastErrorObjectColor="",lastErrorMessageBox=null;
function showOrClearError(a,b,c){return b.length?(showError(a,b,c),false):(clearError(a),true)}
function showError(a,b,c){c=document.getElementById(c?c:a?a.id+"_errmsg":"errmsg");if(c==null)b.length>0&&alert(b);else{lastErrorObject&&clearError(lastErrorObject);if(a){if(a!=lastErrorObject)lastErrorObject=a,lastErrorObjectBorderColor=a.style.borderColor,lastErrorObjectColor=a.style.color,lastErrorMessageBox=c;a.style.borderColor="#FF0000";a.style.color="#FF0000"}c.innerHTML=b;c.style.display="block";c.style.zIndex=1E6;if(a&&a.parentNode)a.parentNode.appendChild(c),c.style.left=a.parentNode.firstChild.nextSibling.offsetLeft}}
function clearError(a){if(lastErrorObject==a){if(lastErrorMessageBox)lastErrorMessageBox.style.display="none";lastErrorObject.style.borderColor=lastErrorObjectBorderColor;lastErrorObject.style.color=lastErrorObjectColor;lastErrorMessageBox=lastErrorObject=null}}
function clearLastError(){if(lastErrorObject){if(lastErrorMessageBox)lastErrorMessageBox.style.display="none";lastErrorObject.style.borderColor=lastErrorObjectBorderColor;lastErrorObject.style.color=lastErrorObjectColor;lastErrorMessageBox=lastErrorObject=null}}function reportScriptError(a){alert(a)}function htmlencode(a){return(a=new String(a))?a.replace("<","&lt;").replace(">","&gt;").replace("&","&amp;").replace('"',"&quot;"):""};function MouseDragger(){function a(){return false}function b(a){a=BSGetMouseXYFromEvent(a);f=a.x;g=a.y}function c(a){if(o)l=k+(f-h),p=n+(g-i),o.style.position="absolute",o.style.left=l.toString(10)+"px",o.style.top=p.toString(10)+"px";b(a);return false}function d(){if(o)o.style.zIndex=new Number(o.style.zIndex)-10,o=null;document.onmousemove=b;document.onmouseup=null;document.onmousedown=null}function e(b){for(b=BSGetEventTarget(b);b&&!b.eventsourceid;)b=b.parentNode;(b=document.getElementById(b.eventsourceid))?
(document.onmousedown=a,o=b,o.style.zIndex=new Number(o.style.zIndex)+10,o.style.position="absolute",document.onmousemove=c,document.onmouseup=d,h=f,i=g,l=k=o.offsetLeft,p=n=o.offsetTop):d()}var f=0,g=0,h=0,i=0,k=0,n=0,l=0,p=0,o=null;document.onmousemove=b;this.add=function(a,b){var c=document.getElementById(a);BSAdviseEvent(c,"mousedown",e,b)}};function RecordFieldFormatterCSVImportStatus(){var a=new FormatterImage("Error"),b=new FormatterImage("Success");this.Format=function(c,d){return d[c]==0?b.Format("/img/success.png"):a.Format("/img/error.png")}}function RecordFieldFormatterCSVImportValue(){this.Format=function(a,b){var c="__error_"+a,d=b[a];b[c]&&(d+='<p class="csverror">'+eval(b[c])+"</p>");return d}}function RecordFieldFormatter(a){this.Format=function(b,c){return a.Format(c[b])}}
function RecordFieldFormatterSubrecord(a){this.Format=function(b,c){return c[b][a]}}function RecordFieldFormatterLabelsMap(){var a=new FormatterMap(arguments);this.Format=function(b,c){return a.Format(c[b])}}function RecordFieldFormatterImagesMap(){var a=new DoubleFormatterMap(arguments);a.Formatter=new FormatterImage("");this.Format=function(b,c){return a.Format(c[b])}}function RecordFieldFormatterLabelsMapArray(a){var b=new FormatterMap(a);this.Format=function(a,d){return b.Format(d[a])}}
function RecordFieldFormatterEditArtefact(a,b){this.Format=function(c,d){var e="edit",f=a;d.fkTranslatedFrom&&(e="translate",f=b);var g="articles";d.artefactType==1?g="calculators":d.artefactType==4&&(g="handbooks");return'<a href="'+("/personal/"+g+"/"+e+"/?id="+d.pkID)+'">'+f+"</a>"}}
function RecordFieldFormatterTranslateArtefact(a,b,c){this.Format=function(d,e){if(!e[a])return"";var f="articles";e.artefactType==1?f="calculators":e.artefactType==4&&(f="handbooks");return'<a href="'+("/personal/"+f+"/translate/?id="+e[a]+"&src="+c)+'">'+e[b]+"</a>"}}function RecordFieldFormatterURLPattern(a,b){this.Format=function(c,d){var e=b?b.Format(c,d):d[c];return'<a href="'+a.replace(/%1/g,d.pkID)+'">'+e+"</a>"}}
function RecordFieldFormatterURLPatternKey(a,b){for(var c=[],d=2;d<arguments.length;++d)c[c.length]=arguments[d];this.Format=function(d,f){for(var g=b?b.Format(d,f):f[d],h=a,i=0;i<c.length;++i)h=h.replace(RegExp("%"+(i+1),"g"),f[c[i]]);return'<a href="'+h+'">'+g+"</a>"}}function RecordFieldFormatterPublishedArtefact(a){this.Format=function(b,c){var d=a?a.Format(b,c):c[b];return c.published?'<a href="/'+c.pkID+'/">'+d+"</a>":d}}
function RecordFieldFormatterParamScriptURL(a,b,c){this.Format=function(d,e){var f=c?c.Format(d,e):e[d];return'<a href="#" onclick="'+a.replace(/%1/g,e[b])+'; return BSPreventDefaultAction( event);">'+f+"</a>"}}
function RecordFieldFormatterParamScriptURLEx(a,b){for(var c=[],d=2;d<arguments.length;++d)c[d-2]=arguments[d];this.Format=function(d,f){for(var g=b?b.Format(d,f):f[d],h=a,i=0;i<c.length;++i)h=h.replace("%"+(i+1).toString(),f[c[i]]?f[c[i]]:"");return'<a href="#" onclick="'+h+';return BSPreventDefaultAction( event);">'+g+"</a>"}}
function RecordFieldFormatterParamScriptURLLabel(a,b,c){this.Format=function(d,e){return'<a href="#" onclick="'+a.replace(/%1/g,e[b])+'; return BSPreventDefaultAction( event);">'+c+"</a>"}}function RecordFieldFormatterLabel(a){this.Format=function(){return a}}function RecordFieldFormatterEmptyLabel(a){this.Format=function(b,c){var d=c[b];if(typeof d=="undefined"||d=="")d=a;return d}}
function RecordFieldFormatterAlternate(a,b){this.Format=function(c,d){return typeof d[c]=="undefined"?b.Format(a,d):b.Format(c,d)}}function RecordFieldFormatterChangeButtons(a,b,c){function d(a,b,c,d,i){return'<a class="'+i+'" title="'+d+'" href="#" onclick="'+b+"."+c+"("+a+'); return BSPreventDefaultAction( event);"><span>&nbsp;</span><a>'}this.Format=function(e,f){var g=f.pkID;return d(g,a,"Edit",c,"btn_edit")+" "+d(g,a,"Delete",b,"btn_del")}};function GetObjectPropertiesCount(a){var b=0,c;for(c in a)++b;return b}
function Recordset(a,b){function c(a,b){var c={},d;for(d in a)b!=d&&(c[d]=a[d]);return c}function d(a){this.IsLess=function(b,c){return b[a]<c[a]}}function e(a){this.IsLess=function(b,c){return b[a]>c[a]}}var f={},g=b?b:"pkID",h=0,i={};this.QueryContext={from:0,items:10,sortcolumn:1,sortdirection:"ASC"};this.GetTotal=function(){return h};this.LoadFromJson=function(a){!a||a==""?this.Clear():(a=eval("("+a+")"),a.error?reportScriptError(a.error):this.LoadFromObject(a))};this.LoadFromRecordsetNode=function(a){this.Clear();
if(a){for(var b=a.attributes,c=0;c<b.length;++c){var d=b.item(c);this.QueryContext[d.nodeName]=d.nodeValue}a=a.childNodes;for(c=0;c<a.length;++c)if(b=a[c],b.nodeName=="record"){for(var d=b.childNodes,b={},f=0;f<d.length;f++){var j=d[f];if(j.nodeType==1){var m=null;j.firstChild&&j.firstChild.nodeType==1?(m=new Recordset,m.LoadFromRecordsetNode(j.firstChild)):m=j.firstChild?j.firstChild.nodeValue:"";b[j.nodeName]=m}}this.SetRecord(b)}else b.nodeName=="summary"&&(h=new Number(b.getAttribute("total")))}else alert("empty node passed into recordset")};
this.LoadFromObject=function(a){this.Clear();if(a.params)this.QueryContext=a.params;if(a.summary)h=a.summary.total;(a=a.recordset)&&this.LoadFromArray(a)};this.LoadFromArray=function(a){for(var b=0;b<a.length;++b){var c=a[b],d;for(d in c){var f=c[d];if(typeof f=="object"&&f.recordset){var j=new Recordset("");j.LoadFromObject(f);c[d]=j}else typeof f=="string"&&(c[d]=TryString2Date(f));this.SetRecord(c)}}};this.SaveToJson=function(){var a='{ "params":{',b="",c;for(c in this.QueryContext)a+=b+'"'+c+
'":"'+this.QueryContext[c]+'"',b=",";a+='} , "recordset":[';var b="",d;for(d in f){a+=b+"{";c=f[d];var b="",e;for(e in c)if(e!=g||!this.IsNew(c[g]))a+=b+'"'+e+'":',a+=typeof c[e]=="object"&&c[e].SaveToJson?c[e].SaveToJson():Value2Json(c[e]),b=",";a+="}";b=","}a+="]}";return a};this.GetPrimaryKey=function(a){var b="";a[g]!=void 0&&a[g]!=""?b="pk"+a[g]:(b=this.GetUniquePropertyValue(g,""),a[g]=b,b="pk"+b,i[b]=true);return b};this.SetRecord=function(a){var b=this.GetPrimaryKey(a);f[b]=a};this.InsertRecord=
function(a,b){var c=this.GetPrimaryKey(a),d={},e=false,j;for(j in f)d[j]=f[j],"pk"+b==j&&(e=true,d[c]=a);e||(d[c]=a);f=d};this.Exists=function(a){return typeof f[a]!="undefined"};this.GetRecord=function(a){return f["pk"+a]};this.IsNew=function(a){return true==i["pk"+a]};this.RemoveRecord=function(a){var b="pk"+a;f=c(f,b);this.IsNew(a)&&(i=c(i,b))};this.FindByProperty=function(a,b){for(var c in f){var d=f[c];if(d[a]==b)return d}return null};this.GetUniquePropertyValue=function(a,b){var c=1,d;do d=
b+c++;while(this.FindByProperty(a,d));return d};this.IsEmpty=function(){for(var a in f)return false;return true};this.GetRecordArray=function(){var a=[],b;for(b in f)a[a.length]=f[b];return a};this.GetCount=function(){return GetObjectPropertiesCount(f)};this.Clear=function(){i={};f={}};this.AddNewRecord=function(){var a={};this.SetRecord(a);return a};this.SelectByField=function(a,b){var c=new Recordset("",g),d;for(d in f){var e=f[d];e[b].indexOf(a)!=-1&&c.SetRecord(e)}return c};this.Rollback=function(){var a=
i,b;for(b in a)this.RemoveRecord(b.substring(2))};this.SortAsc=function(a){this.Sort(new d(a))};this.SortDesc=function(a){this.Sort(new e(a))};this.Sort=function(a){var b=[],c;for(c in f){for(var d=0,e=f[c];d<b.length;++d)if(a.IsLess(e,b[d]))break;b.splice(d,0,e)}this.Clear();for(d=0;d<b.length;++d)this.SetRecord(b[d])};a!=void 0&&a!=""&&this.LoadFromJson(a)}
function Value2Json(a,b){if(null==a)return"null";var c=typeof a,d=b?"":'"';if(c=="string"){var e=new String(a);return d+e.replace(/\\/g,"\\\\").replace(/\"/g,'\\"').replace(/\n/g,"\\n")+d}else if(c=="object"){c="";if(a instanceof Array){c="";for(d=0;d<a.length;++d)c+=","+Value2Json(a[d]);c=a.length?"["+c.substr(1)+"]":"[]"}else if(a instanceof Date)c=d+Date2String(a)+d;else{c="";d=0;for(e in a)++d,c+=',"'+e+'":'+Value2Json(a[e]);c=d?"{"+c.substr(1)+"}":"{}"}return c}else return c=="undefined"?d+d:
a};function RecordsetHeader(){this.Columns={};this.Size=0;this.AddColumn=function(a,b,c,d,e){var f={};f.name=a;f.dispname=b;f.formatter=c;f.description=d;f.chartKind=e;this.Columns[a]=f;this.Size++};this.GetLabel=function(a){var b=this.Columns[a],a=b.dispname;(b=b.description)&&(a='<span title="'+b+'">'+a+"</span>");return a};this.GetFormatter=function(a){return this.Columns[a]?this.Columns[a].formatter:null};this.HasColumn=function(a){return typeof this.Columns[a]!="undefined"}}
function RecordsetRenderer(a,b){var c,d;function e(b){var c=BSGetElementSize(document.getElementById(a));return'<div class="table" '+(c.x?'style="'+BSGetMaxWidthProperty()+":"+c.x+'px"':"")+'><table class="recordset">'+b+"</table></div>"}function f(b,e,f){return'<td class="'+(e?c:d)+'">'+(e?'<a href="#" id="'+("nav_"+a+"_")+b+'">':"")+f+(e?"</a>":"")+"</td>"}function g(a,b,c){if(c&&(a=document.getElementById(a)))for(var d=a.getElementsByTagName("a"),j=0;j<d.length;++j){var m=d[j],a=m.id.replace(b,
"");BSAdviseEvent(m,"click",c,a)}}c="recordset_navigation";d="recordset_navigation_current";var h=this,i=function(a){var b=Number(a.QueryContext.items);return b?Math.floor((Number(a.QueryContext.from)+1)/b):0},k=function(a){var b=Number(a.QueryContext.items);return b?Math.floor(a.GetTotal()/b)+(a.GetTotal()%b?1:0):0};this.RenderMessage=function(b,c){var d=h.CreateTableHeader("","",false);d+='<tr><td colspan="'+h.Header.Size+'">'+c+"</td></tr>";d+=h.GetEmptyLines(b-1);document.getElementById(a).innerHTML=
e(d)};this.GetEmptyLines=function(a){for(var b="",c=this.Header.Size,d=0;d<a;++d)b+='<tr><td colspan="'+c+'">&nbsp;</td></tr>';return b};this.AddColumn=function(a,b,c,d,j){h.Header.AddColumn(a,b,c,d,j)};this.Render=function(b,c,d){b=h.CreateTable(b,c?true:false,d?true:false);document.getElementById(a).innerHTML=b;d&&g("navigation_div_"+a,"nav_"+a+"_",d);c&&g(h.GetHeaderId(),"col_"+a+"_",c)};this.CreateTable=function(a,b,c){b=h.CreateTableHeader(a.QueryContext.sortcolumn,a.QueryContext.sortdirection,
b);b+=h.CreateTableData(a);c&&(b+=h.CreateNavigation(i(a),k(a)));return e(b)};this.CreateTableHeader=function(b,c,d){var e='<thead><tr id="'+h.GetHeaderId()+'" class="tr_header">',j;for(j in h.Header.Columns){var m="th_notsorted";j==b&&(m=c=="ASC"?"th_sortedasc":"th_sorteddesc");e+="<th>";d&&(e+='<a href="" class="'+m+'" id="'+("col_"+a+"_")+j+'">');e+=h.Header.GetLabel(j);d&&(e+="</a>");e+="</th>"}e+="</tr></thead>";return e};this.CreateTableData=function(a){for(var b=1,c=a.GetRecordArray(),d="<tbody>",
j=0;j<c.length;j++)d+=h.CreateRowData(b%2?"tr_odd":"tr_even",c[j]),b++;b=a.QueryContext.items;0==b&&(b=a.GetCount());d+=h.GetEmptyLines(b-c.length);d+="</tbody>";return d};this.CreateRowData=function(a,b){var c='<tr class="'+a+'">',d;for(d in h.Header.Columns){c+='<td class="td_'+d+'">';var j=h.Header.GetFormatter(d);c+=j?j.Format(d,b):b[d];c+="</td>"}c+="</tr>";return c};this.GetHeaderId=function(){return"header_"+a};this.CreateNavigation=function(c,d){if(d<=1)return"";var e='<tfoot><tr><td colspan="'+
h.Header.Size+'">';e+='<table class="recordset_navigation" id="navigation_div_'+a+'">';e+="<tr>";var g=c-b/2,j=c+b/2;g<0?(g=0,j=b>=d?d-1:b):j>d-1&&(j=d-1,g=b>d?0:d-b);for(var m=f(g>0?g-1:0,c!=0,"&lt;&lt;");g<=j;)m+=f(g,c!=g,g+1),g++;m+=f(g==d?d-1:g,c!=d-1,"&gt;&gt;");e+=m;e+="</tr>";e+="</table></td></tr></tfoot>";return e};this.Header=new RecordsetHeader}function AjaxTableNoEmptyRowsRenderer(a,b){this.inheritFrom=RecordsetRenderer;this.inheritFrom(a,b);this.GetEmptyLines=function(){return""}};function Commenter(a,b){this.OuterDivID=a;this.URL=b;this.SetTable=function(a){this.Comments=a};this.initdialog=function(a){this.Dialog=a};this.onchanged=function(){};this.onkeypressed=function(){return true};this.oncommand=function(a){clearLastError();"ok"==a?this.Dialog.Validate()&&this.Send():"cancel"==a&&this.Discard()};this.Send=function(){if(this.Dialog.Validate()){this.Dialog.Busy();var a=BSMakePOSTRequest,b=this.URL,e=this.Dialog,f={id:e.comment_id.GetValue(),message:e.message_text.GetValue(),
parent:e.parent.GetValue()};if(void 0!=e.captcha)f.captcha=e.captcha.GetValue();if(void 0!=e.sender)f.sender=e.sender.GetValue();a(b,this,f)}};this.Discard=function(){document.getElementById(this.OuterDivID).style.display="none"};this.OnResponse=function(){this.Dialog.Free();this.ResetCaptcha();this.Dialog.message_text.SetValue("");this.Comments.Reload()};this.OnError=function(a){this.Dialog.Free();this.ResetCaptcha();this.Dialog.ShowError(null,a);return true};this.ResetCaptcha=function(){if(commenter.Dialog.captcha)commenter.Dialog.captcha.SetValue(""),
document.getElementById(this.Dialog.GetElement().id+"_captcha_image").src="/captcha/?"+Math.random()}}
function CommentsRenderer(a,b){function c(a,b){return'<p class="'+a+'">'+b+"</p>"}this.inheritFrom=RecordsetRenderer;this.inheritFrom(a,b);var d=this;this.GetEmptyLines=function(){return""};this.CreateTableHeader=function(){return""};this.CreateRowData=function(a,b){var g="<tr>";g+='<td colspan=2 class="comment_created">';var h=d.Header.GetFormatter("posted")?d.Header.GetFormatter("posted").Format("posted",b):b.posted;g+='<span class="comment_posted">'+h+"</span>";d.Header.GetFormatter("spamVotes")&&
(g+='<span class="spam_control">',d.Header.GetFormatter("spamDelete")&&(g+=d.Header.GetFormatter("spamDelete").Format("spamDelete",b),g+=" "),g+=d.Header.GetFormatter("spamControl").Format("spamControl",b)+" "+b.spamVotes+"/"+b.spamLimit,g+="</span>");g+="</td>";g+="</tr>";g+='<tr class="comment_data">';g+='<td class="author_info">';0==b.role?g+=this.RenderAnonimousInfo(b):(g+=c("nick",d.Header.GetFormatter("nickname")?d.Header.GetFormatter("nickname").Format("nickname",b):b.nickname),g+=c("role",
d.Header.GetFormatter("role")?d.Header.GetFormatter("role").Format("role",b):b.role),g+=c("photo",d.Header.GetFormatter("photo")?d.Header.GetFormatter("photo").Format("photo",b):b.photo),g+=c("regdate",d.Header.GetFormatter("created")?d.Header.GetFormatter("created").Format("created",b):b.created),g+=c("posts",d.Header.GetFormatter("posts")?d.Header.GetFormatter("posts").Format("posts",b):b.posts));g+="</td>";g+='<td class="message">';g+=b.message;g+="</td>";g+="</tr>";return g};this.RenderAnonimousInfo=
function(a){a.photo="/img/none.jpg";var b=c("nick",d.Header.GetFormatter("nickname")?d.Header.GetFormatter("nickname").Format("nickname",a):a.nickname);b+=c("role",d.Header.GetFormatter("role")?d.Header.GetFormatter("role").Format("role",a):a.role);b+=c("photo",d.Header.GetFormatter("photo")?d.Header.GetFormatter("photo").Format("photo",a):a.photo);return b}}
function ArtefactRater(a,b,c){function d(a,b,c,d){for(var f=1;f<=5;++f){var l=e(a,"rate"+f);if(null!=l)l.src=b>=f?c:d}}function e(a,b){for(var c=a.childNodes,d=0;d<c.length;++d){var f=c[d];if(null!=f.attributes){var l=f.attributes.getNamedItem("id");if(null!=l&&l.value==b)return f}f=e(f,b);if(null!=f)return f}return null}this.ArtefactID=c;this.ContentID=b;this.URL=a;var f=this;this.Forbid=false;this.Votes=this.Score=0;this.setInfo=function(a,b){this.Score=a;this.Votes=b;var c=document.getElementById(this.ContentID);
if(null==c)alert("Error message "+this.ContentID+" is not included by server-side code. Contact site support");else{var f=e(c,"rating_login_id");if(null!=f)f.style.display="none";f=e(c,"rating_score_id");if(null!=f)f.innerHTML="("+(new FormatterNumber(2)).Format(a)+")";f=e(c,"rating_votes_id");if(null!=f)f.innerHTML=b;d(c,a,"/img/rated_on.gif","/img/rated_off.gif")}};this.Disable=function(){this.Forbid=true};this.setRate=function(a){this.Forbid||BSMakePOSTRequest(this.URL,this,{id:this.ArtefactID,
mark:a})};this.setNormal=function(){var a=document.getElementById(this.ContentID);null==a?alert("Error message "+this.ContentID+" is not included by server-side code. Contact site support"):this.Forbid||d(a,this.Score,"/img/rated_on.gif","/img/rated_off.gif")};this.setHighlight=function(a){var b=document.getElementById(this.ContentID);if(null==b)alert("Error message "+this.ContentID+" is not included by server-side code. Contact site support");else if(this.Forbid){if(a=e(b,"rating_login_id"),null!=
a)a.style.display="inline",a.style.position="absolute"}else d(b,a,"/img/rate_on.gif","/img/rate_off.gif")};this.OnResponse=function(a){f.setInfo(a.score,a.votes)}}
function FormTrackerHandler(a){this.Dialog=null;this.URL=a;this.onchanged=function(){BSMakePOSTRequest(this.URL,this,{id:this.Dialog.item_id.GetValue(),op:this.Dialog.op.GetValue()})};this.initdialog=function(a){this.Dialog=a};this.oncommand=function(){clearLastError()};this.onkeypressed=function(){return true};this.OnResponse=function(){}}
function SpamControl(a,b){this.URL=a;var c=this;this.Comments=b;this.Request=function(a,b){BSMakePOSTRequest(this.URL,this,{id:b,op:a})};this.Report=function(a){this.Request("report",a)};this.Close=function(a){this.Request("close",a)};this.Delete=function(a){this.Request("delete",a)};this.OnResponse=function(){c.Comments.Reload()}}
function Requester(a){this.URL=a;this.Request=function(a){BSMakePOSTRequest(this.URL,this,{id:a})};this.Close=function(a){this.Request(a)};this.OnResponse=function(){alert("Done")}};var PCI=typeof PCI=="object"?PCI:function(){function a(){this.match=function(a,c,d){if(typeof d=="object"){var e=null;switch(d.t){case "&":e=this.matchAnd(a,c,d);break;case "!":e=this.matchNot(a,c,d);break;case "|":e=this.matchOneOf(a,c,d);break;case "->":e=this.matchReference(a,c,d);break;case "*":e=this.matchArray(a,c,d);break;case "+":e=this.matchArray1(a,c,d);break;default:throw"Invalid rule type '"+d.t+"'";}return e}return this.matchExactString(a,c,d)};this.matchAnd=function(a,c,d){for(var e=
[],f=a.getPos(),g=0;g<d.v.length;++g){var h=this.match(a,c,d.v[g]);if(!h)return a.setPos(f),null;e[g]=h}return new PCI.resultArray(e,d)};this.matchOneOf=function(a,c,d){for(var e=0;e<d.v.length;++e){var f=this.match(a,c,d.v[e]);if(f)return f}return null};this.matchArray=function(a,c,d){for(var e=null,f=[];e=this.match(a,c,d.v);)f[f.length]=e;return new PCI.resultArray(f,d)};this.matchArray1=function(a,c,d){for(var e=null,f=[];e=this.match(a,c,d.v);)f[f.length]=e;return f.length==0?null:new PCI.resultArray(f,
d)};this.matchNot=function(a,c,d){var e=a.getPos(),c=this.match(a,c,d.v);a.setPos(e);return c?null:(a=a.get())?new PCI.resultString(a,d):null};this.matchReference=function(a,c,d){var e=a.getPos();return(a=this.match(a,c,c[d.v]))?new PCI.resultReference(a,d.v,e):null};this.matchExactString=function(a,c,d){for(var c="",e=a.getPos(),f=0;f<d.length;++f){var g=a.get();if(!g||g!=d.charAt(f))return a.setPos(e),null;c+=g}return new PCI.resultString(c,d)}}return{resultString:function(a){this.value=a;this.getValue=
function(){return this.value};this.__enum=function(){return[this.value]};this.__clone=function(a){return new PCI.resultString(a[0])}},resultReference:function(a,c,d){this.value=a;this.pos=d;this.getPos=function(){return d};this.getValue=function(){return this.value.getValue()};this.__enum=function(){return[this.value]};this.__name=c;this.__clone=function(a){return new PCI.resultReference(a[0],this.__name)}},resultArray:function(a){this.length=a.length;for(var c=0;c<a.length;++c)this[c]=a[c];this.getValue=
function(){for(var a="",b=0;b<this.length;++b){var c;c=this[b];var g=typeof c;c=g=="number"?c.toString():g=="string"||g=="undefined"?c:c.getValue?c.getValue():c;a+=c}return a};this.__enum=function(){for(var a=[],b=0;b<this.length;++b)a[b]=this[b];return a};this.__clone=function(a){return new PCI.resultArray(a)}},checkrules:function(a){for(var c in a)if(!PCI.checkrule(a[c],a))return false;return true},checkrule:function(a,c){if(typeof a!="object")return true;if(a instanceof Array)for(var d=0;d<a.length;++d){if(!PCI.checkrule(a[d],
c))return false}else if(a.t=="->"&&!c[a.v])return false;return PCI.checkrule(a.v,c)},match:function(b,c,d){return(new a).match(b,c,d)},parserLine:function(a){var c=0;this.get=function(){for(;c!=a.length;)if(ch=a.charAt(c++),!(ch=="\t"||ch=="\r"||ch==" "))return ch;return 0};this.remainder=function(){return a.substr(c)};this.setPos=function(a){c=a};this.getPos=function(){return c}},simpleStream:function(a){var c=0;this.get=function(){for(;c!=a.length;)return ch=a.charAt(c++);return 0};this.remainder=
function(){return a.substr(c)};this.setPos=function(a){c=a};this.getPos=function(){return c}}}}();var PCM=typeof PCM=="object"?PCM:function(){function a(a){return typeof a!="undefined"}function b(){for(var a=[],b=this.args,c=0;c<b.length;++c)a[c]=b[c];return a}function c(){var b=[];if(a(this.arg1))b[b.length]=this.arg1;if(a(this.arg2))b[b.length]=this.arg2;if(a(this.arg3))b[b.length]=this.arg3;return b}function d(a,b){if(PCM.getValue(a.arg2)==PCM.getValue(b))return a.arg1;if(PCM.isNumber(a.arg1)&&PCM.isNumber(b))return PCM.division(PCM.multiplication([a.arg1,b]),a.arg2)}function e(a,b){if(PCM.isNumber(a)&&
PCM.isNumber(b))return PCM.getNumber(a)*PCM.getNumber(b);var c=PCM.getValue(a),e=PCM.getValue(b);if(c=="0"||e=="0")return 0;if(c=="1")return b;if(e=="1")return a;if(a instanceof PCM.multiplication_fn&&b instanceof PCM.multiplication_fn)return c=a.__enum(),PCM.multiplication(c.concat(b.__enum()));if(a instanceof PCM.division_fn&&b instanceof PCM.division_fn)return PCM.getValue(a.arg1)==PCM.getValue(b.arg2)&&PCM.getValue(b.arg1)==PCM.getValue(a.arg2)?1:PCM.getValue(a.arg1)==PCM.getValue(b.arg2)?PCM.division(b.arg1,
a.arg2):PCM.getValue(a.arg2)==PCM.getValue(b.arg1)?PCM.division(a.arg1,b.arg2):PCM.division(PCM.multiplication([a.arg1,b.arg1]),PCM.multiplication([a.arg2,b.arg2]));else if(a instanceof PCM.power_fn&&b instanceof PCM.power_fn&&PCM.getValue(a.arg1)==PCM.getValue(b.arg1))return PCM.power(a.arg1,PCM.sum([a.arg2,b.arg2]));else if(a instanceof PCM.division_fn)return d(a,b);else if(b instanceof PCM.sqrt_fn&&a instanceof PCM.sqrt_fn)return PCM.sqrt(PCM.multiplication([a.arg1,b.arg1]));else if(b instanceof
PCM.division_fn)return d(b,a);else if(c==e)return PCM.power(a,2)}function f(a,b){var c;return(b?"\\left(":"")+PCM.getTeX(a)+(b?"\\right)":"")}function g(a,b){var c;return(b?"(":"")+PCM.getMath(a)+(b?")":"")}function h(a){return f(a,a instanceof PCM.sum_fn||a instanceof PCM.minus_fn)}function i(a){return g(a,a instanceof PCM.sum_fn||a instanceof PCM.minus_fn)}function k(a,b){return PCM.getComplexity(a)-PCM.getComplexity(b)}function n(a,b){if(PCM.isConstant(a))return 0;else if(PCM.getValue(a)=="x")return b;
return PCM.multiplication([b,new PCM.derivative_fn(a)])}function l(a,b,d,e){a.arg1=b;a.immediatepowersign=true;a.name=d;a.__enum=c;a.getValue=function(){return this.name+"("+PCM.getValue(this.arg1)+")"};a.__clone=function(a){return e(a[0])};a.getTeX=function(){return"\\"+this.name+"\\left("+PCM.getTeX(this.arg1)+"\\right)"};a.getMath=function(){return this.name+"("+PCM.getMath(this.arg1)+")"}}function p(a){a.getTeX=function(){return this.name+"\\left("+PCM.getTeX(this.arg1)+"\\right)"}}function o(){var a=
this;this.__translate=function(b){if(b instanceof PCI.resultString)return b.getValue();if(b instanceof PCI.resultReference){var c=a[b.__name];if(c)return c(b.value)}throw"Could not translate: "+PCM.getValue(b);};this.func=function(b){var c=PCM.getValue(b[0]),b=a.__translate(b[2]),d={sin:new PCM.sin_fn(b),cos:new PCM.cos_fn(b),tan:new PCM.tan_fn(b),cot:new PCM.cot_fn(b),tg:new PCM.tan_fn(b),ctg:new PCM.cot_fn(b),th:new PCM.tanh_fn(b),cth:new PCM.coth_fn(b),tanh:new PCM.tanh_fn(b),coth:new PCM.coth_fn(b),
ch:new PCM.cosh_fn(b),sh:new PCM.sinh_fn(b),cosh:new PCM.cosh_fn(b),sinh:new PCM.sinh_fn(b),sec:new PCM.sec_fn(b),cosec:new PCM.csc_fn(b),sech:new PCM.sech_fn(b),csch:new PCM.csch_fn(b),sqrt:new PCM.sqrt_fn(b),exp:new PCM.power_fn(PCM.exp(),b),ln:new PCM.ln_fn(b),lg:new PCM.lg_fn(b),lb:new PCM.lb_fn(b),arcsin:new PCM.arcsin_fn(b),arccos:new PCM.arccos_fn(b),arctan:new PCM.arctan_fn(b),arccot:new PCM.arccot_fn(b),arctg:new PCM.arctan_fn(b),arcctg:new PCM.arccot_fn(b),arcsec:new PCM.arcsec_fn(b),arccosec:new PCM.arccosec_fn(b),
abs:new PCM.abs_fn(b),sgn:new PCM.sign_fn(b),sign:new PCM.sign_fn(b)};return d[c]?d[c]:new PCM.function_fn(b,c)};this.funcnum=function(b){var c=PCM.getValue(b[0]),d=PCM.getNumber(b[1]),b=a.__translate(b[3]);return{root:new PCM.root_fn(b,d),log:new PCM.logn_fn(b,d)}[c]};this.factor=function(b){return(PCM.getValue(b[0])=="-"?-1:1)==1?a.__translate(b[1]):PCM.minus(a.__translate(b[1]))};this.value=function(b){switch(b.__name){case "func":case "pi":case "exponenta":case "variable":case "funcnum":return a.__translate(b);
case "paren expression":return a.__translate(b.value[1])}return PCM.getNumber(b)};this.variable=function(){return new PCM.variable_fn};this.pi=function(){return new PCM.pi_fn};this.exponenta=function(){return PCM.exp()};this.power=function(b){if(b[1].length==0)return a.__translate(b[0]);else{for(var c=[],d=b[1],e=0;e<d.length;++e)c[c.length]=a.__translate(d[e][1]);c=PCM.multiplication(c);b=a.__translate(b[0]);return new PCM.power_fn(b,c)}};this.product=function(b){if(b[1].length==0)return a.__translate(b[0]);
else{for(var c=[a.__translate(b[0])],d=[],b=b[1],e=0;e<b.length;++e){var f=b[e];PCM.getValue(f[0])=="*"?c[c.length]=a.__translate(f[1]):PCM.getValue(f[0])=="/"&&(d[d.length]=a.__translate(f[1]))}return d.length?(c=c.length>1?new PCM.multiplication_fn(c):c[0],d=d.length>1?new PCM.multiplication_fn(d):d[0],new PCM.division_fn(c,d)):c.length==1?c[0]:new PCM.multiplication_fn(c)}};this.sum=function(b){if(b[1].length==0)return a.__translate(b[0]);else{for(var c=[a.__translate(b[0])],b=b[1],d=0;d<b.length;++d){var e=
b[d];c[c.length]=a.__translate(e[1]);PCM.getValue(e[0])=="-"&&(c[c.length-1]=new PCM.minus_fn(c[c.length-1]))}return c.length==1?c[0]:new PCM.sum_fn(c)}};this.expression=function(b){return a.__translate(b)}}return{isNumber:function(a){return typeof a=="number"},isConstant:function(a){if(typeof a=="string"||typeof a=="number")return true;if(a instanceof PCM.variable_fn)return false;for(var a=a.__enum(),b=0;b<a.length;++b)if(!PCM.isConstant(a[b]))return false;return true},getNumber:function(a){var b=
typeof a;if(b=="number")return a;else if(b=="string")return Number(a);return Number(a.getValue())},getValue:function(a){var b=typeof a;if(b=="number")return new String(a);else if(b=="string"||b=="undefined")return a;return a.getValue?a.getValue():a},getTeX:function(a){var b=typeof a;if(b=="number")return new String(a);else if(b=="string"||b=="undefined")return a;return a.getTeX?a.getTeX():a},getMath:function(a){var b=typeof a;if(b=="number")return new String(a);else if(b=="string"||b=="undefined")return a;
return a.getMath?a.getMath():a},getComplexity:function(a){var b=1,c=typeof a;if(c=="object"||a.__enum)if(a instanceof PCM.variable_fn)b+=3;else{b+=1;a instanceof PCM.division_fn&&(b+=1);a instanceof PCM.power_fn&&(b+=typeof a=="number"||typeof a=="object"&&a.arg1 instanceof PCM.variable_fn?1:2);a=a.__enum();for(c=0;c<a.length;++c)b+=PCM.getComplexity(a[c])}else c=="number"&&(a<0&&(b+=1),a!=Math.round(a)&&(b+=1));return b},getNod:function(a,b){for(var c=a<0?-a:a,d=b<0?-b:b;c*d;)c>=d?c%=d:d%=c;return c+
d},getMultipliers:function(a){if(a instanceof PCM.multiplication_fn)return a.__enum();else if(a instanceof PCM.minus_fn){var b=PCM.getMultipliers(a.arg1);b[b.length]=-1;return b}else if(a instanceof PCM.power_fn){for(var b=PCM.getMultipliers(a.arg1),c=[],d=0;d<b.length;++d)c[c.length]=PCM.power(b[d],a.arg2);return c}return[a]},calculate:function(a,b){return PCM.isNumber(a)?a:a.calculate(b)},division_fn:function(a,b){this.arg1=a;this.arg2=b;this.__enum=c;this.getValue=function(){return"("+PCM.getValue(this.arg1)+
")/("+PCM.getValue(this.arg2)+")"};this.getTeX=function(){return"\\frac{"+PCM.getTeX(this.arg1)+"}{"+PCM.getTeX(this.arg2)+"}"};this.getMath=function(){return i(this.arg1)+"/"+i(this.arg2)};this.getDerivative=function(){return PCM.division(PCM.sum([PCM.multiplication([PCM.derivative(this.arg1),this.arg2]),PCM.minus(PCM.multiplication([this.arg1,PCM.derivative(this.arg2)]))]),PCM.power(this.arg2,2))};this.__clone=function(a){return PCM.division(a[0],a[1])};this.calculate=function(a){return PCM.calculate(this.arg1,
a)/PCM.calculate(this.arg2,a)}},division:function(a,b){if(a instanceof PCM.division_fn&&b instanceof PCM.division_fn)return PCM.division(PCM.multiplication([a.arg1,b.arg2]),PCM.multiplication([a.arg2,b.arg1]));else if(a instanceof PCM.division_fn){var c=PCM.division(a.arg1,PCM.multiplication([a.arg2,b]));return c}else if(b instanceof PCM.division_fn)return PCM.division(PCM.multiplication([a,b.arg2]),b.arg1);for(var d=PCM.getMultipliers(a),e=PCM.getMultipliers(b),f=0;f<d.length;++f)for(var g=0;g<e.length;++g){var c=
d[f],h=e[g];if(PCM.getValue(c)==PCM.getValue(h))e[g]=1,d[f]=1;else if(PCM.isNumber(c)&&PCM.isNumber(h)&&c==Math.round(c)&&h==Math.round(h)){var c=PCM.getNumber(c),h=PCM.getNumber(h),i=PCM.getNod(c,h);e[g]=h/i;d[f]=c/i}else continue;break}c=PCM.multiplication(d);h=PCM.multiplication(e);d=PCM.isNumber(c);e=PCM.isNumber(h);return c=d&&PCM.getNumber(c)==0?0:e&&PCM.getNumber(h)==1?c:new PCM.division_fn(c,h)},multiplication:function(a){for(var b=[],c=false,d=0;d<a.length;++d)for(var f=PCM.getMultipliers(a[d]),
g=0;g<f.length;++g){var h=f[g];if(h==-1)c=!c;else{for(var i=false,k=0;k<b.length;++k){var l=e(b[k],h);if(typeof l!="undefined"){b[k]=l;i=true;break}}i||(b[b.length]=h)}}l=b.length==1?b[0]:b.length==0?1:new PCM.multiplication_fn(b);return c?PCM.minus(l):l},multiplication_fn:function(a){this.args=a;this.__enum=b;this.sorted=false;this.sort=function(){this.args.sort(k)};this.getValue=function(){this.sort();for(var a="",b=0;b<this.args.length;++b)a=a+"*"+PCM.getValue(this.args[b]);return a.substring(1)};
this.getTeX=function(){this.sort();for(var a="",b="",c=0;c<this.args.length;++c)a=a+b+" "+h(this.args[c]),b="\\cdot";return a};this.getMath=function(){this.sort();for(var a="",b="",c=0;c<this.args.length;++c)a=a+b+i(this.args[c]),b="*";return a};this.__clone=function(a){return PCM.multiplication(a)};this.getDerivative=function(){for(var a=[],b=0;b<this.args.length;++b){for(var c=[],d=0;d<this.args.length;++d)c[c.length]=b==d?PCM.derivative(this.args[d]):this.args[d];a[a.length]=PCM.multiplication(c)}return PCM.sum(a)};
this.calculate=function(a){for(var b=1,c=0;c<this.args.length;++c)b*=PCM.calculate(this.args[c],a);return b}},sum:function(a){for(var b=0,c=[],d=0;d<a.length;++d)PCM.isNumber(a[d])?b+=PCM.getNumber(a[d]):c[c.length]=a[d];if(!c.length)return b;b&&(c[c.length]=b);return c.length==1?c[0]:new PCM.sum_fn(c)},sum_fn:function(a){this.args=a;this.__enum=b;this.getValue=function(){for(var a="",b=0;b<this.args.length;++b){var c=new String(PCM.getValue(this.args[b]));c.length>0&&c.charAt(0)=="-"||a.length==
0?a+=c:a=a+"+"+c}return"("+a+")"};this.getTeX=function(){for(var a="",b=0;b<this.args.length;++b){var c=new String(PCM.getValue(this.args[b]));c.length>0&&c.charAt(0)=="-"||a.length==0?a+=PCM.getTeX(this.args[b]):a=a+"+"+PCM.getTeX(this.args[b])}return a};this.getMath=function(){for(var a="",b=0;b<this.args.length;++b){var c=new String(PCM.getValue(this.args[b]));c.length>0&&c.charAt(0)=="-"||a.length==0?a+=PCM.getMath(this.args[b]):a=a+"+"+PCM.getMath(this.args[b])}return a};this.getDerivative=function(){for(var a=
[],b=0;b<this.args.length;++b)PCM.isConstant(this.args[b])||(a[a.length]=PCM.derivative(this.args[b]));return PCM.sum(a)};this.__clone=function(a){return PCM.sum(a)};this.calculate=function(a){for(var b=0,c=0;c<this.args.length;++c)b+=PCM.calculate(this.args[c],a);return b}},substraction:function(a,b){return PCM.sum([a,PCM.minus(b)])},power:function(a,b){if(PCM.isNumber(a)&&PCM.isNumber(b)){var c=PCM.getNumber(a),d=PCM.getNumber(b);return d<0?PCM.division(1,PCM.power(a,-d)):Math.pow(c,d)}if(PCM.isNumber(b)){c=
PCM.getNumber(b);if(c==0)return 1;if(c==1)return a}else if(PCM.isNumber(a)){c=PCM.getNumber(a);if(c==0)return 0;if(c==1)return 1}return a instanceof PCM.power_fn?new PCM.power_fn(a.arg1,PCM.multiplication([b,a.arg2])):new PCM.power_fn(a,b)},power_fn:function(a,b){this.arg1=a;this.arg2=b;this.__enum=c;this.getValue=function(){return"("+PCM.getValue(this.arg1)+")^"+PCM.getValue(this.arg2)};this.getTeX=function(){return typeof this.arg1=="object"&&this.arg1.immediatepowersign?"{\\"+this.arg1.name+"}^{"+
PCM.getTeX(this.arg2)+"}\\left({"+PCM.getTeX(this.arg1.arg1)+"}\\right)":"{"+f(this.arg1,this.arg1 instanceof PCM.sum_fn||this.arg1 instanceof PCM.multiplication_fn||this.arg1 instanceof PCM.division_fn||this.arg1 instanceof PCM.minus_fn)+"}^{"+PCM.getTeX(this.arg2)+"}"};this.getMath=function(){return g(this.arg1,this.arg1 instanceof PCM.sum_fn||this.arg1 instanceof PCM.multiplication_fn||this.arg1 instanceof PCM.division_fn||this.arg1 instanceof PCM.minus_fn)+"^"+i(this.arg2)};this.__clone=function(a){return PCM.power(a[0],
a[1])};this.getDerivative=function(){var a=PCM.isConstant(this.arg1),b=PCM.isConstant(this.arg2);return a&&b?0:a?(a=[this,PCM.ln(this.arg1)],PCM.getValue(this.arg2)!="x"&&(a[a.length]=PCM.derivative(this.arg2)),PCM.multiplication(a)):b?(a=[this.arg2,PCM.power(this.arg1,PCM.sum([this.arg2,-1]))],PCM.getValue(this.arg1)!="x"&&(a[a.length]=PCM.derivative(this.arg1)),PCM.multiplication(a)):PCM.derivative(new PCM.power(PCM.exp(),PCM.multiplication([PCM.ln(this.arg1),this.arg2])))};this.calculate=function(a){return Math.pow(PCM.calculate(this.arg1,
a),PCM.calculate(this.arg2,a))}},minus:function(a){if(PCM.isNumber(a))return-PCM.getNumber(a);else if(a instanceof PCM.minus_fn)return a.arg1;else if(a instanceof PCM.division_fn)return PCM.division(PCM.minus(a.arg1),a.arg2);else if(a instanceof PCM.multiplication_fn)if(a.args[0]instanceof PCM.minus_fn)return a.args[0]=a.args[0].arg1,a;else if(PCM.isNumber(a.args[0]))return a.args[0]=-PCM.getNumber(a.args[0]),a;return new PCM.minus_fn(a)},minus_fn:function(a){l(this,a,"minus",PCM.minus);this.immediatepowersign=
false;this.getValue=function(){return"-"+PCM.getValue(this.arg1)};this.getTeX=function(){return"-"+h(this.arg1)};this.getMath=function(){return"-"+i(this.arg1)};this.getDerivative=function(){return PCM.minus(PCM.derivative(a))};this.calculate=function(a){return-PCM.calculate(this.arg1,a)}},sin:function(a){return new PCM.sin_fn(a)},sin_fn:function(a){l(this,a,"sin",PCM.sin);this.getDerivative=function(){return n(this.arg1,PCM.cos(this.arg1))};this.calculate=function(a){return Math.sin(PCM.calculate(this.arg1,
a))}},cos:function(a){return new PCM.cos_fn(a)},cos_fn:function(a){l(this,a,"cos",PCM.cos);this.getDerivative=function(){return n(this.arg1,PCM.minus(PCM.sin(this.arg1)))};this.calculate=function(a){return Math.cos(PCM.calculate(this.arg1,a))}},ln:function(a){return a instanceof PCM.exp_fn?1:new PCM.ln_fn(a)},ln_fn:function(a){l(this,a,"ln",PCM.ln);this.getDerivative=function(){return n(this.arg1,PCM.division(1,this.arg1))};this.calculate=function(a){return Math.log(PCM.calculate(this.arg1,a))}},
lg:function(a){return new PCM.lg_fn(a)},lg_fn:function(a){l(this,a,"lg",PCM.lg);this.getDerivative=function(){return n(this.arg1,PCM.division(1,PCM.multiplication([this.arg1,PCM.ln(10)])))};this.calculate=function(a){return Math.log(PCM.calculate(this.arg1,a))/Math.log(10)}},lb:function(a){return new PCM.lb_fn(a)},lb_fn:function(a){l(this,a,"lb",PCM.lb);p(this);this.getDerivative=function(){return n(this.arg1,PCM.division(1,PCM.multiplication([this.arg1,PCM.ln(2)])))};this.calculate=function(a){return Math.log(PCM.calculate(this.arg1,
a))/Math.log(2)}},logn:function(a,b){return new PCM.logn_fn(a,b)},logn_fn:function(a,b){l(this,a,"log_"+b,PCM.logn);this.getMath=function(){return"log"+this.arg2+"("+PCM.getMath(this.arg1)+")"};this.arg2=b;this.__clone=function(a){return PCM.logn(a[0],a[1])};this.getDerivative=function(){return n(this.arg1,PCM.division(1,PCM.multiplication([this.arg1,PCM.ln(this.arg2)])))};this.calculate=function(a){return Math.log(PCM.calculate(this.arg1,a))/Math.log(this.arg2)}},cosh_fn:function(a){l(this,a,"cosh",
PCM.cosh);this.getDerivative=function(){return n(this.arg1,PCM.sinh(this.arg1))};this.calculate=function(a){a=PCM.calculate(this.arg1,a);return(Math.exp(a)+Math.exp(-a))/2}},cosh:function(a){return new PCM.cosh_fn(a)},sinh_fn:function(a){l(this,a,"sinh",PCM.sinh);this.getDerivative=function(){return n(this.arg1,PCM.cosh(this.arg1))};this.calculate=function(a){a=PCM.calculate(this.arg1,a);return(Math.exp(a)-Math.exp(-a))/2}},sinh:function(a){return new PCM.sinh_fn(a)},sech_fn:function(a){l(this,a,
"sech",PCM.sech);p(this);this.getDerivative=function(){return PCM.division(1,PCM.cosh(this.arg1)).getDerivative()};this.calculate=function(a){a=PCM.calculate(this.arg1,a);return 2/(Math.exp(a)+Math.exp(-a))}},sech:function(a){return new PCM.sech_fn(a)},csch_fn:function(a){l(this,a,"csch",PCM.csch);p(this);this.getDerivative=function(){return PCM.division(1,PCM.sinh(this.arg1)).getDerivative()};this.calculate=function(a){a=PCM.calculate(this.arg1,a);return 2/(Math.exp(a)-Math.exp(-a))}},csch:function(a){return new PCM.csch_fn(a)},
tanh_fn:function(a){l(this,a,"tanh",PCM.tanh);this.getDerivative=function(){return n(this.arg1,PCM.division(1,PCM.power(PCM.cosh(this.arg1),2)))};this.calculate=function(a){a=PCM.calculate(this.arg1,a);return(Math.exp(2*a)-1)/(Math.exp(2*a)+1)}},tanh:function(a){return new PCM.tanh_fn(a)},coth_fn:function(a){l(this,a,"coth",PCM.coth);this.getDerivative=function(){return n(this.arg1,PCM.division(-1,PCM.power(PCM.sinh(this.arg1),2)))};this.calculate=function(a){a=PCM.calculate(this.arg1,a);return(Math.exp(2*
a)+1)/(Math.exp(2*a)-1)}},coth:function(a){return new PCM.coth_fn(a)},variable_fn:function(){this.getValue=function(){return"x"};this.getTeX=function(){return"{x}"};this.getMath=function(){return"x"};this.__enum=function(){return[]};this.__clone=function(){return new PCM.variable_fn};this.getDerivative=function(){return 1};this.calculate=function(a){return a.x}},sqrt_fn:function(a){l(this,a,"sqrt",PCM.sqrt);this.immediatepowersign=false;this.getTeX=function(){return"\\sqrt{"+PCM.getTeX(this.arg1)+
"}"};this.getDerivative=function(){return n(this.arg1,PCM.division(1,PCM.multiplication([2,PCM.sqrt(this.arg1)])))};this.calculate=function(a){a=PCM.calculate(this.arg1,a);return Math.sqrt(a)}},sqrt:function(a){return new PCM.sqrt_fn(a)},root_fn:function(a,b){this.arg1=a;this.arg2=b;this.immediatepowersign=false;this.name="root";this.__enum=function(){return[this.arg1,this.arg2]};this.getValue=function(){return this.name+this.arg2+"("+PCM.getValue(this.arg1)+")"};this.__clone=function(a){return PCM.root(a[0],
a[1])};this.getTeX=function(){return"{\\small^"+PCM.getTeX(this.arg2)+"}\\sqrt{"+PCM.getTeX(this.arg1)+"}"};this.getMath=function(){return"root"+this.arg2+"("+PCM.getMath(this.arg1)+")"};this.getDerivative=function(){return(new PCM.power_fn(this.arg1,PCM.division(1,this.arg2))).getDerivative()};this.calculate=function(a){a=PCM.calculate(this.arg1,a);return Math.pow(a,1/this.arg2)}},root:function(a,b){return new PCM.root_fn(a,b)},exp_fn:function(){this.getValue=function(){return"e"};this.getTeX=function(){return"e"};
this.getMath=function(){return"e"};this.__enum=function(){return[]};this.__clone=function(){return new PCM.exp_fn};this.getDerivative=function(){return 0};this.calculate=function(){return Math.exp(1)}},exp:function(){return new PCM.exp_fn},tan_fn:function(a){l(this,a,"tan",PCM.tan);this.getDerivative=function(){return n(this.arg1,PCM.division(1,PCM.power(PCM.cos(this.arg1),2)))};this.calculate=function(a){a=PCM.calculate(this.arg1,a);return Math.tan(a)}},tan:function(a){return new PCM.tan_fn(a)},
cot_fn:function(a){l(this,a,"cot",PCM.cot);this.getDerivative=function(){return n(this.arg1,PCM.division(-1,PCM.power(PCM.sin(this.arg1),2)))};this.calculate=function(a){a=PCM.calculate(this.arg1,a);return 1/Math.tan(a)}},cot:function(a){return new PCM.cot_fn(a)},sec_fn:function(a){l(this,a,"sec",PCM.sec);this.getDerivative=function(){return n(this.arg1,PCM.division(PCM.sin(this.arg1),PCM.power(PCM.cos(this.arg1),2)))};this.calculate=function(a){a=PCM.calculate(this.arg1,a);return 1/Math.cos(a)}},
sec:function(a){return new PCM.sec_fn(a)},csc_fn:function(a){l(this,a,"csc",PCM.csc);this.getDerivative=function(){return n(this.arg1,PCM.division(PCM.cos(this.arg1),PCM.power(PCM.sin(this.arg1),2)))};this.calculate=function(a){a=PCM.calculate(this.arg1,a);return 1/Math.sin(a)}},csc:function(a){return new PCM.csc_fn(a)},arctan_fn:function(a){l(this,a,"arctan",PCM.arctan);this.getDerivative=function(){return n(this.arg1,PCM.division(1,PCM.sum([1,PCM.power(this.arg1,2)])))};this.calculate=function(a){a=
PCM.calculate(this.arg1,a);return Math.atan(a)}},arctan:function(a){return new PCM.arctan_fn(a)},arccot_fn:function(a){l(this,a,"arccot",PCM.arccot);this.getDerivative=function(){return n(this.arg1,PCM.division(-1,PCM.sum([1,PCM.power(this.arg1,2)])))};this.calculate=function(a){a=PCM.calculate(this.arg1,a);return Math.PI/2-Math.atan(a)}},arccot:function(a){return new PCM.arccot_fn(a)},arcsin_fn:function(a){l(this,a,"arcsin",PCM.arcsin);this.getDerivative=function(){return n(this.arg1,PCM.division(1,
PCM.sqrt(PCM.substraction(1,PCM.power(this.arg1,2)))))};this.calculate=function(a){a=PCM.calculate(this.arg1,a);return Math.asin(a)}},arcsin:function(a){return new PCM.arcsin_fn(a)},arccos_fn:function(a){l(this,a,"arccos",PCM.arccos);this.getDerivative=function(){return n(this.arg1,PCM.division(-1,PCM.sqrt(PCM.substraction(1,PCM.power(this.arg1,2)))))};this.calculate=function(a){a=PCM.calculate(this.arg1,a);return Math.acos(a)}},arccos:function(a){return new PCM.arccos_fn(a)},arcsec_fn:function(a){l(this,
a,"arcsec",PCM.arcsec);p(this);this.getDerivative=function(){return n(this.arg1,PCM.division(1,PCM.multiplication([PCM.power(this.arg1,2),PCM.sqrt(PCM.sum([1,PCM.minus(PCM.power(this.arg1,2))]))])))};this.calculate=function(a){a=PCM.calculate(this.arg1,a);return Math.acos(1/a)}},arcsec:function(a){return new PCM.arcsec_fn(a)},arccosec_fn:function(a){l(this,a,"arccosec",PCM.arccosec);p(this);this.getDerivative=function(){return n(this.arg1,PCM.division(-1,PCM.multiplication([PCM.power(this.arg1,2),
PCM.sqrt(PCM.substraction(1,PCM.power(this.arg1,2)))])))};this.calculate=function(a){a=PCM.calculate(this.arg1,a);return Math.PI/2-Math.acos(1/a)}},arccosec:function(a){return new PCM.arccosec_fn(a)},function_fn:function(a,b){l(this,a,b,null);p(this);this.__clone=function(a){return new PCM.function_fn(a[0],this.name)};var c={versin:function(a){return PCM.sin(a)},vercos:function(a){return PCM.minus(PCM.cos(a))},haversin:function(a){return PCM.division(PCM.sin(a),2)},exsec:function(a){return PCM.division(PCM.sin(a),
PCM.power(PCM.cos(a),2))},excsc:function(a){return PCM.division(PCM.minus(PCM.cos(a)),PCM.power(PCM.sin(a),2))}},d={versin:function(a){return 1-Math.cos(a)},vercos:function(a){return 1+Math.cos(a)},haversin:function(a){return(1-Math.cos(a))/2},exsec:function(a){return 1/Math.cos(a)-1},excsc:function(a){return 1/Math.sin(a)-1}};this.getDerivative=function(){if(PCM.isConstant(this.arg1))return 0;var a=c[this.name];if(a)return n(this.arg1,a(this.arg1))};this.calculate=function(a){a=PCM.calculate(this.arg1,
a);return(0,d[this.name])(a)}},abs:function(a){return new PCM.abs_fn(a)},abs_fn:function(a){l(this,a,"abs",PCM.abs);this.getDerivative=function(){return n(this.arg1,PCM.sign(-1,this.arg1))};this.calculate=function(a){a=PCM.calculate(this.arg1,a);return Math.abs(a)};this.getTeX=function(){return"\\left|"+PCM.getTeX(this.arg1)+"\\right|"}},sign:function(a){return PCM.isNumber(a)?a<0?-1:a>0?1:0:new PCM.sign_fn(a)},sign_fn:function(a){l(this,a,"sign",PCM.sign);p(this);this.getDerivative=function(){return 0};
this.calculate=function(a){a=PCM.calculate(this.arg1,a);return a<0?-1:a>0?1:0}},pi_fn:function(){this.__enum=function(){return[]};this.__clone=function(){return new PCM.pi_fn};this.getValue=function(){return"pi"};this.getTeX=function(){return"\\pi"};this.getMath=function(){return"pi"};this.getDerivative=function(){return 0};this.calculate=function(){return Math.PI}},derivative_fn:function(a){this.arg1=a;this.__enum=c;this.__clone=function(a){return PCM.derivative(a[0])};this.getValue=function(){return"f'("+
PCM.getValue(this.arg1)+")"};this.getTeX=function(){return"{f^\\prime}\\left("+PCM.getTeX(this.arg1)+"\\right)"};this.getMath=function(){return"derivative("+PCM.getMath(this.arg1)+")"};this.getDerivative=function(){return this.arg1.getDerivative()}},derivative:function(a){return PCM.isConstant(a)?0:new PCM.derivative_fn(a)},translate:function(a){return(new o).__translate(a)},grammar:function(){this.digit={t:"|",v:"0,1,2,3,4,5,6,7,8,9".split(",")};this["plus sign"]="+";this["power sign"]="^";this["minus sign"]=
"-";this.dot=".";this["left paren"]="(";this["right paren"]=")";this.asterisk="*";this.solidus="/";this.dotorcomma={t:"|",v:[".",","]};this["unsigned integer"]={t:"&",v:[{t:"->",v:"digit"},{t:"*",v:{t:"->",v:"digit"}}]};this["exact numeric literal"]={t:"|",v:[{t:"&",v:[{t:"->",v:"unsigned integer"},{t:"|",v:[{t:"&",v:[{t:"->",v:"dotorcomma"},{t:"|",v:[{t:"->",v:"unsigned integer"},""]}]},""]}]},{t:"&",v:[{t:"->",v:"dotorcomma"},{t:"->",v:"unsigned integer"}]}]};this.mantissa={t:"->",v:"exact numeric literal"};
this["signed integer"]={t:"&",v:[{t:"|",v:[{t:"->",v:"sign"},""]},{t:"->",v:"unsigned integer"}]};this.sign={t:"|",v:[{t:"->",v:"plus sign"},{t:"->",v:"minus sign"}]};this.exponent={t:"->",v:"signed integer"};this["approximate numeric literal"]={t:"&",v:[{t:"->",v:"mantissa"},"E",{t:"->",v:"exponent"}]};this["unsigned numeric literal"]={t:"|",v:[{t:"->",v:"approximate numeric literal"},{t:"->",v:"exact numeric literal"}]};this.variable="x";this.pi="pi";this.exponenta={t:"|",v:["e","E"]};this["paren expression"]=
{t:"&",v:[{t:"->",v:"left paren"},{t:"->",v:"expression"},{t:"->",v:"right paren"}]};this.value={t:"|",v:[{t:"->",v:"unsigned numeric literal"},{t:"->",v:"variable"},{t:"->",v:"func"},{t:"->",v:"funcnum"},{t:"->",v:"pi"},{t:"->",v:"exponenta"},{t:"->",v:"paren expression"}]};this.factor={t:"&",v:[{t:"|",v:[{t:"->",v:"sign"},""]},{t:"->",v:"value"}]};this.factoroperator={t:"|",v:[{t:"->",v:"asterisk"},{t:"->",v:"solidus"}]};this.power={t:"&",v:[{t:"->",v:"factor"},{t:"*",v:{t:"&",v:[{t:"->",v:"power sign"},
{t:"->",v:"factor"}]}}]};this.product={t:"&",v:[{t:"->",v:"power"},{t:"*",v:{t:"&",v:[{t:"->",v:"factoroperator"},{t:"->",v:"power"}]}}]};this.sum={t:"&",v:[{t:"->",v:"product"},{t:"*",v:{t:"&",v:[{t:"->",v:"sign"},{t:"->",v:"product"}]}}]};this.func={t:"&",v:[{t:"->",v:"func name"},{t:"->",v:"left paren"},{t:"->",v:"expression"},{t:"->",v:"right paren"}]};this.funcnum={t:"&",v:[{t:"->",v:"funcnum name"},{t:"->",v:"unsigned integer"},{t:"->",v:"left paren"},{t:"->",v:"expression"},{t:"->",v:"right paren"}]};
this["func name"]={t:"|",v:"sin,cosec,cos,tg,tan,ctg,cotan,sech,sec,arcsin,arccosec,arccos,arctg,arctan,arcctg,arccot,arcsec,exp,lb,lg,ln,versin,vercos,haversin,exsec,excsc,sqrt,sh,ch,th,cth,csch,tanh,coth,abs,sgn,sign".split(",")};this["funcnum name"]={t:"|",v:["root","log"]};this.expression={t:"->",v:"sum"};this._getRootRule=function(){return{t:"->",v:"expression"}}}}}();

