function findFirst(n,_2,_3){
if(n==null){
return null;
}
if(_3==null){
_3=new RegExp("^"+_2+"$","i");
}
if(n.nodeType==1&&n.nodeName.match(_3)!=null){
return n;
}
var _4=findFirst(n.firstChild,_2,_3);
if(_4){
return _4;
}
return findFirst(n.nextSibling,_2,_3);
}
function findUp(n,_6,_7){
var _7=new RegExp("^"+_6+"$","i");
while(n!=null&&!(n.nodeType==1&&n.nodeName.match(_7)!=null)){
n=n.parentNode;
}
return n;
}
function getElementsByProperty(el,_9,_a){
if(!_a){
_a=new Object();
}
if(el==null){
return null;
}
if(el[_9]){
if(_a[el[_9]]){
if(_a[el[_9]].set==null){
_a[el[_9]].set=new Array(_a[el[_9]],el);
}else{
_a[el[_9]].set.push(el);
}
}else{
_a[el[_9]]=el;
}
}
getElementsByProperty(el.firstChild,_9,_a);
getElementsByProperty(el.nextSibling,_9,_a);
return _a;
}
function getElementsWithProperty(el,_c,_d){
if(!_d){
_d=new Array();
}
if(el==null){
return;
}
if(el[_c]!=null){
_d.push(el);
}
getElementsWithProperty(el.firstChild,_c,_d);
getElementsWithProperty(el.nextSibling,_c,_d);
return _d;
}
function getElementsWithTagName(el,_f,_10,_11){
if(!_10){
_10=new Array();
}
if(el==null){
return _10;
}
if(_11==null){
_11=new RegExp("^"+_f+"$","i");
}
if(el.tagName&&el.tagName.match(_11)!=null){
_10.push(el);
}
for(var i=0;i<el.childNodes.length;i++){
getElementsWithTagName(el.childNodes[i],_f,_10,_11);
}
return _10;
}
function cloneTree(ns,_14,to){
var n=_14.firstChild;
while(n){
if(n.nodeName.match(/#text/i)){
to.appendChild(document.createTextNode(n.nodeValue));
}else{
to.appendChild(document.createElementNS(ns,n.nodeName));
cloneTree(ns,n,to.lastChild);
}
n=n.nextSibling;
}
}
function findPosY(a,_18){
var _19=0;
if(a.offsetParent){
while(a){
_19+=a.offsetTop;
if(!_18){
_19-=a.scrollTop;
}
a=a.offsetParent;
}
}else{
if(a.y){
_19+=a.y;
}
}
return _19;
}
function findPosX(a,_1b){
var _1c=0;
if(a.offsetParent){
while(a){
_1c+=a.offsetLeft;
if(!_1b){
_1c-=a.scrollLeft;
}
a=a.offsetParent;
}
}else{
if(a.x){
_1c+=a.x;
}
}
return _1c;
}
function enumerablePropertyCount(obj){
if(obj==null){
return 0;
}
var c=0;
for(var i in obj){
c++;
}
return c;
}
function extend(_20,_21){
for(var i in _21){
_20[i]=_21[i];
}
_20.base=_21;
}
function wrap(s){
if(s.length>80){
return s.substr(0,80)+"\n"+wrap(s.substr(80));
}
return (s);
}
function JSONtoDOM(n,a,d,ce){
this.doc=d||n.ownerDocument;
this.createElement=ce||function(n){
return this.doc.createElement(n);
};
if(typeof (a)!="object"||!a.length){
a=[a];
}
var nd=n.lastChild;
this.doArray(n,a);
this.dom=(nd!=null?nd.nextSibling:n.firstChild);
}
JSONtoDOM.prototype.doArray=function(n,a){
for(var i=0;a.length>i;i++){
if(typeof (a[i])=="object"){
if(a[i].length!=null){
this.doArray(n,a[i]);
}else{
this.doObject(n,null,a[i]);
}
}else{
n.appendChild(this.doc.createTextNode(decodeURIComponent(a[i])));
}
}
};
JSONtoDOM.prototype.doObject=function(n,_2e,o){
for(var i in o){
if(i==0){
if(typeof (o[i])=="string"){
n.appendChild(this.doc.createTextNode(decodeURIComponent(o[i])));
}else{
this.doArray(n,o[i]);
}
}else{
if(typeof (o[i])=="object"){
if(i=="eventList"){
for(var e in o[i]){
if(window[o[i][e]]!=null){
addEvent(n,e,window[o[i][e]]);
}
}
}else{
var n0=this.createElement(i,this.doc);
if(o[i]!=null){
if(o[i].length!=null){
this.doArray(n0,o[i]);
}else{
this.doObject(n0,i,o[i]);
}
}
n.appendChild(n0);
}
}else{
if(_2e!=null){
if(n.getAttribute(i)!=null){
n.setAttribute(i,o[i]);
}else{
var a=i.split(".");
if(a.length==1){
n[i]=o[i];
}else{
try{
var a0=a.pop();
var n0=n;
while(n0&&n0[a[0]]){
n0=n0[a[0]];
a.shift();
}
while(a.length){
n0[a[0]]={};
n0=n0[a[0]];
a.shift();
}
n0[a0]=o[i];
}
catch(e){
alert(e);
}
}
}
}else{
var n0=this.createElement(i,this.doc);
n0.appendChild(this.doc.createTextNode(decodeURIComponent(o[i])));
n.appendChild(n0);
}
}
}
}
};
function doesInputPaddingExtendSize(){
if(window.paddingExtends==null){
var _35=document.createElementNS("http://www.w3.org/1999/xhtml","input");
_35.type="text";
_35.style.width="10px";
_35.style.padding="2px";
_35.style.visibility="hidden";
var _36=findFirst(document.firstChild,"body");
_36.appendChild(_35);
window.paddingExtends=(_35.offsetWidth!=10);
_36.removeChild(_35);
}
return window.paddingExtends;
}
function escapeQuotes(s){
if(!s){
return s;
}
var s0=s.replace(/\"/g,"\\\"");
return s0.replace(/\n/g,"\\n");
}
Array.prototype.search=function(v){
for(var i=this.length-1;i>=0;i--){
if(this[i]===v){
return true;
}
}
return false;
};
Array.prototype.rangeCompress=function(){
this.sort(function(a,b){
return (a-b);
}).push(0);
var c=this.length;
var r=-1;
var rc=-1;
var out="";
for(var i=0;i<c;i++){
if(this[i]!=null){
if(this[i]-1==r){
r++;
rc++;
}else{
if(rc>0){
out+=",["+(r-rc)+","+rc+"]";
}else{
if(rc==0&&r){
out+=","+r;
}
}
r=this[i];
rc=0;
}
}
}
this.pop();
return "["+out.substr(1)+"]";
};
Array.prototype.rangeUncompress=function(){
var a=new Array();
var r=0;
var c=this.length;
for(var r=0;r<c;r++){
if(typeof (this[r])=="object"){
for(var i=0;i<=this[r][1];i++){
a.push(this[r][0]+i);
}
}else{
a.push(this[r]);
}
}
return a;
};
if(!document.createElementNS){
document.createElementNS=function(NS,_47){
return document.createElement(_47);
};
}
if(!document.getElementsByTagNameNS){
document.getElementsByTagNameNS=function(NS,_49){
return document.getElementsByTagName(_49);
};
}
function addEvent(e,_4b,f,_4d){
if(e.addEventListener){
e.addEventListener(_4b,f,false,_4d);
}else{
if(e.attachEvent){
e.attachEvent("on"+_4b,f);
}else{
if(e.document&&e.document.addEventListener){
e.document.addEventListener(_4b,f,false);
}else{
e["on"+_4b]=f;
}
}
}
}
function removeEvent(e,_4f,f){
if(e.removeEventListener){
e.removeEventListener(_4f,f,false);
}else{
if(e.detachEvent){
e.detachEvent("on"+_4f,f);
}else{
if(e.document&&e.document.removeEventListener){
e.document.removeEventListener(_4f,f,false);
}else{
e["on"+_4f]=null;
}
}
}
}
function weHandleEvent(e){
if(e==null){
return;
}
e.cancelBubble=true;
if(e.preventDefault){
e.preventDefault();
e.stopPropagation();
}
}
function getXMLDoc(txt){
var doc;
if(document.implementation.createDocument){
var _54=new DOMParser();
doc=_54.parseFromString(txt,"text/xml");
}else{
if(window.ActiveXObject){
doc=new ActiveXObject("Microsoft.XMLDOM");
doc.async=false;
doc.loadXML(txt);
}
}
return doc;
}
if(JSON==null){
var JSON={};
}
if(JSON.parse==null){
JSON.parse=function(x){
return eval("("+x+")");
};
}

var Animator=new Object();
Animator.work=new Array();
Animator.next=0;
Animator.nextID=1;
Animator.add=function(_1,_2,_3){
var a=new Object();
a.interval=_1;
a.obj=(_2==null?window:_2);
a.method=_3;
a.args=new Array();
for(var i=3;i<arguments.length;i++){
a.args.push(arguments[i]);
}
a.nextAnimate=_1;
a.aID=++Animator.nextID;
Animator.work.push(a);
Animator.next=10000000;
for(var i=0;i<Animator.work.length;i++){
if(Animator.work[i].nextAnimate<Animator.next){
Animator.next=Animator.work[i].nextAnimate;
}
}
if(Animator.next==0){
Animator.next=10;
}
if(Animator.timer){
clearTimeout(Animator.timer);
}
Animator.timer=setTimeout("Animator.intervalCheck()",Animator.next);
return a.aID;
};
Animator.remove=function(_6){
for(var i=0;i<Animator.work.length;i++){
if(Animator.work[i].aID===_6){
if(Animator.work.length>1){
Animator.work[i]=Animator.work.pop();
}else{
Animator.work.pop();
}
}
}
};
Animator.removeObject=function(_8,_9){
for(var i=0;i<Animator.work.length;i++){
if(Animator.work[i].obj===_8&&(_9==null||Animator.work.method===_9)){
if(Animator.work.length>1){
Animator.work[i]=Animator.work.pop();
}else{
Animator.work.pop();
}
}
}
};
Animator.once=function(){
var a=new Array();
a.push(10);
for(var i=0;i<arguments.length;i++){
a.push(arguments[i]);
}
Animator.add.apply(window,a);
};
Animator.intervalCheck=function(){
var i=0;
while(i<Animator.work.length){
Animator.work[i].nextAnimate-=Animator.next;
if(Animator.work[i].nextAnimate<=0){
var ca=false;
try{
ca=Animator.work[i].method.apply(Animator.work[i].obj,Animator.work[i].args);
}
catch(err){
ca=false;
}
if(ca&&Animator.work[i].interval>0){
Animator.work[i].nextAnimate+=(typeof (ca)=="number"?ca:Animator.work[i].interval);
}else{
if(i>0){
Animator.work[i]=Animator.work[0];
}
Animator.work.shift();
i--;
}
}
i++;
}
if(Animator.timer){
clearTimeout(Animator.timer);
}
delete Animator.timer;
if(Animator.work.length>0){
Animator.next=10000000;
for(var i=0;i<Animator.work.length;i++){
if(Animator.work[i].nextAnimate<Animator.next){
Animator.next=Animator.work[i].nextAnimate;
}
}
if(Animator.next==0){
Animator.next=10;
}
Animator.timer=setTimeout("Animator.intervalCheck()",Animator.next);
}
};

function Semaphore(_1,_2,_3){
this.count=_1;
this.waiting=(this.count>0);
this.callObject=(_2==null?window:_2);
this.callMethod=_3;
this.callArgs=new Array();
if(this.callMethod!=null){
for(var i=3;i<arguments.length;i++){
this.callArgs.push(arguments[i]);
}
}
this.callMade=false;
}
Semaphore.prototype.setCall=function(_5,_6){
this.callObject=(_5==null?Window:_5);
this.callMethod=_6;
this.callArgs.length=0;
if(this.callMethod!=null){
for(var i=2;i<arguments.length;i++){
this.callArgs.push(arguments[i]);
}
}
};
Semaphore.prototype.decrement=function(){
this.count--;
this.waiting=(this.count>0);
if(!this.waiting&&this.callMethod!=null){
this.callMade=true;
this.callMethod.apply(this.callObject,this.callArgs);
}
};
Semaphore.prototype.increment=function(){
if(!this.callMade){
this.count++;
}
};

Date.months=new Array("JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC");
Date.monthNames=new Array("January","February","March","April","May","June","July","August","September","October","November","December");
Date.parseDate=function(_1,_2){
var _3=0,_4=-1,_5=-1;
if(_2==null){
_2=new Date();
}
_1="K"+_1;
var m=null;
if(m=_1.match(/^K([A-Za-z]+)[\/\-\. ]*(\d{1,2})[\/\-\., ]+(\d{4}|\d{2})$/)){
_4=_2.indexMonth(m[1]);
_3=parseInt(m[2],10);
_5=parseInt(m[3],10);
}else{
if(m=_1.match(/^K(\d{1,2})[\/\-\. ]*([A-Za-z]+)[\/\-\. ]*(\d{4}|\d{2})$/)){
_4=_2.indexMonth(m[2]);
_3=parseInt(m[1],10);
_5=parseInt(m[3],10);
}else{
if(m=_1.match(/^K(\d{1,2})[\/\.\- ]+(\d{1,2})[\/\.\- ]+(\d{4}|\d{2})$/)){
_4=parseInt(m[1],10)-1;
_3=parseInt(m[2],10);
_5=parseInt(m[3],10);
}else{
if(m=_1.match(/^K(\d{4})[\/\.\- ]+(\d{1,2})[\/\.\- ](\d{1,2})$/)){
_4=parseInt(m[2],10)-1;
_3=parseInt(m[3],10);
_5=parseInt(m[1],10);
}else{
if(m=_1.match(/^K([A-Za-z]+)[\/\-\. ]*(\d{1,2})$/)){
_4=_2.indexMonth(m[1]);
_3=parseInt(m[2],10);
}else{
if(m=_1.match(/^K(\d{1,2})[\/\-\. ]*([A-Za-z]+)$/)){
_4=_2.indexMonth(m[2]);
_3=parseInt(m[1],10);
}else{
if(m=_1.match(/^K([0-9]{1,2})[\/\.\- ]+(\d{1,2})$/)){
_4=parseInt(m[1],10)-1;
_3=parseInt(m[2],10);
}
}
}
}
}
}
}
if(_4<0){
return null;
}
if(_5>=0){
if(_5<50){
_5+=Math.floor(_2.getFullYear()/100)*100;
}else{
if(_5<100){
_5+=Math.floor(_2.getFullYear()/100-1)*100;
}
}
}else{
_5=_2.getFullYear();
}
return new Date(_5,_4,_3);
};
Date.prototype.indexMonth=function(_7){
_7=_7.substr(0,Date.months[0].length).toUpperCase();
for(var i=0;i<Date.months.length;i++){
if(_7==Date.months[i]){
return i;
}
}
return -1;
};
Date.parseMySQLDate=function(_9){
var m=_9.match(/^(\d{4})-(\d{2})-(\d{2})/);
if(m){
return new Date(parseInt(m[1],10),parseInt(m[2],10)-1,parseInt(m[3],10));
}
return null;
};
Date.prototype.toMySQLDateString=function(){
var _b=this.getFullYear()+"-";
_b+=(this.getMonth()<9?"0":"")+(this.getMonth()+1)+"-";
_b+=(this.getDate()<10?"0":"")+(this.getDate());
return _b;
};
Date.formStringFormat=1;
Date.setFormStringFormat=function(f){
Date.formStringFormat=parseInt(f)||1;
};
Date.prototype.toFormString=function(){
var _d="";
var m=("0"+(this.getMonth()+1)).replace(/0(..)/,"$1");
var d=("0"+this.getDate()).replace(/0(..)/,"$1");
var Y=this.getFullYear();
switch(Date.formStringFormat||1){
case 2:
_d=(this.getMonth()+1)+"/"+this.getDate()+"/"+Y;
break;
case 3:
_d=d+"."+m+"."+Y;
break;
case 4:
_d=d+"-"+m+"-"+Y;
break;
case 5:
_d=d+"/"+m+"/"+Y;
break;
case 6:
_d=this.getDate()+"/"+(this.getMonth()+1)+"/"+Y;
break;
case 7:
_d=Y+"."+m+"."+d;
break;
case 8:
_d=Y+"/"+m+"/"+d;
break;
case 9:
_d=Y+"-"+m+"-"+d;
break;
case 10:
_d=d+" "+Date.monthNames[this.getMonth()].substr(0,3)+" "+Y;
break;
case 11:
case 12:
_d=d+" "+Date.monthNames[this.getMonth()]+" "+Y;
break;
case 13:
_d=Y+" "+Date.monthNames[this.getMonth()].substr(0,3)+" "+d;
break;
case 14:
_d=Date.monthNames[this.getMonth()]+" "+this.getDate()+", "+Y;
break;
case 15:
_d=Date.monthNames[this.getMonth()].substr(0,3)+" "+this.getDate()+", "+Y;
break;
case 1:
default:
_d=m+"/"+d+"/"+Y;
}
return _d;
};

function Time(_1,_2,_3){
this.hour=parseInt(_1||0,10);
this.minute=parseInt(_2||0,10);
if(_3==null){
this.second=0;
}else{
this.second=parseInt(_3||0,10);
}
}
Time.parseTime=function(_4){
if(_4==null||_4==""){
return null;
}
var b0=_4.toUpperCase();
b0=b0.replace(/([AP])[M]*/,"$1M");
b0=b0.replace(/^NOO[.]*/,"12:00PM");
b0=b0.replace(/^MID[.]*/,"00:00AM");
b0=b0.replace(/^([0-9]+)([APM]+)/,"$1:00$2");
b=b0.replace(/[^0-9]*([0-9]+)[;:,\. ]*([0-9]*)[;:,\. ]*([AMP]*)/,"$1:$2:$3").split(":");
if(b[1]==null||b[1]==""){
b[1]=0;
}
if(b[2]==null||b[2]==""){
b[2]=((parseInt(b[0],10)>0&&parseInt(b[0],10)<7)||b[0]==12)?"PM":"AM";
}
if(b[2]=="PM"&&parseInt(b[0],10)<12){
b[0]=parseInt(b[0],10)+12;
}
if(b[2]=="AM"&&parseInt(b[0],10)==12){
b[0]=0;
}
if(isNaN(parseInt(b[0],10))){
b[0]=0;
}
if(isNaN(parseInt(b[1],10))){
b[1]=0;
}
if(b[0]>23&&b[1]==0){
while(b[0]>=2400){
b[0]=Math.floor(b[0]/10);
}
b[1]=b[0]%100;
b[0]=Math.floor(b[0]/100);
while(b[0]>23){
b[0]/=10;
}
if(b[2]=="PM"&&b[0]<12){
b[0]+=12;
}
}
while(b[1]>59){
b[1]-=60;
}
return new Time(b[0],b[1]);
};
Time.parseMySQLTime=function(_6){
var b=_6.split(":");
return new Time(b[0],b[1],b[2]);
};
Time.prototype.toMySQLTimeString=function(){
var _8=(this.hour<10?"0":"")+this.hour+":";
_8+=(this.minute<10?"0":"")+this.minute+":";
_8+=(this.second<10?"0":"")+this.second;
return _8;
};
Time.prototype.toFormString=function(){
var h=this.hour;
var m=(h<12?"AM":"PM");
if(h==0){
h=12;
}else{
if(h>12){
h-=12;
}
}
return h+":"+(this.minute<10?"0":"")+this.minute+m;
};

function DisplayCache(){
this.cache=new Object();
}
DisplayCache.prototype.add=function(_1,_2,_3){
if(this.cache[_1]==null){
this.cache[_1]=new Object();
}
if(_2!=null){
this.cache[_1][_2.toUpperCase()]=(_3?_3:"X");
}
};
DisplayCache.prototype.useGlobal=function(_4){
if(this.cache[_4]==null){
var w=parent;
while(w.parent!=w.self){
w=w.parent;
}
if(!w.globalDisplayCache){
return;
}
w.globalDisplayCache.add(_4);
this.cache[_4]=w.globalDisplayCache.get(_4);
}
};
DisplayCache.prototype.addICodes=function(_6){
while(_6){
if(_6.nodeName.match(/^icode$/i)){
var _7=_6.attributes.getNamedItem("name").nodeValue;
var _8=findFirst(_6,"value");
while(_8){
if(_8.nodeName.match(/^value$/i)){
var _9=_8.attributes.getNamedItem("code").nodeValue;
this.add(_7,_9,_8.firstChild.nodeValue);
}
_8=_8.nextSibling;
}
}
_6=_6.nextSibling;
}
};
DisplayCache.prototype.addFromXML=function(_a,_b,_c){
var _d=this.buildValidationKey(_a);
if(_d==null){
return;
}
var _e=new Object();
var _f=0;
while(_c){
if(_c.nodeName=="data"){
var _10=_c.attributes.getNamedItem("key").nodeValue;
_e[_10]=_c.firstChild.nodeValue;
_f++;
}
_c=_c.nextSibling;
}
if(_f>0){
this.add(_d,_b,_e);
}
};
DisplayCache.prototype.addFromJSON=function(_11,_12,_13){
var key=this.buildValidationKey(_11);
if(key==null){
return;
}
for(var i=0;i<_13.length;i++){
var _16=new Object();
for(var p in _12){
_16[p]=_13[i][_12[p]];
}
this.add(key,_13[i][0],_16);
}
};
DisplayCache.prototype.isValidated=function(key){
return this.cache[key]!=null;
};
DisplayCache.prototype.get=function(key,_1a,_1b){
if(this.cache[key]){
if(_1b!=null){
if(this.cache[key][_1a]){
return this.cache[key][_1a][_1b];
}
return null;
}
if(_1a!=null){
return this.cache[key][_1a];
}
return this.cache[key];
}
return null;
};
DisplayCache.prototype.display=function(_1c){
var _1d=_1c.record.element.getRecordFields(_1c.record);
if(_1c.value!=""){
var key=this.buildValidationKey(_1c);
var _1f=this.get(key,_1c.value.toUpperCase());
if(_1f){
if(typeof (_1f)=="object"){
var _20=_1c.validation?_1c.validation.substr(_1c.validation.lastIndexOf(".")+1):_1c.column;
if(_1f[_1c.column]){
_1c.value=_1f[_1c.column];
}else{
if(_1f[_20]){
_1c.value=_1f[_20];
}
}
if(_1c.display){
var _21=_1c.display.split(",");
for(var c=0;c<_21.length;c++){
if(_1d[_21[c]]){
_1d[_21[c]].value=(_1f[_21[c]]==null?"":_1f[_21[c]]);
}
}
}
}else{
_1c.value=_1c.value.toUpperCase();
var _21=_1c.display;
if(_1d[_21]){
_1d[_21].value=(_1f==null?"":_1f);
}
}
return true;
}
}
if(_1c.display){
var _21=_1c.display.split(",");
for(var c=0;c<_21.length;c++){
if(_1d[_21[c]]){
_1d[_21[c]].value="";
}
}
}
return false;
};
DisplayCache.prototype.save=function(_23){
if(_23.value==""||_23.invalid||_23.inValidation){
return;
}
var key=this.buildValidationKey(_23);
if(key==null||this.get(key,_23.value)){
return;
}
var _25=_23.record.element.getRecordFields(_23.record);
var _26=new Object();
if(!_23.validation){
alert(field.column+" lacks validation data (error!)\n");
return;
}
_26[_23.column]=_23.value;
if(_23.display!=null){
var _27=_23.display.split(",");
for(var c=0;c<_27.length;c++){
if(_25[_27[c]]){
_26[_27[c]]=_25[_27[c]].value;
}
}
}
this.add(key,_23.value,_26);
};
DisplayCache.prototype.buildValidationKey=function(_29){
var key=_29.validation;
if(key==null){
key=_29.record.element.table;
}
var _2b=_29.record.element;
if(_29.join){
var _2c=_2b.getRecordFields(_29.record);
var _2d=_29.join.split(";");
var k0;
for(var i=0;i<_2d.length;i++){
var j0=_2d[i].split("=");
k0=null;
if(j0[1].match(/\'[^\']+\'$/)){
k0=j0[1].replace(/\'([^\']+)\'$/,"$1");
}else{
if(_2c[j0[1]]){
k0=_2c[j0[1]].value;
}else{
k0=_2b.produce(j0[1]);
}
}
if(k0==null){
return null;
}
key+=":"+k0;
}
}
if(_29.cacheByConsumed&&_2b.consumedData){
for(var i in _2b.consumedData){
key+=":"+(_2b.consumedData[i]||"");
}
}
return key;
};


