
/* - jsx.js - */
// http://www.brain-tec.ch/portal_javascripts/jsx.js?original=1
var jsx={global:this,throwThis: function(error,sMessage){eval('throw new error("'+sMessage.replace(/["\\]/g, "\\$&") + '");')},Error: function(sMsg){var msg=(sMsg||"jsx.Error");if(typeof Error=="function"){Error.call(msg);var e;jsx.tryThis(function(){e=new Error()})}
if(!this.message) this.message=msg;if(!this.lineNumber&&e){this.lineNumber=e.lineNumber}
if(!this.stack&&e&&e.stack){var stack=String(e.stack).split(/\r?\n|\r/);stack.shift();this.stack=stack.join("\n")}
this.getMessage=function(){return this.message};this.getStackTrace=function(){return this.stack};this.printStackTrace=function(){var s=this.getStackTrace();if(typeof console!="undefined"&&jsx.object.isMethod(console,"log")){console.log(s)}
else{window.alert(s)}}},InvalidArgumentError: function(sReason,sGot,sExpected){jsx.Error.call(this,sReason+(sGot?": "+sGot:"")+(sExpected?"; expected "+sExpected:""))}};jsx.object={inheritFrom: function(o){
function Dummy(){}
Dummy.prototype=o;return new Dummy()},PropertyError: function(s){jsx.Error.call(this,"No such property: "+s)},getProperty: function(o,sProperty,aDefault){if(typeof o[sProperty]!="undefined"){return o[sProperty]}
if(arguments.length<3){jsx.throwThis(this.PropertyError,sProperty)}
return aDefault},isMethod:
function(o){var len=arguments.length;if(len<1) return false;var rxUnknown=/^\s*unknown\s*$/i;if(!(rxUnknown.test(typeof o)||o)) return false;for(var i=1;i<len;i++){var p=arguments[i];var t=typeof o[p];var rxMethod=/^\s*(function|object|unknown)\s*$/i;if(rxMethod.test(t)&&(rxUnknown.test(t)||o[p])){if(i<len-1){o=o[p];if(!(rxUnknown.test(typeof o)||o)) return false}}
else{return false}}
return true},isMethodType:
function(s){return/^\s*(function|object|unknown)\s*$/i.test(s)}};Function.prototype.extend=function function_extend(Constructor,oProtoProps){if(typeof Constructor.valueOf()=="string"){Constructor=jsx.global[Constructor]}
if(typeof Constructor!="function"){jsx.throwThis(Error,"Function expected");return false}
this.prototype=jsx.object.inheritFrom(Constructor.prototype);if(oProtoProps){for(var p in oProtoProps){this.prototype[p]=oProtoProps[p]}}
this.prototype._super=Constructor;this.prototype.constructor=this;this.userDefined=true;this.prototype.iterator=function(){var o=new Object();for(var p2 in this){switch(p2){case "_super":case "constructor":case "userDefined":case "iterator":case "forEach":break;default:o[p2]=true}}
return o};if(!jsx.object.isMethod(this.prototype,"forEach")){this.prototype.forEach=function(fCallback,thisObj){var t;if(!jsx.object.isMethodType((t=typeof fCallback))||!fCallback){jsx.throwThis(jsx.InvalidArgumentError,(!/^\s*unknown\s*$/i.test(t)?fCallback:"arguments[0]")+" is not a function",this+".forEach")}
for(var p in this){switch(p){case "_super":case "constructor":case "userDefined":case "iterator":case "forEach":break;default:fCallback.call(thisObj,this[p],p,this)}}}}
return true};if(typeof Error!="undefined") jsx.Error.extend(Error);jsx.InvalidArgumentError.extend(jsx.Error);jsx.object.PropertyError.extend(jsx.Error);jsx.string={FormatStringError:
function(s){jsx.Error.call(this,s)},sprintf:
function(sFormat){var rx=/%([s%])/g;for(var i=1,len=arguments.length;i<len;i++){var m=rx.exec(sFormat);if(m){var repl;switch(m[1]){case "s":repl=arguments[i];break;case "%":repl="%";i--;break;default:jsx.throwThis(this.FormatStringError,"Unsupported format string: "+m[0])}
sFormat=sFormat.replace(rx,repl)}
else{jsx.throwThis(jsx.InvalidArgumentError,"Too many arguments ("+(arguments.length-1)+") for format string: "+m[0])}}
return sFormat},hyphenatedToCamelCase:
function(s){return s.replace(/-([a-z])/gi,
function(m,p1){return p1.toLowerCase()})}};jsx.string.FormatStringError.extend(jsx.Error);jsx.array={push:
function(aTarget,aSource){if(aSource.constructor==Array){for(var i=0,len=aSource.length;i<len;i++){aTarget[aTarget.length]=aSource[i]}}
else{for(i=1,len=arguments.length;i<len;i++){aTarget[aTarget.length]=arguments[i]}}}};jsx.object.apply=function(f,thisObj){if(this.isMethod(f,"apply")){f.apply(thisObj,Array.prototype.slice.call(arguments,2))}
else{if(!thisObj) thisObject=jsx.global;if(typeof thisObj.expando!="undefined"){var prevExpando=thisObj.expando;thisObj.expando=true}
thisObj._f=f;for(var a=[],i=2,len=arguments.length;i<len;i++){jsx.array.push(a,"arguments["+i+"]")}
eval(jsx.string.sprintf('thisObj._f(%s);',a));delete thisObj._f;if(typeof thisObj.expando!="undefined"){thisObj.expando=prevExpando}}};jsx.dom={getElemById:(function(){if(jsx.object.isMethod(document,"getElementById")){return function(id){return document.getElementById(id)}}
else if(typeof document.all!="undefined"){return function(id){return document.all[id]}}
else if(typeof document.layers!="undefined"){return function(id){return document.layers[id]}}
else{return function(){return null}}})(),isAncestor:
function(o,o2){if(o&&o2){while((o2=o2.parentNode)){if(o2==o) return true}}
return false},callDelayed:
function(f){if(f){if(jsx.object.isMethod(jsx.global.window,"setTimeout")){var me=arguments.callee;var args=Array.prototype.slice.call(arguments,1);me.timeout=window.setTimeout(
function(){if(jsx.object.isMethod(window,"clearTimeout")){window.clearTimeout(me.timeout);me.timeout=null}
me=null;jsx.object.apply(f,null,args);args=null},f.delay||250)}}},getComputedStyle:
function(o,sPseudoEl,sProperty){var hasGCS=jsx.object.isMethod(document,"defaultView","getComputedStyle");if(hasGCS||typeof o.currentStyle!="undefined"){var compStyle=(hasGCS?document.defaultView.getComputedStyle(o,sPseudoEl||null):o.currentStyle);var propertyMap={"float":hasGCS?"cssFloat":"styleFloat"};return(sProperty?compStyle[jsx.string.hyphenatedToCamelCase(jsx.object.getProperty(propertyMap,sProperty,sProperty))]:compStyle)}
var emptyResult={};emptyResult[sProperty]="";return(sProperty?emptyResult:null)},addClassName:
function(o,sClassName,bRemove){var rx=new RegExp("(^\\s*|\\s+)"+sClassName+"(\\s*$|\\s)");if(bRemove){this.removeClassName(o,sClassName)}
else if(rx.test(o.className)){return}
if (/\S/.test(o.className)){o.className+=" "+sClassName}
else{o.className=sClassName}},removeClassName:
function(o,sClassName){var curClassNames=o.className;var newClassNames=curClassNames.replace(new RegExp("(^\\s*|\\s+)"+sClassName+"(\\s*$|(\\s))","g"),"$3");o.className=newClassNames},setStyleProperty:
function(o,sProperty,value){if(o&&typeof o.style!="undefined"&&typeof o.style[sProperty]!="undefined"){o.style[sProperty]=value;return true}
return false}};

