if(typeof com==="undefined"){var com={}}if(typeof com.babiel==="undefined"){com.babiel={}}if(typeof com.babiel.application==="undefined"){com.babiel.application={}}if(typeof com.babiel.application.jsctrl==="undefined"){com.babiel.application.jsctrl={}}document.getElementsByClassName=function(d,c){c=(c)?c:document;var f=new RegExp("(^| )"+d+"($| )");var e=c.getElementsByTagName("*");var a=[];var b;for(b=0;b<e.length;b++){if(e[b]&&e[b].className&&e[b].className!=""){if(e[b].className.match(f)){a[a.length]=e[b]}}}return a};com.babiel.application.jsctrl.UserAgent=function(){var f;var e;var h=[{string:navigator.userAgent,subString:"Chrome",identity:"Chrome"},{string:navigator.userAgent,subString:"OmniWeb",versionSearch:"OmniWeb/",identity:"OmniWeb"},{string:navigator.vendor,subString:"Apple",identity:"Safari",versionSearch:"Version"},{prop:window.opera,identity:"Opera"},{string:navigator.vendor,subString:"iCab",identity:"iCab"},{string:navigator.vendor,subString:"KDE",identity:"Konqueror"},{string:navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:navigator.vendor,subString:"Camino",identity:"Camino"},{string:navigator.userAgent,subString:"Netscape",identity:"Netscape"},{string:navigator.userAgent,subString:"MSIE",identity:"Explorer",versionSearch:"MSIE"},{string:navigator.userAgent,subString:"Gecko",identity:"Mozilla",versionSearch:"rv"},{string:navigator.userAgent,subString:"Mozilla",identity:"Netscape",versionSearch:"Mozilla"}];var b;var g;var c=[{string:navigator.platform,subString:"Win",identity:"Windows"},{string:navigator.platform,subString:"Mac",identity:"Mac"},{string:navigator.userAgent,subString:"iPhone",identity:"iPhone/iPod"},{string:navigator.platform,subString:"Linux",identity:"Linux"}];this.__construct=function(i){f=this;e=d(h)||"An unknown browser";b=a(navigator.userAgent)||a(navigator.appVersion)||"an unknown version";g=d(c)||"an unknown OS"};this.getBrowserName=function(){return e};this.getBrowserVersion=function(){return b};this.getOperationSystemName=function(){return g};var d=function(n){for(var j=0;j<n.length;j++){var l=n[j].string;var m=n[j].prop;this.versionSearchString=n[j].versionSearch||n[j].identity;if(l){if(l.indexOf(n[j].subString)!=-1){return n[j].identity}}else{if(m){return n[j].identity}}}};var a=function(j){var i=j.indexOf(this.versionSearchString);if(i===-1){return}return parseFloat(j.substring(i+this.versionSearchString.length+1))};this.__construct()};com.babiel.application.jsctrl.Component=function(){var d;var e;var a;var f;var c;var b;this.__construct=function(){d=this;b=new com.babiel.application.jsctrl.EventManager();c=new com.babiel.application.jsctrl.Logger()};this.addClasses=function(h){var g;if(typeof h!=="object"){g=e}else{g=h}if(typeof g==="object"){for(key in g){if(typeof key==="string"&&typeof g[key]==="string"){if($(key).hasClass(g[key])===false){$(key).addClass(g[key]);d.getLogger().debug('Class "'+g[key]+'" added to element(s) "'+key+'".')}else{d.getLogger().debug('Element(s) "'+key+'" has already class "'+g[key]+'"')}}else{d.getLogger().warn("This item can't be used (key: "+key+", value: "+g[key]+") ")}}}};this.getClassesToAdd=function(){return e};this.getClassesToRemove=function(){return a};this.getClassesToReplace=function(){return f};this.getEventManager=function(){return b};this.getLogger=function(){return c};this.isLogger=function(g){loggerArg=(typeof g!=="undefined")?g:c;return(loggerArg instanceof com.babiel.application.jsctrl.Logger)};this.removeClasses=function(h){var g;if(typeof h!=="object"){g=a}else{g=h}if(typeof g==="object"){for(key in g){if(typeof key==="string"&&typeof g[key]==="string"){if($(key).hasClass(g[key])===true){$(key).removeClass(g[key]);d.getLogger().debug('Class "'+g[key]+'" removed from element(s) "'+key+'".')}else{d.getLogger().debug('Element(s) "'+key+'" has no class "'+g[key]+'"')}}else{d.getLogger().warn("This item can't be used (key: "+key+", value: "+g[key]+") ")}}}};this.replaceClasses=function(h){var g;if(typeof h!=="object"){g=f}else{g=h}if(typeof g==="object"){for(key in g){if(typeof key==="string"&&typeof g[key]==="object"){for(k in g[key]){selectedElements=$(key);if(selectedElements.hasClass(k)===true){selectedElements.removeClass(k);selectedElements.addClass(g[key][k]);d.getLogger().debug('Class "'+k+'" replaced with "'+g[key][k]+'" for element(s) "'+key+'".')}else{d.getLogger().debug('Element(s) "'+key+'" has no class "'+k+'"')}}}else{d.getLogger().warn("This item can't be used (key: "+key+", value: "+g[key]+") ")}}}};this.setClassesToAdd=function(g){if(typeof g!=="object"){throw (new TypeError('Argument "selectors" isn\'t an object.'))}e=g;this.addClasses()};this.setClassesToRemove=function(g){if(typeof g!=="object"){throw (new TypeError('Argument "selectors" isn\'t an object.'))}a=g;this.removeClasses()};this.setClassesToReplace=function(g){if(typeof g!=="object"){throw (new TypeError('Argument "selectors" isn\'t an object.'))}f=g;this.replaceClasses()};this.setEventManager=function(g){if(!(g instanceof com.babiel.application.jsctrl.EventManager)){throw new com.babiel.application.jsctrl.InvalidParameterException('Argument "eventManager" isn\'t a child of "com.babiel.application.jsctrl.EventManager"')}b=g};this.setLogger=function(g){if(!(g instanceof com.babiel.application.jsctrl.Logger)){throw new com.babiel.application.jsctrl.InvalidParameterException('Argument "logger" isn\'t a child of "com.babiel.application.jsctrl.Logger"')}c=g};this.__construct()};com.babiel.application.jsctrl.ComponentManager=function(_controller){var I;var components;var controller;var logger;var userAgent;this.__construct=function(controllerArg){I=this;if(!controllerArg instanceof com.babiel.application.jsctrl.Controller){throw (new com.babiel.application.jsctrl.InvalidParameterException('Attribute "controller" isn\'t an instance of "com.babiel.application.jsctrl.Controller"'))}controller=controllerArg;components=[];logger=new com.babiel.application.jsctrl.Logger();userAgent=new com.babiel.application.jsctrl.UserAgent()};this.checkUserAgent=function(userAgents){if(!userAgents instanceof Array){throw (new com.babiel.application.jsctrl.InvalidParameterException('Attribute "userAgents" isn\'t an array.'))}if(this.isLogger()){logger.debug('I am a "'+userAgent.getBrowserName()+" "+userAgent.getBrowserVersion()+'" at "'+userAgent.getOperationSystemName()+'".')}for(var i=0;i<userAgents.length;i++){var ua=userAgents[i];if(typeof ua.browserName!=="string"){throw (new com.babiel.application.jsctrl.WrongConfigurationException('Browser name "'+ua.browserName+'" is invalid.'))}if(typeof ua.browserVersion!=="number"){throw (new com.babiel.application.jsctrl.WrongConfigurationException('Browser version "'+ua.browserVersion+'" is invalid.'))}var os="all";if(ua.operatingSystemName!==undefined&&typeof ua.operatingSystemName==="string"){os=ua.operatingSystemName}if(I.isLogger()){logger.debug('Client "'+ua.browserName+" "+ua.browserVersion+'" at "'+os+'" is black listed.')}if(ua.browserName===userAgent.getBrowserName()&&ua.browserVersion===userAgent.getBrowserVersion()){if(os==="all"||os===userAgent.getOperationSystemName()){if(I.isLogger()){logger.info('This client "'+ua.browserName+" "+ua.browserVersion+'" at "'+os+'" is black listed.')}unsupportedUserAgent=true;return true}}}return false};this.getComponents=function(){return components};this.getLogger=function(){return logger};this.getUserAgent=function(){return userAgent};this.getComponentById=function(id){return components[id]};this.isLogger=function(loggerArg){var l=(loggerArg!==undefined)?loggerArg:logger;return(l instanceof com.babiel.application.jsctrl.Logger)};this.setLogger=function(loggerArg){if(!(loggerArg instanceof com.babiel.application.jsctrl.Logger)){throw new com.babiel.application.jsctrl.InvalidParameterException('Argument "logger" isn\'t a child of "com.babiel.application.jsctrl.Logger"')}logger=loggerArg};var addComponent=function(component,id){if(!(component instanceof com.babiel.application.jsctrl.Component)){throw (new com.babiel.application.jsctrl.InvalidParameterException('Argument "component" isn\'t a child of "com.babiel.application.jsctrl.Component".'))}var pattern=new RegExp("^[a-zA-Z0-9_]+$","i");if(typeof id==="string"&&!(pattern.test(id))){throw (new com.babiel.application.jsctrl.InvalidParameterException('Argument "id" has invalid chars, only a-z, A-Z, 0-9 and underline allowed.'))}if(typeof id==="string"){components[id]=component}else{components.push(component)}};this.loadComponent=function(componentConfiguration){if(typeof componentConfiguration!=="object"){throw (new TypeError('Attribute "componentConfiguration" isn\'t an object.'))}var notLoaded=[];var blacklisted=false;try{if(typeof componentConfiguration.unsupportedUserAgents==="object"&&componentConfiguration.unsupportedUserAgents.userAgent instanceof Array){blacklisted=this.checkUserAgent(componentConfiguration.unsupportedUserAgents.userAgent);if(blacklisted){if(this.isLogger()){this.getLogger().info('This component ("'+componentConfiguration.object+'") is blacklisted for this user agent.')}}}}catch(e){notLoaded.push('Wrong blacklisting configuration for component "'+componentConfiguration.object+'".\n'+e)}try{if(blacklisted===false&&componentConfiguration.object){var component;if(componentConfiguration.constructorArg){component=this.createComponent(componentConfiguration.object,componentConfiguration.constructorArg)}else{component=this.createComponent(componentConfiguration.object)}if(componentConfiguration.property){this.setupProperties(component,componentConfiguration.property)}if(componentConfiguration.event){this.setupEventListeners(component,componentConfiguration.event)}if(componentConfiguration.id){addComponent(component,componentConfiguration.id)}else{addComponent(component)}return component}}catch(e){notLoaded.push("Can't load component \""+componentConfiguration.object+'".\n'+e)}if(notLoaded.length>0){var out="";for(var j=0;notLoaded.length>j;j++){out+=notLoaded[j].toString()+"\n"}throw (new com.babiel.application.jsctrl.WrongConfigurationException(out))}};this.loadComponents=function(componentsConfiguration){if((componentsConfiguration instanceof Array)===false){throw (new com.babiel.application.jsctrl.InvalidParameterException('Attribute "componentsConfiguration" isn\'t an instance of "Array".'))}var notLoaded=[];for(var i=0;i<componentsConfiguration.length;i++){try{this.loadComponent(componentsConfiguration[i])}catch(e){notLoaded.push(e)}}if(notLoaded.length>0){var out="";for(var j=0;notLoaded.length>j;j++){out+=notLoaded[j].toString()+"\n"}throw (new com.babiel.application.jsctrl.WrongConfigurationException("Something is wrong with this configuration.\n"+out))}};this.createComponent=function(componentPrototype,constructorArgs){if(typeof componentPrototype!=="string"){throw (new TypeError('Attribute "componentPrototype" isn\'t a string.'))}objectExists(componentPrototype);var componentArguments="";var notLoaded=[];var args=[];if(constructorArgs instanceof Array){var availableArgs=getConstructorArguments(componentPrototype);for(var i=0;i<constructorArgs.length;i++){try{if(typeof constructorArgs[i].index!=="number"){throw (new TypeError('Constructor arguments index with value "'+constructorArgs[i].value+"\" isn't a number."))}if(typeof constructorArgs[i].value==="undefined"){throw (new TypeError('Constructor argument with index "'+constructorArgs[i].index+'" need a value.'))}if(typeof availableArgs[(constructorArgs[i].index)]==="undefined"){throw (new com.babiel.application.jsctrl.NotSupportedException('Constructor argument with index "'+constructorArgs[i].index+"\" isn't available."))}if(this.isLogger()){logger.debug('Argument "'+availableArgs[(constructorArgs[i].index)]+'" is "'+constructorArgs[i].value+'".')}args[(constructorArgs[i].index)]=constructorArgs[i].value}catch(e){notLoaded.push(e)}}}var component=false;try{component=createObject(componentPrototype,args)}catch(e){throw (new com.babiel.application.jsctrl.Exception('Initialising component "'+componentPrototype+'" failed. '+e))}if((component instanceof com.babiel.application.jsctrl.Component)===false){throw (new com.babiel.application.jsctrl.NotSupportedException('Defined object "'+componentPrototype+'" in given configuration isn\'t a child of "com.babiel.application.jsctrl.Component".'))}return component};var createObject=function(objectName,objectArgs){if(typeof objectName!=="string"){throw (new TypeError('Attribute "objectName" isn\'t a string.'))}if(!objectArgs instanceof Array){throw (new com.babiel.application.jsctrl.InvalidParameterException('Attribute "objectArgs" isn\'t an "Array".'))}if(objectArgs.length>0){var st="";for(var i=0;i<objectArgs.length;i++){st+=(st==="")?"constructorArgs["+i+"]":", constructorArgs["+i+"]"}st="return new "+objectName+"( "+st+" );";var create=new Function("constructorArgs",st);return create(objectArgs)}else{st="return new "+objectName+"();";var create=new Function(st);return create()}throw new com.babiel.application.jsctrl.InvalidParameterException("No component can be instanciated with this parameters.")};var getConstructorArguments=function(objectName){var func=String(eval(objectName));var pattern=new RegExp("^function.*","i");var lineOne=String(func.match(pattern));pattern=new RegExp("[(].*[)]","i");var betweenParenthesis=String(lineOne.match(pattern));pattern=new RegExp("[a-zA-Z0-9]+","g");var m=betweenParenthesis.match(pattern);if(m===null){throw (new com.babiel.application.jsctrl.WrongConfigurationException('This object "'+objectName+"\" haven't arguments."))}I.getLogger().debug('Arguments from "'+objectName+'" are: '+m);return m};this.setupProperties=function(component,propertyConfiguration){if((component instanceof com.babiel.application.jsctrl.Component)===false){throw (new com.babiel.application.jsctrl.InvalidParameterException('Attribute "component" isn\'t a child of com.babiel.application.jsctrl.Component'))}if((propertyConfiguration instanceof Array)===false){throw (new com.babiel.application.jsctrl.InvalidParameterException('Attribute "propertyConfiguration" isn\'t an Array'))}var notLoaded=[];for(var i=0;i<propertyConfiguration.length;i++){var property=propertyConfiguration[i];var propertySetterMethod="set"+property.name.substr(0,1).toUpperCase()+property.name.substr(1,property.name.length-1);try{methodExists(component,propertySetterMethod);var setup=new Function("component, value","component."+propertySetterMethod+"(value);");if(property.value===undefined&&typeof property.ref==="string"){I.getLogger().debug('Property reference "'+property.ref+'" found.');if(components[property.ref]===undefined){throw (new com.babiel.application.jsctrl.WrongConfigurationException('Property reference "'+property.ref+"\" can't be resolved."))}setup(component,components[property.ref])}else{I.getLogger().debug("Property value found.");setup(component,property.value)}}catch(e){notLoaded.push(e)}}if(notLoaded.length>0){var out="";for(var j=0;notLoaded.length>j;j++){out+=notLoaded[j].toString()+"\n"}throw (new com.babiel.application.jsctrl.WrongConfigurationException("Some Setter methods not found.\n"+out))}};this.setupEventListeners=function(component,eventConfiguration){if((component instanceof com.babiel.application.jsctrl.Component)===false){throw (new com.babiel.application.jsctrl.InvalidParameterException('Attribute "component" isn\'t a child of com.babiel.application.jsctrl.Component'))}if((eventConfiguration instanceof Array)===false){throw (new com.babiel.application.jsctrl.InvalidParameterException('Attribute "eventConfiguration" isn\'t an Array'))}for(var i=0;i<eventConfiguration.length;i++){var event=eventConfiguration[i];try{this.setupEventListener(component,event.htmlElementId,event.type,event.method)}catch(e){throw (new com.babiel.application.jsctrl.WrongConfigurationException(e))}}};this.setupEventListener=function(component,htmlElementId,eventType,methodName){if((component instanceof com.babiel.application.jsctrl.Component)===false){throw (new com.babiel.application.jsctrl.InvalidParameterException('Attribute "component" isn\'t a child of com.babiel.application.jsctrl.Component'))}var element=window;if(typeof htmlElementId!=="string"){I.getLogger().debug('Argument "htmlElementId" isn\'t a string.')}else{if(document.getElementById(htmlElementId)){element=document.getElementById(htmlElementId)}else{I.getLogger().debug("Can't find a HTML element with id \""+htmlElementId+'".')}}if(typeof eventType!=="string"){throw (new TypeError('Attribute "eventType" isn\'t an object'))}if(typeof methodName!=="string"){throw (new TypeError('Attribute "methodName" isn\'t an object 2'))}try{methodExists(component,methodName)}catch(e){throw (new com.babiel.application.jsctrl.WrongConfigurationException(e))}var callbackAdapter=function(element,eventHandler,functionReference){var callbackForEvent=new Function("component","element","eventHandler","functionReference","component."+methodName+"(element, eventHandler, functionReference);");callbackForEvent(component,element,eventHandler,functionReference)};component.getEventManager().addEventListener(element,eventType,callbackAdapter,false)};var methodExists=function(obj,methodName){if(typeof obj!=="object"){throw (new TypeError('Attribute "obj" isn\'t an object'))}if(typeof methodName!=="string"){throw (new TypeError('Attribute "methodName" isn\'t a string'))}var exists=new Function("o","return (typeof o."+methodName+" === 'function');");if(exists(obj)===false){throw (new com.babiel.application.jsctrl.MethodNotFoundException('Method "'+methodName+"\" doesn't exist"))}};var objectExists=function(objectName){if(typeof objectName!=="string"){throw (new TypeError('Attribute "objectName" isn\'t a string'))}try{var exists=new Function("return (typeof "+objectName+" === 'object');");exists()}catch(e){throw (new com.babiel.application.jsctrl.ObjectNotFoundException('Object "'+objectName+"\" doesn't exist"))}};this.__construct(_controller)};com.babiel.application.jsctrl.Controller=function(argConfigurationType,argConfigurationSource){var I;var componentManager;var configuration={};var includes={};var loaded=false;var loadingListenerBound=false;var logger;var unsupportedUserAgent;var userAgent;this.__construct=function(configTypeArg,configSourceArg){I=this;if(typeof configTypeArg!=="string"){throw (new TypeError('Attribute "configType" isn\'t string. '))}if(typeof configSourceArg==="undefined"){throw (new TypeError('Attribute "configSource" isn\'t string. '))}unsupportedUserAgent=false;componentManager=new com.babiel.application.jsctrl.ComponentManager(this);userAgent=new com.babiel.application.jsctrl.UserAgent();this.addConfiguration(configTypeArg,configSourceArg);bindLoadingListener();window.onunload=this.onEventUnload};var bindLoadingListener=function(){if(loadingListenerBound){return}loadingListenerBound=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);I.onEventInit()},false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);I.onEventInit()}})}else{window.onload=function(){I.onEventInit()}}}};this.getLogger=function(){return logger};this.getUserAgent=function(){return userAgent};this.isLogger=function(argLogger){loggerArg=(typeof argLogger!=="undefined")?argLogger:logger;return(loggerArg instanceof com.babiel.application.jsctrl.Logger)};this.isUnsupportedUserAgent=function(argLogger){return unsupportedUserAgent};this.addConfiguration=function(configTypeArg,configSourceArg){if(typeof configTypeArg!="string"){throw (new TypeError('Argument "configType" isn\'t string.'))}if(configTypeArg=="json"){if(typeof configSourceArg!="object"){throw (new TypeError('Argument "configSource" isn\'t an object.'))}var confObj=configSourceArg}if(configTypeArg=="jsonString"){if(typeof configSourceArg!="string"){throw (new TypeError('Argument "configSource" isn\'t a string.'))}var confObj=addConfigurationFromJsonString(configSourceArg)}if(configTypeArg=="jsonFile"){if(typeof configSourceArg!="string"){throw (new TypeError('Argument "configSource" isn\'t a string.'))}var confObj=addConfigurationFromJsonFile(configSourceArg)}if(!loaded){parseJsonConfiguration(confObj)}if(loaded===true){if(typeof confObj.unsupportedUserAgents==="object"&&confObj.unsupportedUserAgents.userAgent instanceof Array){I.checkUserAgent(confObj.unsupportedUserAgents.userAgent)}if(unsupportedUserAgent===false){var cmpnts=confObj.configuration.components;if(typeof cmpnts==="object"&&cmpnts.component instanceof Array){try{I.getComponentManager().loadComponents(cmpnts.component)}catch(e){if(I.isLogger()){logger.warn(e.toString())}}}else{if(I.isLogger()){logger.warn("Es wurde keine Komponenten-Definitionen übergeben.")}}}else{if(I.isLogger()){logger.warn("User-Agent wird nicht unterstützt.")}}}};var addConfigurationFromJsonString=function(configSourceArg){var objectTree=eval("("+configSourceArg+")");if(typeof objectTree!="object"){throw (new TypeError('Argument "configSource" isn\'t an object.'))}return objectTree};var addConfigurationFromJsonFile=function(url){httpRequest=new com.babiel.application.jsctrl.HttpRequest();httpRequest.setAsynchronous(false);httpRequest.setResponseType("json");httpRequest.setUrl(url);httpRequest.send();return httpRequest.getResponse()};this.mergeObjects=function(obj1,obj2,overwrite){if(typeof obj1!=="object"){throw new TypeError('Parameter "obj1" isn\'t an object.')}if(typeof obj2!=="object"){throw new TypeError('Parameter "obj2" isn\'t an object.')}var pattern=new RegExp("^(keep|overwrite|overwriteExceptArrays)$");if(!(pattern.test(overwrite))){throw new com.babiel.application.jsctrl.InvalidParameterException('Parameter "overwrite" is invalid.')}for(var key in obj2){try{if(obj2[key].constructor==Object){obj1[key]=this.mergeObjects(obj1[key],obj2[key],overwrite)}else{if(overwrite==="overwrite"){obj1[key]=obj2[key]}if(overwrite==="overwriteExceptArrays"&&obj1[key] instanceof Array&&obj2[key] instanceof Array){for(var i=0;i<obj2[key].length;i++){obj1[key].push(obj2[key][i])}}}}catch(e){obj1[key]=obj2[key]}}return obj1};var parseJsonConfiguration=function(objectTree){if(typeof objectTree!="object"){throw new TypeError('Argument "objectTree" isn\'t an object.')}if(objectTree.configuration&&typeof objectTree.configuration==="object"){configuration=I.mergeObjects(configuration,objectTree.configuration,"overwriteExceptArrays")}else{throw (new com.babiel.application.jsctrl.WrongConfigurationException("Configuration object isn't valid."))}};var loadConfiguration=function(){if(typeof configuration.controllerLogger==="object"){try{var controllerLogger=I.getComponentManager().loadComponent(configuration.controllerLogger);I.setLogger(controllerLogger);I.getComponentManager().setLogger(controllerLogger)}catch(e){alert("Protokollierungseinheit konnte nicht geladen werden.")}}if(typeof configuration.unsupportedUserAgents==="object"&&configuration.unsupportedUserAgents.userAgent instanceof Array){I.checkUserAgent(configuration.unsupportedUserAgents.userAgent)}if(unsupportedUserAgent===false){if(typeof configuration.components==="object"&&configuration.components.component instanceof Array){try{I.getComponentManager().loadComponents(configuration.components.component)}catch(e){if(I.isLogger()){logger.warn(e.toString())}}}}else{if(I.isLogger()){logger.debug("Dieser User-Agent (Browser) wird nicht unterstützt.")}}};this.checkUserAgent=function(userAgents){if(!userAgents instanceof Array){throw (new com.babiel.application.jsctrl.InvalidParameterException('Attribute "userAgents" isn\'t an array.'))}if(I.isLogger()){logger.debug('I am a "'+userAgent.getBrowserName()+" "+userAgent.getBrowserVersion()+'" at "'+userAgent.getOperationSystemName()+'".')}for(var i=0;i<userAgents.length;i++){var ua=userAgents[i];if(typeof ua.browserName!=="string"){throw (new com.babiel.application.jsctrl.WrongConfigurationException('Browser name "'+ua.browserName+'" is invalid.'))}if(typeof ua.browserVersion!=="number"){throw (new com.babiel.application.jsctrl.WrongConfigurationException('Browser version "'+ua.browserVersion+'" is invalid.'))}var os="all";if(typeof ua.operatingSystemName!=="undefined"&&typeof ua.operatingSystemName==="string"){os=ua.operatingSystemName}if(I.isLogger()){logger.debug('Client "'+ua.browserName+" "+ua.browserVersion+'" at "'+os+'" is black listed.')}if(ua.browserName===userAgent.getBrowserName()&&ua.browserVersion===userAgent.getBrowserVersion()){if(os==="all"||os===userAgent.getOperationSystemName()){if(I.isLogger()){logger.info('This client "'+ua.browserName+" "+ua.browserVersion+'" at "'+os+'" is black listed.')}unsupportedUserAgent=true;return true}}}return false};this.getConfiguration=function(){return configuration};this.getComponentManager=function(){return componentManager};this.addIncludeFiles=function(files){for(var i=0;i<files.length;i++){if(files[i]&&typeof files[i]=="string"){includes.push(this.includeFile(files[i]))}}};this.includeFile=function(url){if(loaded==false){if(typeof url!=="string"){throw (new Error("no url set. usage includeFile( *url* )"))}document.write('<script id="file" src="'+url+'" type="text/javascript"><\/script>');return document.getElementById("file")}};this.includeFiles=function(){for(var i=0;i<includes.length;i++){this.includeFile(includes[i])}};this.getInputElementsByType=function(typeName){if(typeof typeName!="string"){throw (new TypeError('Argument "typeName" isn\'t a string'))}var pattern=new RegExp("^(button|checkbox|file|hidden|image|password|radio|reset|submit|text)$");if(!(pattern.test(typeName))){throw (new com.babiel.application.jsctrl.InvalidParameterException('Given "typeName" isn\'t valid'))}var inputs=[];var allInputs=document.getElementsByTagName("input");for(var i=0;i<allInputs.length;i++){if(allInputs[i].type==typeName){inputs.push(allInputs[i])}}return inputs};this.isChildOf=function(child,parent,recursive){if(!child&&!(typeof child=="object")){throw (new TypeError('Argument "child" isn\'t an object'))}if(!parent&&!(typeof parent=="object")){throw (new TypeError('Argument "parent" isn\'t an object'))}if(!(typeof recursive=="boolean")){throw (new TypeError('Argument "recursive" isn\'t an object'))}if(child==parent||child.tagName=="BODY"){return false}else{if(recursive===false){if(child.parentNode==parent){return true}else{return false}}else{if(child.parentNode===parent){return true}else{if(child.parentNode){if(String(child.parentNode.tagName).match(/^body$/i)){return false}else{return System.isChildOf(child.parentNode,parent,true)}}else{return false}}}}};this.onEventInit=function(){loadConfiguration();loaded=true};this.onEventUnload=function(){};this.getDocumentName=function(){var pattern=new RegExp("/([a-zA-Z0-9-_]*.[a-zA-Z0-9-_]*)$");var documentName="";if(typeof window.location.pathname=="string"){var parts=pattern.exec(window.location.pathname);if(parts!==null&&parts.length>1){documentName=parts[1]}}return documentName};this.getParameterFromQueryString=function(parameterName){var pattern=new RegExp("([?]|[&])"+parameterName+"=([0-9A-Za-z_-]*)");var parameterValue=null;if(typeof window.location.search=="string"){var parts=pattern.exec(window.location.search);if(parts!==null&&parts.length>1){parameterValue=parts[2]}}return parameterValue};this.setLogger=function(loggerArg){if(!(loggerArg instanceof com.babiel.application.jsctrl.Logger)){throw new com.babiel.application.jsctrl.InvalidParameterException('Argument "logger" isn\'t a child of "com.babiel.application.jsctrl.Logger"')}logger=loggerArg};this.__construct(argConfigurationType,argConfigurationSource)};com.babiel.application.jsctrl.ElementEvent=function(a,b){var d=false;this.name="";this.element;var c={};this.__construct=function(e,f){if(!e&&!(typeof e=="string")){throw ("eventNameArg isn't an string")}else{this.name=e}if(!f&&!(typeof f=="object")){throw ("elementArg isn't an object")}else{this.element=f}};this.set=function(g){c=g||window.event||{};c.returnValue=true;var f=window.document.body;this.X=c.pageX?c.pageX:c.clientX+f.scrollLeft;this.Y=c.pageY?c.pageY:c.clientY+f.scrollTop;this.clientX=(c.clientX)?c.clientX:c.pageX-window.pageXOffset;this.clientY=(c.clientY)?c.clientY:c.pageY-window.pageYOffset;this.type=c.type;this.element=c.target?c.target:c.srcElement?c.srcElement:document.body;this.tagName=this.element.tagName||"[unknown]";this.self=this.element;d=false};this.getPos=function(){return[this.X,this.Y]};this.isCancel=function(){return d};this.stopPropagation=function(){if(c.stopPropagation){c.stopPropagation()}else{c.cancelBubble=true}d=true};this.preventDefault=function(){if(c.preventDefault){c.preventDefault()}c.returnResult=false;c.returnValue=false};this.__construct(a,b)};com.babiel.application.jsctrl.EventHandler=function(b,f){var c;var e=true;var h;var g;var a;var d;this.__construct=function(i,j){if(!i&&!(typeof i=="string")){throw ("eventName isn't an string")}else{a=i}if(!j&&!(typeof j=="object")){throw ("element isn't an object")}else{d=j}h=[];if(!g){this.createElementEvent()}c=this};this.addFunction=function(j){if(typeof j!="function"){throw ("functionReference isn't a function")}var m=function(o){g.set(o);for(var n=0;n<h.length;n++){h[n].call(d,d,c,j);if(g.isCancel()){break}}return g.returnValue};m.handler=this;d["on"+a]=m;for(var l=0;l<h.length;++l){if(h[l].toString()==j.toString()){return -1}}return h.push(j)-1};this.removeFunction=function(j){if(typeof j=="number"){return h.splice(j,1)}for(var l=0;l<h.length;++l){if(h[l]==j){return h.splice(l,1)}}return false};this.createElementEvent=function(){g=new com.babiel.application.jsctrl.ElementEvent(a,d);var i=function(l,j){if(j.getBubbling()==false&&this!=l.element){g.stopPropagation()}};this.addFunction(i)};this.getBubbling=function(){return e};this.getElement=function(){return d};this.getElementEvent=function(){return g};this.getFunctions=function(){return h};this.setBubbling=function(i){if(!(typeof i=="boolean")){throw ("bubbling isn't an boolean")}else{e=i}};this.__construct(b,f)};com.babiel.application.jsctrl.EventManager=function(){var a;this.__construct=function(){a=this};this.addEventListener=function(g,d,b,f){if(!g){g=window}if(!d){d="load"}if(typeof b!=="function"){throw (new TypeError("No reference to a function"))}if(!f){f=true}if(typeof g["on"+d]==="function"&&typeof g["on"+d].handler!=="object"){var c=g["on"+d];g["on"+d]=false;this.addEventListener(g,d,c,f)}if(typeof g["on"+d]==="function"&&typeof g["on"+d].handler==="object"){g["on"+d].handler.addFunction(b)}if(g&&(typeof g["on"+d])!="function"){var e=new com.babiel.application.jsctrl.EventHandler(d,g);e.setBubbling(f);e.addFunction(b)}};this.removeEventListener=function(d,c,b){if(!d){d=window}if(!c){c="load"}if(typeof b!="function"){throw (new Error("no reference to a function. usage removeEventListener( element, eventName, *functionReference*)"))}if(d["on"+c]){d["on"+c].handler.removeFunction(b)}};this.__construct()};com.babiel.application.jsctrl.Exception=function(c){var b;var a;this.__construct=function(d){b="";a="";if(d instanceof com.babiel.application.jsctrl.Exception){b=d}else{if(typeof d==="string"){a=d}else{a=String(d)}}};this.getMessage=function(){return a};this.toString=function(){return a+b};this.__construct(c)};com.babiel.application.jsctrl.HttpRequest=function(argConfiguration){var I;var asynchronous;var awaitResponse;var callbacks;var charset;var method;var mimeType;var parameters;var request;var state;var response;var responseType;var url;this.__construct=function(){I=this;awaitResponse=true;callbacks={};charset="utf-8";method="get";mimeType="text/html";parameters={};responseType="text";state=0;asynchronous=true};this.getAsynchronous=function(){return asynchronous};this.getAwaitResponse=function(){return awaitResponse};this.getMethod=function(){return method};this.getMimeType=function(){return mimeType};this.getParameters=function(){return parameters};this.getRequest=function(){return request};this.getResponse=function(){return response};this.getResponseType=function(){return responseType};this.getUrl=function(){return url};this.setCharset=function(charsetArg){var msgUsage="Usage setCharset( charset )";if(typeof charsetArg!="string"){throw (new TypeError('Argument "charset" isn\'t a string. '+msgUsage))}charset=charsetArg};this.setAsynchronous=function(asynchronousArg){if(typeof asynchronousArg!=="boolean"){throw (new TypeError('Argument "asynchronous" isn\'t an boolean value.'))}asynchronous=asynchronousArg};this.setAwaitResponse=function(awaitResponseArg){if(typeof awaitResponseArg!=="boolean"){throw (new TypeError('Argument "awaitResponse" isn\'t an boolean value.'))}awaitResponse=awaitResponseArg};this.setMethod=function(methodArg){var msgUsage="Usage setMethod( method )";if(typeof methodArg!="string"){throw (new TypeError('Parameter "method" isn\'t a string. '+msgUsage))}if(!methodArg.match(/^(get|post)$/i)){throw (new com.babiel.application.jsctrl.InvalidParameterException('Parameter "method" isn\'t valid, only GET and POST are allowed.'))}method=methodArg};this.setMimeType=function(mimeTypeArg){var msgUsage="Usage setMimeType( mimeType )";if(typeof mimeTypeArg!="string"){throw (new TypeError('Parameter "mimeType" isn\'t a string. '+msgUsage))}if(!mimeTypeArg.match(/^[a-z]+\/[a-z]+$/i)){throw (new com.babiel.application.jsctrl.InvalidParameterException('Parameter "mimeType" isn\'t valid. '+msgUsage))}mimeType=mimeTypeArg};this.setParameters=function(parametersArg){var msgUsage="Usage setParameters( parameters )";if(typeof parametersArg!="object"){throw (new TypeError('Parameter "parameters" isn\'t an object. '+msgUsage))}parameters=parametersArg};this.setResponseType=function(responseTypeArg){if(typeof responseTypeArg!="string"){throw (new TypeError('Parameter "responseType" isn\'t a string.'))}var pattern=new RegExp("^(json|text|xml)$");if(!(pattern.test(responseTypeArg))){throw (new com.babiel.application.jsctrl.InvalidParameterException('Parameter "responseType" isn\'t valid.'))}responseType=responseTypeArg};this.setUrl=function(urlArg){if(typeof urlArg!="string"){throw (new TypeError('Parameter "url" isn\'t a string.'))}url=urlArg};this.setCallback=function(stateNumber,functionReference){var msgUsage="Usage addCallback( stateNumber, functionReference )";if(typeof stateNumber!="number"){throw (new TypeError('Parameter "stateNumber" isn\'t a number. '+msgUsage))}var msgUsage="Usage addCallback( functionReference, functionReference )";if(typeof functionReference!="function"){throw (new TypeError('Parameter "functionReference" isn\'t a function. '+msgUsage))}callbacks[stateNumber]=functionReference};this.addParameter=function(name,value){if(name!=""&&value){parameters[name]=value}};this.getParametersAsQueryString=function(){var paramQuery="";for(var key in parameters){var separator=(paramQuery=="")?"?":"&";var name=String(parameters[key]);if(name.substring(0,9)!="function "){paramQuery+=separator+key+"="+parameters[key]}}return paramQuery};this.getResponseAsXml=function(transport){return transport.responseXML};this.getResponseAsText=function(transport){return transport.responseText};this.getResponseAsJson=function(transport){var result;try{result=eval("("+transport.responseText+")")}catch(e){throw (new com.babiel.application.jsctrl.Exception(e))}return result};this.send=function(){if(awaitResponse===true&&state!==0){return false}if(window.XMLHttpRequest){request=new XMLHttpRequest();if(request.overrideMimeType){request.overrideMimeType(mimeType+"; charset="+charset)}}else{if(window.ActiveXObject){try{request=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{request=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){}}}}if(!request){throw (new com.babiel.application.jsctrl.NotSupportedException("Browser doesn't support XMLHttpRequest"))}if(asynchronous===true){request.onreadystatechange=this.processResponse}if(method.match(/^get$/i)){request.open(method,url+this.getParametersAsQueryString(),asynchronous);request.send(null)}else{if(method.match(/^post$/i)){request.open(method,url,asynchronous);request.send(parameters)}else{throw (new com.babiel.application.jsctrl.InvalidParameterException("HTTP request method invalid ("+method+")"))}}if(asynchronous===false){this.processResponse()}};this.processResponse=function(){state=request.readyState;if(request.readyState==4){if(request.status==200){if(responseType==="json"){try{response=I.getResponseAsJson(request)}catch(e){alert("JSON isn't valid")}}if(responseType==="text"){response=I.getResponseAsText(request)}if(responseType==="xml"){response=I.getResponseAsXml(request)}}}if(typeof callbacks[request.readyState]=="function"){callbacks[request.readyState]()}};this.__construct()};com.babiel.application.jsctrl.InvalidParameterException=function(a){this.constructor(a)};com.babiel.application.jsctrl.InvalidParameterException.prototype=new com.babiel.application.jsctrl.Exception();com.babiel.application.jsctrl.Logger=function(){this.getCurrentLogLevelType=function(){};this.getLogLevel=function(){};this.getName=function(){};this.setLogLevel=function(){};this.setName=function(){};this.debug=function(){};this.error=function(){};this.fatal=function(){};this.info=function(){};this.trace=function(){};this.warn=function(){}};com.babiel.application.jsctrl.Logger.prototype=new com.babiel.application.jsctrl.Component();com.babiel.application.jsctrl.ConsoleLogger=function(e,g){var d;var c;var a;var b;this.__construct=function(h){d=this;a=-1;b=["off","error","warn","info","debug"];c="(unknown)";if(h){this.setLogLevel(h)}this.debug('initialize "com.babiel.application.jsctrl.ConsoleLogger"')};this.getCurrentLogLevelType=function(){return(typeof b[a]!=="undefined")?b[a]:"unknown"};this.getLogLevel=function(){return a};this.getName=function(){return c};this.getPrefix=function(){return c+": "};var f=function(j){if(typeof j!=="string"){throw new TypeError('Argument "logLevelType" isn\'t a string')}for(var h=0;h<b.length;h++){if(b[h]===j){return h}}return -1};this.setLogLevel=function(h){if(typeof h!=="string"){throw new TypeError('Argument "logLevel" isn\'t a string')}var i=-1;if(typeof h==="string"){i=f(h)}if(typeof h==="number"&&h>=0&&h<=4){i=h}a=i};this.setName=function(h){if(typeof h!=="string"){throw new TypeError('Argument "name" isn\'t a string')}c=h;this.debug('setting name to "'+h+'"')};this.debug=function(h){if(typeof console!=="undefined"){if(a>=4){console.debug(this.getPrefix()+"DEBUG: "+h)}}};this.error=function(h){if(typeof console!=="undefined"){if(a>=1){console.error(this.getPrefix()+h)}}};this.info=function(h){if(typeof console!=="undefined"){if(a>=3){console.info(this.getPrefix()+h)}}};this.trace=function(){if(typeof console!=="undefined"){if(a>=4){console.trace()}}};this.warn=function(h){if(typeof console!=="undefined"){if(a>=2){console.warn(this.getPrefix()+h)}}};this.__construct(e)};com.babiel.application.jsctrl.ConsoleLogger.prototype=new com.babiel.application.jsctrl.Logger();com.babiel.application.jsctrl.MethodNotFoundException=function(a){this.constructor(a)};com.babiel.application.jsctrl.MethodNotFoundException.prototype=new com.babiel.application.jsctrl.Exception();com.babiel.application.jsctrl.NotSupportedException=function(a){this.constructor(a)};com.babiel.application.jsctrl.NotSupportedException.prototype=new com.babiel.application.jsctrl.Exception();com.babiel.application.jsctrl.ObjectNotFoundException=function(a){this.constructor(a)};com.babiel.application.jsctrl.ObjectNotFoundException.prototype=new com.babiel.application.jsctrl.Exception();com.babiel.application.jsctrl.WrongConfigurationException=function(a){this.constructor(a)};com.babiel.application.jsctrl.WrongConfigurationException.prototype=new com.babiel.application.jsctrl.Exception();com.babiel.application.jsctrl.ComponentWithXHR=function(){var b;var a;this.__construct=function(){b=this;a=new com.babiel.application.jsctrl.HttpRequest()};this.getHttpRequest=function(){return a};this.setHttpRequest=function(c){if(!(c instanceof com.babiel.application.jsctrl.HttpRequest)){throw new com.babiel.application.jsctrl.InvalidParameterException('Argument "httpRequest" isn\'t an child of "com.babiel.application.jsctrl.HttpRequest"')}a=c};this.__construct()};com.babiel.application.jsctrl.ComponentWithXHR.prototype=new com.babiel.application.jsctrl.Component();com.babiel.application.jsctrl.JQueryComponent=function(){var b;var a;this.__construct=function(){b=this};this.setupEvents=function(d){b.getLogger().debug("Setup definied events automatically.");if(typeof d==="object"){var c;for(key in d){c=d[key];if(typeof c==="object"&&typeof c.handler==="function"&&typeof c.eventType==="string"&&typeof c.selector!=="undefined"){b.getLogger().debug('Setup event handler for event "'+key+'" with selector "'+c.selector+'"');var e=(c.data!==undefined)?c.data:{};$(c.selector).unbind(c.eventType,c.handler).bind(c.eventType,e,c.handler)}else{b.getLogger().debug('Setup event handler for event "'+key+'" failed.')}}}else{b.getLogger().warn("Can not setup events, no settings available.")}};this.__construct()};com.babiel.application.jsctrl.JQueryComponent.prototype=new com.babiel.application.jsctrl.Component();
