/**
Copyright (c) 2009 Emilian Pascalau (http://bpt.hpi.uni-potsdam.de/Public/EmilianPascalau)
http://jsonrules.googlecode.com

Thanks go to Adrian Giurca (http://www.informatik.tu-cottbus.de/~agiurca/) for his support!

Licensed under the Apache License, Version 2.0 (the "License"); 
you may not use this file except in compliance with the License. 
You may obtain a copy of the License at 

	http://www.apache.org/licenses/LICENSE-2.0 

Unless required by applicable law or agreed to in writing, software 
distributed under the License is distributed on an "AS IS" BASIS, 
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
See the License for the specific language governing permissions and
limitations under the License. 

The JSON Rules Rule Engine takes use of DOJO. 
This version uses dojo 1.3.2.
Please see below the DOJO license. 
*/

/**
	Copyright (c) 2004-2009, The Dojo Foundation All Rights Reserved.
	Available via Academic Free License >= 2.1 OR the modified BSD license.
	see: http://dojotoolkit.org/license for details
*/

/**
	This is a compiled version of Dojo, built for deployment and not for
	development. To get an editable version, please visit:

		http://dojotoolkit.org

	for documentation and information on getting the source.
*/

if(!dojo._hasResource["org.jsonrules.io.Reader"]){dojo._hasResource["org.jsonrules.io.Reader"]=true;dojo.provide("org.jsonrules.io.Reader");dojo.declare("org.jsonrules.io.Reader",null,{read:function(){}});}if(!dojo._hasResource["org.jsonrules.io.XmlHttpRequestReader"]){dojo._hasResource["org.jsonrules.io.XmlHttpRequestReader"]=true;dojo.provide("org.jsonrules.io.XmlHttpRequestReader");dojo.declare("org.jsonrules.io.XmlHttpRequestReader",org.jsonrules.io.Reader,{_mimeType:null,_fileURI:null,_timeOut:0,_content:null,constructor:function(_1){this._fileURI=_1;this._mimeType="text";this._timeOut=5000;},getMimeType:function(){return this._mimeType;},getFileURI:function(){return this._fileURI;},getTimeOut:function(){return this._timeOut;},setMimeType:function(_2){this._mimeType=_2;},setFileURI:function(_3){this._fileURI=_3;},setTimeOut:function(_4){this._timeOut=_4;},read:function(){this.inherited(arguments);dojo.xhrGet({url:this._fileURI,handleAs:this._mimeType,timeout:this._timeOut,sync:true,load:dojo.hitch(this,function(_5,_6){this._content=_5;return _5;}),error:function(_7,_8){console.error("org.jsonrules.io.XmlHttpRequestReader.read, HTTP status code: ",_8.xhr.status);return _7;}});return this._content;}});}if(!dojo._hasResource["org.jsonrules.repository.parser.ParserConfiguration"]){dojo._hasResource["org.jsonrules.repository.parser.ParserConfiguration"]=true;dojo.provide("org.jsonrules.repository.parser.ParserConfiguration");org.jsonrules.repository.parser.ParserConfiguration={RULE_DELIMITER:"#rule#"};}if(!dojo._hasResource["org.jsonrules.repository.parser.RegularExpressions"]){dojo._hasResource["org.jsonrules.repository.parser.RegularExpressions"]=true;dojo.provide("org.jsonrules.repository.parser.RegularExpressions");org.jsonrules.repository.parser.RegularExpressions={RULE_ID_LINE:"\"[\\s|]*id[\\s|]*\"\\s*:\\s*\"[\\sa-zA-Z_0-9]*\",",RULE_ID:"[\\sa-zA-Z_0-9]+",PRIORITY_LINE:"\"\\s*priority\\s*\":[\"]*\\d+[\"]*,",PRIORITY:"\\d+",APPLIES_TO_FOLLOWED_BY_EVENTEXPR:"\"\\s*appliesTo\\s*\":[\\w\\S\\s]*eventExpression",APPLIES_TO_FOLLOWED_BY_CONDITION:"\"\\s*appliesTo\\s*\":[\\w\\S\\s]*condition",ACTIONS:"\"\\s*actions\\s*\":[\\w\\S\\s]*",FUNCTION:"\\w+\\s*\\(\\s*\\)",FUNCTION_NAME:"\\w+",JSON_TERM:"",VARIABLE_IDENTIFIER:"",NAME_OF_ELEMENT:"",ID_OF_ELEMENT:"",XPATH_EXPRESSION:"",URL:"(http|https)://([\\w-]+\\.)+[\\w-]+(/[\\w- ./?%&=]*)?"};}if(!dojo._hasResource["org.jsonrules.lang.EventTargetInternalType"]){dojo._hasResource["org.jsonrules.lang.EventTargetInternalType"]=true;dojo.provide("org.jsonrules.lang.EventTargetInternalType");org.jsonrules.lang.EventTargetInternalType={ID:1,NAME:2,JSON_TERM:3,XPATH:4,VARIABLE:5};}if(!dojo._hasResource["org.jsonrules.lang.EventExpression"]){dojo._hasResource["org.jsonrules.lang.EventExpression"]=true;dojo.provide("org.jsonrules.lang.EventExpression");dojo.declare("org.jsonrules.lang.EventExpression",null,{_type:null,_eventPhase:null,_eventTarget:null,_eventTargetInternalType:"",_timeStamp:null,constructor:function(){},setType:function(_9){this._type=_9;},getType:function(){return this._type;},setEventPhase:function(_a){this._eventPhase=_a;},getEventPhase:function(){return this._eventPhase;},setEventTarget:function(_b){this._eventTarget=_b;},getEventTarget:function(){return this._eventTarget;},setEventTargetInternalType:function(_c){this._eventTargetInternalType=_c;},getEventTargetInternalType:function(){return this._eventTargetInternalType;},setTimeStamp:function(_d){this._timeStamp=_d;},getTimeStamp:function(){return this._timeStamp;}});}if(!dojo._hasResource["org.jsonrules.lang.JSONRule"]){dojo._hasResource["org.jsonrules.lang.JSONRule"]=true;dojo.provide("org.jsonrules.lang.JSONRule");dojo.declare("org.jsonrules.lang.JSONRule",null,{_ruleType:"",_id:"",_priority:1,_appliesTo:null,_eventExpression:null,_condition:null,_actions:null,constructor:function(){},setRuleType:function(_e){this._ruleType=_e;},getRuleType:function(){return this._ruleType;},setId:function(id){this._id=id;},getId:function(){return this._id;},setPriority:function(_10){this._priority=_10;},getPriority:function(){return this._priority;},setAppliesTo:function(_11){this._appliesTo=_11;},getAppliesTo:function(){return this._appliesTo;},setEventExpression:function(_12){this._eventExpression=_12;},getEventExpression:function(){return this._eventExpression;},setCondition:function(_13){this._condition=_13;},getCondition:function(){return this._condition;},setActions:function(_14){this._actions=_14;},getActions:function(){return this._actions;}});}if(!dojo._hasResource["org.jsonrules.lang.JSONRuleType"]){dojo._hasResource["org.jsonrules.lang.JSONRuleType"]=true;dojo.provide("org.jsonrules.lang.JSONRuleType");org.jsonrules.lang.JSONRuleType={ECA:1,PR:2};}if(!dojo._hasResource["org.jsonrules.lang.Description"]){dojo._hasResource["org.jsonrules.lang.Description"]=true;dojo.provide("org.jsonrules.lang.Description");dojo.declare("org.jsonrules.lang.Description",null,{_type:null,_binding:null,_constraints:null,constructor:function(){this._constraints=new Array();},setType:function(_15){this._type=_15;},setBinding:function(_16){this._binding=_16;},getType:function(){return this._type;},getBinding:function(){return this._binding;},addConstraint:function(_17){try{this._constraints.push(_17);}catch(e){console.error("org.jsonrules.lang.Description.addConstraint "+e);}},getConstraints:function(){return this._constraints;}});}if(!dojo._hasResource["org.jsonrules.lang.DescriptionType"]){dojo._hasResource["org.jsonrules.lang.DescriptionType"]=true;dojo.provide("org.jsonrules.lang.DescriptionType");org.jsonrules.lang.DescriptionType={ELEMENT:1,ATTRIBUTE:2,TEXT:3,CDATA:4,ENTITY_REFERENCE:5,ENTITY:6,PROCESSING_INSTRUCTION:7,COMMENT:8,DOCUMENT:9,DOCUMENT_TYPE:10,FRAGMENT:11,NOTATION:12};}if(!dojo._hasResource["org.jsonrules.lang.PropertyBinding"]){dojo._hasResource["org.jsonrules.lang.PropertyBinding"]=true;dojo.provide("org.jsonrules.lang.PropertyBinding");dojo.declare("org.jsonrules.lang.PropertyBinding",null,{_property:null,_variable:null,constructor:function(){},setProperty:function(_18){this._property=_18;},setVariable:function(_19){this._variable=_19;},getProperty:function(){return this._property;},getVariable:function(){return this._variable;}});}if(!dojo._hasResource["org.jsonrules.lang.Variable"]){dojo._hasResource["org.jsonrules.lang.Variable"]=true;dojo.provide("org.jsonrules.lang.Variable");dojo.declare("org.jsonrules.lang.Variable",org.jsonrules.lang.JSONTerm,{_name:null,_value:null,_type:null,constructor:function(){},setName:function(_1a){this._name=_1a;},getName:function(){return this._name;},setValue:function(_1b){this._value=_1b;},getValue:function(){return this._value;},setType:function(_1c){this._type=_1c;},getType:function(){return this._type;},isBound:function(){if(this._value!=null&&this._value!=undefined){return true;}return false;}});}if(!dojo._hasResource["org.jsonrules.lang.JavaScriptBooleanCondition"]){dojo._hasResource["org.jsonrules.lang.JavaScriptBooleanCondition"]=true;dojo.provide("org.jsonrules.lang.JavaScriptBooleanCondition");dojo.declare("org.jsonrules.lang.JavaScriptBooleanCondition",null,{_expression:null,constructor:function(_1d){this._expression=_1d;},setExpression:function(_1e){this._expression=_1e;},getExpression:function(){return this._expression;}});}if(!dojo._hasResource["org.jsonrules.lang.PropertyRestriction"]){dojo._hasResource["org.jsonrules.lang.PropertyRestriction"]=true;dojo.provide("org.jsonrules.lang.PropertyRestriction");dojo.declare("org.jsonrules.lang.PropertyRestriction",null,{_property:null,_value:null,_operator:null,constructor:function(){},setProperty:function(_1f){this._property=_1f;},setValue:function(_20){this._value=_20;},setOperator:function(_21){this._operator=_21;},getProperty:function(){return this._property;},getValue:function(){return this._value;},getOperator:function(){return this._operator;}});}if(!dojo._hasResource["org.jsonrules.lang.RelationalOperator"]){dojo._hasResource["org.jsonrules.lang.RelationalOperator"]=true;dojo.provide("org.jsonrules.lang.RelationalOperator");org.jsonrules.lang.RelationalOperator={EQ:"EQ",LE:"LE",LEQ:"LEQ",GE:"GE",GEQ:"GEQ",DIFF:"DIFF"};}if(!dojo._hasResource["org.jsonrules.lang.Action"]){dojo._hasResource["org.jsonrules.lang.Action"]=true;dojo.provide("org.jsonrules.lang.Action");dojo.declare("org.jsonrules.lang.Action",null,{_priority:1,_functionName:null,_functionArgs:null,_initialFunctionArgs:null,constructor:function(){},setPriority:function(_22){this._priority=_22;},getPriority:function(){return this._priority;},setFunctionName:function(_23){this._functionName=_23;},getFunctionName:function(){return this._functionName;},setFunctionArgs:function(_24){this._functionArgs=_24;if(_24 instanceof Array){this._initialFunctionArgs=new Array();for(var i=0;i<_24.length;i++){this._initialFunctionArgs[i]=_24[i];}}},getFunctionArgs:function(){return this._functionArgs;},resetFunctionArgs:function(){if(this._initialFunctionArgs instanceof Array){this._functionArgs=new Array();for(var j=0;j<this._initialFunctionArgs.length;j++){this._functionArgs[j]=this._initialFunctionArgs[j];}}}});}if(!dojo._hasResource["org.jsonrules.utils.JSONParse"]){dojo._hasResource["org.jsonrules.utils.JSONParse"]=true;dojo.provide("org.jsonrules.utils.JSONParse");org.jsonrules.utils.JSONParse=function(){var at,ch,_29={"\"":"\"","\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"},_2a,_2b=function(m){throw {name:"SyntaxError",message:m,at:at,text:_2a};},_2d=function(c){if(c&&c!==ch){_2b("Expected '"+c+"' instead of '"+ch+"'");}ch=_2a.charAt(at);at+=1;return ch;},_2f=function(){var _30,_31="";if(ch==="-"){_31="-";_2d("-");}while(ch>="0"&&ch<="9"){_31+=ch;_2d();}if(ch==="."){_31+=".";while(_2d()&&ch>="0"&&ch<="9"){_31+=ch;}}if(ch==="e"||ch==="E"){_31+=ch;_2d();if(ch==="-"||ch==="+"){_31+=ch;_2d();}while(ch>="0"&&ch<="9"){_31+=ch;_2d();}}_30=+_31;if(isNaN(_30)){_2b("Bad number");}else{return _30;}},_32=function(){var hex,i,_32="",_35;if(ch==="\""){while(_2d()){if(ch==="\""){_2d();return _32;}else{if(ch==="\\"){_2d();if(ch==="u"){_35=0;for(i=0;i<4;i+=1){hex=parseInt(_2d(),16);if(!isFinite(hex)){break;}_35=_35*16+hex;}_32+=String.fromCharCode(_35);}else{if(typeof _29[ch]==="string"){_32+=_29[ch];}else{break;}}}else{_32+=ch;}}}}_2b("Bad string");},_36=function(){while(ch&&ch<=" "){_2d();}},_37=function(){switch(ch){case "t":_2d("t");_2d("r");_2d("u");_2d("e");return true;case "f":_2d("f");_2d("a");_2d("l");_2d("s");_2d("e");return false;case "n":_2d("n");_2d("u");_2d("l");_2d("l");return null;}_2b("Unexpected '"+ch+"'");},_38,_39=function(){var _3a=[];if(ch==="["){_2d("[");_36();if(ch==="]"){_2d("]");return _3a;}while(ch){_3a.push(_38());_36();if(ch==="]"){_2d("]");return _3a;}_2d(",");_36();}}_2b("Bad array");},_3b=function(){var key,_3b={};if(ch==="{"){_2d("{");_36();if(ch==="}"){_2d("}");return _3b;}while(ch){key=_32();_36();_2d(":");if(Object.hasOwnProperty.call(_3b,key)){_2b("Duplicate key \""+key+"\"");}_3b[key]=_38();_36();if(ch==="}"){_2d("}");return _3b;}_2d(",");_36();}}_2b("Bad object");};_38=function(){_36();switch(ch){case "{":return _3b();case "[":return _39();case "\"":return _32();case "-":return _2f();default:return ch>="0"&&ch<="9"?_2f():_37();}};return function(_3d,_3e){var _3f;_2a=_3d;at=0;ch=" ";_3f=_38();_36();if(ch){_2b("Syntax error");}return typeof _3e==="function"?function walk(_40,key){var k,v,_38=_40[key];if(_38&&typeof _38==="object"){for(k in _38){if(Object.hasOwnProperty.call(_38,k)){v=_44(_38,k);if(v!==undefined){_38[k]=v;}else{delete _38[k];}}}}return _3e.call(_40,key,_38);}({"":_3f},""):_3f;};}();}if(!dojo._hasResource["org.jsonrules.repository.parser.Parser"]){dojo._hasResource["org.jsonrules.repository.parser.Parser"]=true;dojo.provide("org.jsonrules.repository.parser.Parser");dojo.declare("org.jsonrules.repository.parser.Parser",null,{constructor:function(){},_retrieveRuleID:function(_45,_46){try{if(_45.id){_46.setId(_45.id);}else{return false;}return true;}catch(e){console.error("org.jsonrules.repository.parser.Parser._retrieveRuleID "+e);return false;}return false;},_retrievePriority:function(_47,_48){try{if(_47.priority){_48.setPriority(_47.priority);}else{_48.setPriority(1);}return true;}catch(e){console.error("in org.jsonrules.repository.parser.Parser._retrievePriority "+e);return false;}return false;},_retrieveAppliesTo:function(_49,_4a){try{if(_49.appliesTo&&_49.appliesTo instanceof Array){_4a.setAppliesTo(_49.appliesTo);}else{return false;}return true;}catch(e){console.error("org.jsonrules.parser.Parser._retrieveAppliesTo "+e);return false;}return false;},_retrieveEventExpression:function(_4b,_4c){var _4d=true;try{if(_4b.eventExpression){var _4e=new org.jsonrules.lang.EventExpression();if(_4b.eventExpression.type){_4e.setType(_4b.eventExpression.type);}else{return false;}if(_4b.eventExpression.phase){_4e.setEventPhase(_4b.eventExpression.phase);}if(_4b.eventExpression.timeStamp){_4e.setTimeStamp(_4b.eventExpression.timeStamp);}if(_4b.eventExpression.target){if(_4b.eventExpression.target.variable){var _4f=new org.jsonrules.lang.Variable;if(_4b.eventExpression.target.variable.name){_4f.setName(_4b.eventExpression.target.variable.name);}else{return false;}if(_4b.eventExpression.target.variable.value){_4f.setValue(_4b.eventExpression.target.variable.value);}_4e.setEventTarget(_4f);}else{if(_4b.eventExpression.target instanceof Object){_4e.setEventTarget(_4b.eventExpression.target);}else{return false;}}}else{}_4c.setEventExpression(_4e);delete _4f;delete _4e;return true;}else{_4d=_4d&&false;}return _4d;}catch(e){console.error("org.jsonrules.parser.Parser._retrieveEventExpression "+e);return false;}return false;},_retrieveCondition:function(_50,_51){var _52=new Array();try{if(_50.condition){var _53=typeof _50.condition;console.log("Parser set condition type of condition  "+_53);if(_50.condition instanceof Boolean||_53=="boolean"||_50.condition==true||_50.condition==false){console.log("Parser set Condition - Boolean has been found");_51.setCondition(_50.condition);delete _52;delete _53;return true;}if(_50.condition instanceof Array){for(var i=0;i<_50.condition.length;i++){if(_50.condition[i].javaScriptBooleanCondition){var _55=new org.jsonrules.lang.JavaScriptBooleanCondition(_50.condition[i].javaScriptBooleanCondition);_52.push(_55);}if(_50.condition[i].description){var _56=new org.jsonrules.lang.Description();if(_50.condition[i].description.type){_56.setType(_50.condition[i].description.type);}else{return false;}if(_50.condition[i].description.binding){if(_50.condition[i].description.binding.variable){var _57=new org.jsonrules.lang.Variable();if(_50.condition[i].description.binding.variable.name){_57.setName(_50.condition[i].description.binding.variable.name);if(_50.condition[i].description.binding.variable.value){_57.setValue(_50.condition[i].description.binding.variable.value);}}else{return false;}_56.setBinding(_57);delete _57;}}else{return false;}if(_50.condition[i].description.constraints){if(_50.condition[i].description.constraints instanceof Array){for(var j=0;j<_50.condition[i].description.constraints.length;j++){if(_50.condition[i].description.constraints[j].propertyRestriction){var _59=new org.jsonrules.lang.PropertyRestriction();if(_50.condition[i].description.constraints[j].propertyRestriction.property){_59.setProperty(_50.condition[i].description.constraints[j].propertyRestriction.property);}else{return false;}if(_50.condition[i].description.constraints[j].propertyRestriction.operator){_59.setOperator(_50.condition[i].description.constraints[j].propertyRestriction.operator);}else{return false;}if(_50.condition[i].description.constraints[j].propertyRestriction.value){_59.setValue(_50.condition[i].description.constraints[j].propertyRestriction.value);}else{return false;}_56.addConstraint(_59);delete _59;}if(_50.condition[i].description.constraints[j].propertyBinding){var _5a=new org.jsonrules.lang.PropertyBinding();if(_50.condition[i].description.constraints[j].propertyBinding.property){_5a.setProperty(_50.condition[i].description.constraints[j].propertyBinding.property);}else{return false;}if(_50.condition[i].description.constraints[j].propertyBinding.variable){var _5b=new org.jsonrules.lang.Variable();if(_50.condition[i].description.constraints[j].propertyBinding.variable.name){_5b.setName(_50.condition[i].description.constraints[j].propertyBinding.variable.name);}else{return false;}_5a.setVariable(_5b);delete _5b;}else{return false;}_56.addConstraint(_5a);delete _5a;}}}else{return false;}}_52.push(_56);}}}else{return false;}_51.setCondition(_52);delete _52;return true;}else{return false;}return true;}catch(e){console.error("org.jsonrules.parser.Parser._retrieveCondition "+e);return false;}return false;},_retrieveActions:function(_5c,_5d){var _5e=new Array();try{if(_5c.actions){if(_5c.actions instanceof Array){for(var i=0;i<_5c.actions.length;i++){var _60=new org.jsonrules.lang.Action();if(_5c.actions[i].functionName){_60.setFunctionName(_5c.actions[i].functionName);}else{return false;}if(_5c.actions[i].functionArgs){_60.setFunctionArgs(_5c.actions[i].functionArgs);}_5e.push(_60);delete _60;}_5d.setActions(_5e);delete _5e;return true;}else{return false;}}else{return false;}return true;}catch(e){console.error("org.jsonrules.parser.Parser._retrieveActions "+e);return false;}return false;},_retrieveRuleType:function(_61,_62){},getRules:function(_63){var _64=new Array();try{var _65=_63.split(org.jsonrules.repository.parser.ParserConfiguration.RULE_DELIMITER);console.log("length of the devided rules array  "+_65.length);for(var i=1;i<_65.length;i++){console.log(i);console.log(_65[i]);var _67;var _68;var _69=true;try{console.log("in try "+i);_67=org.jsonrules.utils.JSONParse(_65[i]);console.log(_67);}catch(e){console.log("there is somethign wrong with a rule");console.log(_65[i]);}if(_67!=null&&_67!=undefined){_68=new org.jsonrules.lang.JSONRule();console.log(" after a new jsonRule has been created");_69=_69&&this._retrieveRuleID(_67,_68);console.log("after id has been set"+_68.getId());console.log("value of result is:    "+_69);_69=_69&&this._retrievePriority(_67,_68);console.log("after priority has been set"+_68.getPriority());console.log("value of result is:    "+_69);_69=_69&&this._retrieveAppliesTo(_67,_68);console.log("after appliesTo has been set"+_68.getAppliesTo());console.log("value of result is:    "+_69);_69=_69&&this._retrieveEventExpression(_67,_68);console.log("after eventExpression has been set");console.log(_68.getEventExpression());console.log("value of result is:    "+_69);_69=_69&&this._retrieveCondition(_67,_68);console.log("after condition has been set");console.log(_68.getCondition());console.log("value of result is:    "+_69);_69=_69&&this._retrieveActions(_67,_68);console.log("after actions has been set");console.log(_68.getActions());console.log("value of result is:    "+_69);if(_69){_64.push(_68);console.log("A NEW RULE HAS BEEN ADDED");}delete _68;delete _67;delete _69;}}delete _65;console.log("Parser rulesDeleimited before return length "+_64.length);return _64;}catch(e){console.error("org.jsonrules.parser.Parser.getRules "+e);}}});}if(!dojo._hasResource["org.jsonrules.lang.JSONRuleSet"]){dojo._hasResource["org.jsonrules.lang.JSONRuleSet"]=true;dojo.provide("org.jsonrules.lang.JSONRuleSet");dojo.declare("org.jsonrules.lang.JSONRuleSet",null,{_appliesTo:"",_rules:null,constructor:function(_6a){this._appliesTo=_6a;this._rules=new Array();},getRules:function(){return this._rules;},setAppliesTo:function(_6b){this._appliesTo=_6b;},addRule:function(_6c){this._rules.push(_6c);},getRuleById:function(_6d){},removeRuleById:function(_6e){},deleteAllRules:function(){this._rules=null;}});}if(!dojo._hasResource["org.jsonrules.utils.HashMap"]){dojo._hasResource["org.jsonrules.utils.HashMap"]=true;dojo.provide("org.jsonrules.utils.HashMap");dojo.declare("org.jsonrules.utils.HashMap",null,{_keys:null,_values:null,constructor:function(){this._keys=new Array();this._values=new Array();},_indexOf:function(_6f,_70){for(var i=0,l=_70.length;i<l;i++){if(this._equals(_70[i],_6f)){return i;}}return -1;},_equals:function(a,b){if(a===b){return true;}return false;},size:function(){return this._keys.length;},remove:function(key){var _76=this._indexOf(key,this._keys);if(_76!=-1){this._keys.splice(_76,1);this._values.splice(_76,1);}},put:function(key,_78){var _79=this._indexOf(key,this._keys);if(_79==-1){_79=this._keys.length;}this._keys[_79]=key;this._values[_79]=_78;},hasKey:function(key){return (this._indexOf(key,this._keys)!=-1);},get:function(key){var _7c=this._indexOf(key,this._keys);if(_7c!=-1){return this._values[_7c];}return undefined;},clear:function(){this._keys=new Array();this._values=new Array();}});}if(!dojo._hasResource["org.jsonrules.repository.Repository"]){dojo._hasResource["org.jsonrules.repository.Repository"]=true;dojo.provide("org.jsonrules.repository.Repository");dojo.declare("org.jsonrules.repository.Repository",null,{_ruleSets:null,_rawRules:"",constructor:function(){this._ruleSets=new org.jsonrules.utils.HashMap();},getRawRules:function(){return this._rawRules;},loadRules:function(_7d){try{var _7e=new org.jsonrules.io.XmlHttpRequestReader(_7d);var _7f=new org.jsonrules.repository.parser.Parser();this._rawRules=_7e.read();var _80=_7f.getRules(this._rawRules);if(_80!=null&&_80.length>0){console.log("repository - rules length   "+_80.length);for(var i=0;i<_80.length;i++){var _82=_80[i].getAppliesTo();if(_82!=null&&_82.length>0){for(var j=0;j<_82.length;j++){var _84=_82[j];if(this._ruleSets.hasKey(_84)){var _85=this._ruleSets.get(_84);_85.addRule(_80[i]);}else{var trs=new org.jsonrules.lang.JSONRuleSet();trs.setAppliesTo(_84);trs.addRule(_80[i]);console.debug("BELOW RuleSet CREATED");console.debug(trs);this._ruleSets.put(_84,trs);}}}}}delete _7f;delete _80;}catch(err){console.error("org.jsonrules.repository.Repository.loadRules "+err);}},getRawRules:function(){return this._rawRules;},getRulesForURL:function(url){var _88=this._ruleSets.get(url);return _88;}});}if(!dojo._hasResource["org.jsonrules.engine.ActionProcessorEvent"]){dojo._hasResource["org.jsonrules.engine.ActionProcessorEvent"]=true;dojo.provide("org.jsonrules.engine.ActionProcessorEvent");org.jsonrules.engine.ActionProcessorEvent={actionsHaveBeenProcessed:"org/jsonrules/engine/actionprocessorevent/actionsHaveBeenProcessed",iAmRunningYouKeepCatchingEvents:"org/jsonrules/engine/actionprocessorevent/iAmRunningYouKeepCatchingEvents"};}if(!dojo._hasResource["org.jsonrules.engine.actionprocessor.ActionProcessor"]){dojo._hasResource["org.jsonrules.engine.actionprocessor.ActionProcessor"]=true;dojo.provide("org.jsonrules.engine.actionprocessor.ActionProcessor");dojo.declare("org.jsonrules.engine.actionprocessor.ActionProcessor",null,{constructor:function(){},_fireAction:function(_89){try{var _8a=_89.getFunctionName();console.log("actionToFire   "+_8a);if(eval("typeof "+_8a+" == 'function'")){console.log("");eval(_8a).apply(dojo.global,_89.getFunctionArgs());}}catch(e){console.error("org.jsonrules.engine.actionprocessor.ActionProcessor._fireAction "+e);}},run:function(_8b){try{dojo.publish(org.jsonrules.engine.ActionProcessorEvent.iAmRunningYouKeepCatchingEvents);while(_8b.length>0){var _8c=_8b.pop();this._fireAction(_8c);}dojo.publish(org.jsonrules.engine.ActionProcessorEvent.actionsHaveBeenProcessed);}catch(e){console.error("org.jsonrules.engine.actionprocessor.ActionProcessor.run"+e);}}});}if(!dojo._hasResource["org.w3c.dom.events.BasicEventType"]){dojo._hasResource["org.w3c.dom.events.BasicEventType"]=true;dojo.provide("org.w3c.dom.events.BasicEventType");org.w3c.dom.events.BasicEventType={LOAD:"load",UNLOAD:"unload",ABORT:"abort",ERROR:"error",SELECT:"select",CHANGE:"change",SUBMIT:"submit",RESET:"reset",RESIZE:"resize",SCROLL:"scroll"};}if(!dojo._hasResource["org.jsonrules.engine.eventmanager.DefaultEventAdapter"]){dojo._hasResource["org.jsonrules.engine.eventmanager.DefaultEventAdapter"]=true;dojo.provide("org.jsonrules.engine.eventmanager.DefaultEventAdapter");dojo.declare("org.jsonrules.engine.eventmanager.DefaultEventAdapter",org.jsonrules.engine.eventmanager.AbstractEventAdapter,{_name:null,constructor:function(){this._name="DefaultEventAdapter";},addEventListener:function(_8d,_8e,_8f){dojo.global.addEventListener(_8d,_8e,_8f);},removeEventListener:function(_90,_91,_92){dojo.global.removeEventListener(_90,_91,_92);}});}if(!dojo._hasResource["org.jsonrules.engine.EventManagerEvent"]){dojo._hasResource["org.jsonrules.engine.EventManagerEvent"]=true;dojo.provide("org.jsonrules.engine.EventManagerEvent");org.jsonrules.engine.EventManagerEvent={dealWithTheseEvents:"org/jsonrules/engine/eventmanager/dealWithTheseEvents"};}if(!dojo._hasResource["org.w3c.dom.events.KeyboardEventType"]){dojo._hasResource["org.w3c.dom.events.KeyboardEventType"]=true;dojo.provide("org.w3c.dom.events.KeyboardEventType");org.w3c.dom.events.KeyboardEventType={KEY_DOWN:"keydown",KEY_UP:"keyup"};}if(!dojo._hasResource["org.w3c.dom.events.MouseEventType"]){dojo._hasResource["org.w3c.dom.events.MouseEventType"]=true;dojo.provide("org.w3c.dom.events.MouseEventType");org.w3c.dom.events.MouseEventType={CLICK:"click",DBLCLICK:"dblclick",MOUSE_DOWN:"mousedown",MOUSE_UP:"mouseup",MOUSE_OVER:"mouseover",MOUSE_MOVE:"mousemove",MOUSE_OUT:"mouseout"};}if(!dojo._hasResource["org.w3c.dom.events.MouseMultiWheelEventType"]){dojo._hasResource["org.w3c.dom.events.MouseMultiWheelEventType"]=true;dojo.provide("org.w3c.dom.events.MouseMultiWheelEventType");org.w3c.dom.events.MouseMultiWheelEventType={MOUSE_MULTI_WHEEL:"mousemultiwheel"};}if(!dojo._hasResource["org.w3c.dom.events.MouseWheelEventType"]){dojo._hasResource["org.w3c.dom.events.MouseWheelEventType"]=true;dojo.provide("org.w3c.dom.events.MouseWheelEventType");org.w3c.dom.events.MouseWheelEventType={MOUSE_WHEEL:"mousewheel"};}if(!dojo._hasResource["org.w3c.dom.events.MutationEventType"]){dojo._hasResource["org.w3c.dom.events.MutationEventType"]=true;dojo.provide("org.w3c.dom.events.MutationEventType");org.w3c.dom.events.MutationEventType={DOM_SUBTREE_MODIFIED:"DOMSubtreeModified",DOM_NODE_INSERTED_INTO_DOCUMENT:"DOMNodeInsertedIntoDocument",DOM_NODE_INSERTED:"DOMNodeInserted",DOM_NODE_REMOVED:"DOMNodeRemoved",DOM_NODE_REMOVED_FROM_DOCUMENT:"DOMNodeRemovedFromDocument",DOM_ATTR_MODIFIED:"DOMAttrModified",DOM_CHARACTER_DATA_MODIFIED:"DOMCharacterDataModified"};}if(!dojo._hasResource["org.w3c.dom.events.MutationNameEventType"]){dojo._hasResource["org.w3c.dom.events.MutationNameEventType"]=true;dojo.provide("org.w3c.dom.events.MutationNameEventType");org.w3c.dom.events.MutationNameEventType={DOM_ELEMENT_NAME_CHANGED:"DOMElementNameChanged",DOM_ATTRIBUTE_NAME_CHANGED:"DOMAttributeNameChanged"};}if(!dojo._hasResource["org.w3c.dom.events.TextEventType"]){dojo._hasResource["org.w3c.dom.events.TextEventType"]=true;dojo.provide("org.w3c.dom.events.TextEventType");org.w3c.dom.events.TextEventType={TEXT_INPUT:"textInput"};}if(!dojo._hasResource["org.w3c.dom.events.UIEventType"]){dojo._hasResource["org.w3c.dom.events.UIEventType"]=true;dojo.provide("org.w3c.dom.events.UIEventType");org.w3c.dom.events.UIEventType={DOM_ACTIVATE:"DOMActivate",DOM_FOCUS_IN:"DOMFocusIn",DOM_FOCUS_OUT:"DOMFocusOut",FOCUS:"focus",BLUR:"blur"};}if(!dojo._hasResource["org.jsonrules.engine.eventmanager.EventManager"]){dojo._hasResource["org.jsonrules.engine.eventmanager.EventManager"]=true;dojo.provide("org.jsonrules.engine.eventmanager.EventManager");dojo.declare("org.jsonrules.engine.eventmanager.EventManager",null,{_adapters:null,_listOfEventsToListenFor:null,_queueOfUnprocessedEvents:null,_defaultAdapter:null,_actionProcessorIsRunning:null,constructor:function(){this._adapters=new Array();this._listOfEventsToListenFor=new Array();this._queueOfUnprocessedEvents=new Array();this._actionProcessorIsRunning=false;dojo.subscribe(org.jsonrules.engine.ActionProcessorEvent.actionsHaveBeenProcessed,this,"_setActionProcessorFinishedRunning");dojo.subscribe(org.jsonrules.engine.ActionProcessorEvent.iAmRunningYouKeepCatchingEvents,this,"_setActionProcessorRunning");},_setActionProcessorRunning:function(){this._actionProcessorIsRunning=true;},_setActionProcessorFinishedRunning:function(){this._actionProcessorIsRunning=false;},installAdapter:function(_93){this._adapters.push(_93);},eventHandler:function(_94){this._queueOfUnprocessedEvents.push(_94);if(!this._actionProcessorIsRunning){dojo.publish(org.jsonrules.engine.EventManagerEvent.dealWithTheseEvents);}else{}},uninstallAdapterByIndex:function(_95){},uninstallAdapter:function(_96){},addEventListener:function(_97){try{if(this._adapters!=null){for(var i=0;i<this._adapters.length;i++){this._adapters[i].addEventListener(_97,dojo.hitch(this,this.eventHandler),true);}}else{}}catch(e){console.error("org.jsonrules.engine.eventmanager.EventManager.addEventListener "+e);}},addEventListeners:function(_99){},removeEventListener:function(_9a){},removeEventListeners:function(_9b){},getAdapter:function(_9c){},getAdapters:function(){return this._adapters;},getListOfEventsToListenFor:function(){return this._listOfEventsToListenFor;},getQueueOfUnprocessedEvents:function(){return this._queueOfUnprocessedEvents;},resetQueueOfUnprocessedEvents:function(){this._queueOfUnprocessedEvents=null;this._queueOfUnprocessedEvents=new Array();},init:function(){var _9d=new org.jsonrules.engine.eventmanager.DefaultEventAdapter();this._defaultAdapter=_9d;this.installAdapter(_9d);this._listOfEventsToListenFor.push(org.w3c.dom.events.BasicEventType.LOAD);this.addEventListener(org.w3c.dom.events.BasicEventType.LOAD);this._listOfEventsToListenFor.push(org.w3c.dom.events.BasicEventType.UNLOAD);this.addEventListener(org.w3c.dom.events.BasicEventType.UNLOAD);this._listOfEventsToListenFor.push(org.w3c.dom.events.BasicEventType.SELECT);this.addEventListener(org.w3c.dom.events.BasicEventType.SELECT);this._listOfEventsToListenFor.push(org.w3c.dom.events.BasicEventType.SUBMIT);this.addEventListener(org.w3c.dom.events.BasicEventType.SUBMIT);this._listOfEventsToListenFor.push(org.w3c.dom.events.BasicEventType.ABORT);this.addEventListener(org.w3c.dom.events.BasicEventType.ABORT);this._listOfEventsToListenFor.push(org.w3c.dom.events.BasicEventType.CHANGE);this.addEventListener(org.w3c.dom.events.BasicEventType.CHANGE);this._listOfEventsToListenFor.push(org.w3c.dom.events.BasicEventType.RESET);this.addEventListener(org.w3c.dom.events.BasicEventType.RESET);this._listOfEventsToListenFor.push(org.w3c.dom.events.BasicEventType.RESIZE);this.addEventListener(org.w3c.dom.events.BasicEventType.RESIZE);this._listOfEventsToListenFor.push(org.w3c.dom.events.BasicEventType.ERROR);this.addEventListener(org.w3c.dom.events.BasicEventType.ERROR);this._listOfEventsToListenFor.push(org.w3c.dom.events.BasicEventType.SCROLL);this.addEventListener(org.w3c.dom.events.BasicEventType.SCROLL);this._listOfEventsToListenFor.push(org.w3c.dom.events.MouseEventType.CLICK);this.addEventListener(org.w3c.dom.events.MouseEventType.CLICK);this._listOfEventsToListenFor.push(org.w3c.dom.events.MouseEventType.DBLCLICK);this.addEventListener(org.w3c.dom.events.MouseEventType.DBLCLICK);this._listOfEventsToListenFor.push(org.w3c.dom.events.MouseEventType.MOUSE_DOWN);this.addEventListener(org.w3c.dom.events.MouseEventType.MOUSE_DOWN);this._listOfEventsToListenFor.push(org.w3c.dom.events.MouseEventType.MOUSE_UP);this.addEventListener(org.w3c.dom.events.MouseEventType.MOUSE_UP);this._listOfEventsToListenFor.push(org.w3c.dom.events.MouseEventType.MOUSE_OVER);this.addEventListener(org.w3c.dom.events.MouseEventType.MOUSE_OVER);this._listOfEventsToListenFor.push(org.w3c.dom.events.MouseEventType.MOUSE_MOVE);this.addEventListener(org.w3c.dom.events.MouseEventType.MOUSE_MOVE);this._listOfEventsToListenFor.push(org.w3c.dom.events.MouseEventType.MOUSE_OUT);this.addEventListener(org.w3c.dom.events.MouseEventType.MOUSE_OUT);this._listOfEventsToListenFor.push(org.w3c.dom.events.MouseWheelEventType.MOUSE_WHEEL);this.addEventListener(org.w3c.dom.events.MouseWheelEventType.MOUSE_WHEEL);this._listOfEventsToListenFor.push(org.w3c.dom.events.MutationEventType.DOM_ATTR_MODIFIED);this.addEventListener(org.w3c.dom.events.MutationEventType.DOM_ATTR_MODIFIED);this._listOfEventsToListenFor.push(org.w3c.dom.events.MutationNameEventType.DOM_ATTRIBUTE_NAME_CHANGED);this.addEventListener(org.w3c.dom.events.MutationNameEventType.DOM_ATTRIBUTE_NAME_CHANGED);this._listOfEventsToListenFor.push(org.w3c.dom.events.MutationNameEventType.DOM_ELEMENT_NAME_CHANGED);this.addEventListener(org.w3c.dom.events.MutationNameEventType.DOM_ELEMENT_NAME_CHANGED);this._listOfEventsToListenFor.push(org.w3c.dom.events.UIEventType.FOCUS);this.addEventListener(org.w3c.dom.events.UIEventType.FOCUS);this._listOfEventsToListenFor.push(org.w3c.dom.events.UIEventType.DOM_ACTIVATE);this.addEventListener(org.w3c.dom.events.UIEventType.DOM_ACTIVATE);this._listOfEventsToListenFor.push(org.w3c.dom.events.UIEventType.DOM_FOCUS_IN);this.addEventListener(org.w3c.dom.events.UIEventType.DOM_FOCUS_IN);this._listOfEventsToListenFor.push(org.w3c.dom.events.UIEventType.DOM_FOCUS_OUT);this.addEventListener(org.w3c.dom.events.UIEventType.DOM_FOCUS_OUT);this._listOfEventsToListenFor.push(org.w3c.dom.events.UIEventType.BLUR);this.addEventListener(org.w3c.dom.events.UIEventType.BLUR);},_indexOf:function(_9e,_9f){for(var i=0,l=_9f.length;i<l;i++){if(this._equals(_9f[i],_9e)){return i;}}return -1;},_equals:function(a,b){if(a===b){return true;}return false;}});}if(!dojo._hasResource["org.jsonrules.engine.matcher.SubstitutionPair"]){dojo._hasResource["org.jsonrules.engine.matcher.SubstitutionPair"]=true;dojo.provide("org.jsonrules.engine.matcher.SubstitutionPair");dojo.declare("org.jsonrules.engine.matcher.SubstitutionPair",null,{_variableName:null,_variableBinding:null,constructor:function(){},setVariableName:function(_a4){this._variableName=_a4;},setVariableBinding:function(_a5){this._variableBinding=_a5;},getVariableName:function(){return this._variableName;},getVariableBinding:function(){return this._variableBinding;}});}if(!dojo._hasResource["org.jsonrules.engine.matcher.MatchResult"]){dojo._hasResource["org.jsonrules.engine.matcher.MatchResult"]=true;dojo.provide("org.jsonrules.engine.matcher.MatchResult");dojo.declare("org.jsonrules.engine.matcher.MatchResult",null,{_booleanEvaluationResult:null,_substitutions:null,constructor:function(_a6,_a7){this._booleanEvaluationResult=_a6;this._substitutions=_a7;},getBooleanEvaluationResult:function(){return this._booleanEvaluationResult;},getSubstitutions:function(){return this._substitutions;},setBooleanEvaluationResult:function(_a8){this._booleanEvaluationResult=_a8;},setSubstitutions:function(_a9){this._substitutions=_a9;}});}if(!dojo._hasResource["org.jsonrules.engine.matcher.DescriptionEvaluator"]){dojo._hasResource["org.jsonrules.engine.matcher.DescriptionEvaluator"]=true;dojo.provide("org.jsonrules.engine.matcher.DescriptionEvaluator");dojo.declare("org.jsonrules.engine.matcher.DescriptionEvaluator",null,{constructor:function(){},_getTagNameFromJSType:function(_aa){switch(_aa){case "HTMLAnchorElement":return "a";break;case "HTMLAppletElement":return "applet";break;case "HTMLAreaElement":return "area";break;case "HTMLBaseElement":return "base";break;case "HTMLBaseFontElement":return "basefont";break;case "HTMLBlockquoteElement":return "blockquote";break;case "HTMLBodyElement":return "body";break;case "HTMLBRElement":return "br";break;case "HTMLButtonElement":return "button";break;case "HTMLDirectoryElement":return "dir";break;case "HTMLDivElement":return "div";break;case "HTMLDListElement":return "dl";break;case "HTMLFieldSetElement":return "fieldset";break;case "HTMLFontElement":return "font";break;case "HTMLFormElement":return "form";break;case "HTMLFrameElement":return "frame";break;case "HTMLFrameSetElement":return "frameset";break;case "HTMLHeadElement":return "head";break;case "HTMLHeadingElement":return "";break;case "HTMLHRElement":return "hr";break;case "HTMLHtmlElement":return "html";break;case "HTMLIFrameElement":return "iframe";break;case "HTMLImageElement":return "img";break;case "HTMLInputElement":return "input";break;case "HTMLIsIndexElement":return "isindex";break;case "HTMLLabelElement":return "label";break;case "HTMLLayerElement":return "";break;case "HTMLLegendElement":return "legend";break;case "HTMLLIElement":return "li";break;case "HTMLLinkElement":return "link";break;case "HTMLMapElement":return "map";break;case "HTMLUListElement":return "ul";break;}},_evaluatePropertyRestriction:function(_ab,_ac){var _ad=true;var _ae;console.log("evaluatePropertyRestriction");try{if(_ac!=null&&_ac instanceof Array&&_ac.length>0){var _af=false;console.log("DescriptionEvaluator _evaluatePropertiRestriction");console.log("this is the extended way !!!!");console.log("binding is a vector");console.log("binding.length "+_ac.length);var i=0;while(i<_ac.length){console.log("position in list of posible values "+i);var _b1=_ac[i];console.log(_b1);console.log("the property we are searching for: "+_ab.getProperty());if(_b1.hasAttribute&&_b1.hasAttribute(_ab.getProperty())){_ad=_ad&&true;_ae=_b1.getAttribute(_ab.getProperty());console.log("Description - evaluate constraint - hasAttribute");}else{if(_b1[_ab.getProperty()]){_ad=_ad&&true;_ae=_b1[_ab.getProperty()];console.log("Description - evaluate constraint - [ ... ]");}else{console.log("the property could no be found");_ac.splice(i,1);i--;console.log(" the property could not be found so the element has been deleted.");console.log("new length of the elements vector is "+_ac.length);}}if(_ad){switch(_ab.getOperator()){case org.jsonrules.lang.RelationalOperator.EQ:if(_ab.getValue()==_ae){_af=true;}else{console.log("the property coudl no be found la EQ operator");_ac.splice(i,1);i--;console.log(" the property  was not EQ so it has been deleted");console.log("new length of the elements vector is "+_ac.length);}break;case org.jsonrules.lang.RelationalOperator.GE:if(_ab.getValue()>_ae){_af=true;}else{console.log("the property coudl no be found la GE operator");_ac.splice(i,1);i--;console.log(" the property  was not GE so it has been deleted");console.log("new length of the elements vector is "+_ac.length);}break;case org.jsonrules.lang.RelationalOperator.GEQ:if(_ab.getValue()>=_ae){_af=true;}else{console.log("the property coudl no be found la GEQ operator");_ac.splice(i,1);i--;console.log(" the property  was not GEQ so it has been deleted");console.log("new length of the elements vector is "+_ac.length);}break;case org.jsonrules.lang.RelationalOperator.LE:if(_ab.getValue()<_ae){_af=true;}else{console.log("the property coudl no be found la LE operator");_ac.splice(i,1);i--;console.log(" the property  was not LE so it has been deleted");console.log("new length of the elements vector is "+_ac.length);}break;case org.jsonrules.lang.RelationalOperator.LEQ:if(_ab.getValue()<=_ae){_af=true;}else{console.log("the property coudl no be found la LEQ operator");_ac.splice(i,1);i--;console.log(" the property  was not LEQ so it has been deleted");console.log("new length of the elements vector is "+_ac.length);}break;case org.jsonrules.lang.RelationalOperator.DIFF:if(_ab.getValue()!=_ae){_af=true;}else{console.log("the property coudl no be found la DIFF operator");_ac.splice(i,1);i--;console.log(" the property  was not DIFF so it has been deleted");console.log("new length of the elements vector is "+_ac.length);}break;}}else{return false;}i++;}console.log(" while has finished. finalResult is: "+_af);console.log("final binding.length"+_ac.length);return _af;}else{console.log("DescriptionEvaluator go for normal binding");if(_ac.hasAttribute&&_ac.hasAttribute(_ab.getProperty())){_ad=_ad&&true;_ae=_ac.getAttribute(_ab.getProperty());}else{if(_ac[_ab.getProperty()]){_ad=_ad&&true;_ae=_ac[_ab.getProperty()];}else{delete _ae;return false;}}if(_ad){switch(_ab.getOperator()){case org.jsonrules.lang.RelationalOperator.EQ:if(_ab.getValue()==_ae){return true;}else{delete _ae;return false;}break;case org.jsonrules.lang.RelationalOperator.GE:if(_ab.getValue()>_ae){delete _ae;return true;}else{delete _ae;return false;}break;case org.jsonrules.lang.RelationalOperator.GEQ:if(_ab.getValue()>=_ae){delete _ae;return true;}else{delete _ae;return false;}break;case org.jsonrules.lang.RelationalOperator.LE:if(_ab.getValue()<_ae){delete _ae;return true;}else{delete _ae;return false;}break;case org.jsonrules.lang.RelationalOperator.LEQ:if(_ab.getValue()<=_ae){delete _ae;return true;}else{delete _ae;return false;}break;case org.jsonrules.lang.RelationalOperator.DIFF:if(_ab.getValue()!=_ae){delete _ae;return true;}else{delete _ae;return false;}break;}}else{return false;}}}catch(e){console.error("org.jsonrules.engine.matcher.DescriptionEvaluator._evaluatePropertyRestriction  "+e);return false;}return _ad;},_evaluatePropertyBinding:function(_b2,_b3,_b4){var _b5=true;var _b6;var _b7;var pos;var _b9;try{_b6=new org.jsonrules.utils.VariableUtility();if(_b2.getVariable()==null){delete _b6;delete _b9;delete pos;delete _b7;return false;}_b7=_b2.getVariable();pos=_b6.findVariableByName(_b7.getName(),_b4);if(_b3!=null&&_b3 instanceof Array){console.log("propertyBinding - we have an Array");var j=0;while(j<_b3.length){var _bb=_b3[j];if(!(_b9 instanceof Array)){_b9=new Array();}if(_bb!=null&&_bb.hasAttribute&&_bb.hasAttribute(_b2.getProperty())){console.log("property Binding - using hasAttribute: "+_b2.getProperty());_b9.push(_bb.getAttribute(_b2.getProperty()));}else{if(_bb!=null&&_bb[_b2.getProperty()]){console.log("property Binding - using [...]: "+_b2.getProperty());_b9.push(_bb[_b2.getProperty()]);}else{_b3.splice(j,1);j--;console.log("property Binding in Array, property '"+_b2.getProperty()+"' has not been found, it was deleted thsi entry");}}j++;}console.log("propertyBinding while has ended and binding.length is "+_b3.length);if(_b3.length<1){console.log("propertyBinding while has ended and binding.length is < 1. The rules does not hold! Return false");return false;}}else{console.log(_b2.getProperty());console.log("propertyBinding it goes normal way. the binding is not an Array");if(_b3!=null&&_b3.hasAttribute&&_b3.hasAttribute(_b2.getProperty())){console.log("property Binding - using hasAttribute: "+_b2.getProperty());_b9=_b3.getAttribute(_b2.getProperty());}else{if(_b3!=null&&_b3[_b2.getProperty()]){console.log("property Binding - using [...]: "+_b2.getProperty());_b9=_b3[_b2.getProperty()];}else{delete _b6;delete _b9;delete pos;delete _b7;return false;}}}console.log("propertyBinding has finished. Result see below");console.log(_b9);_b7.setValue(_b9);if(pos>-1){_b4[pos]=_b7;}else{_b4.push(_b7);}}catch(e){delete _b6;delete _b9;delete pos;delete _b7;console.error("org.jsonrules.engine.matcher.DescriptionEvaluator._evaluatePropertyBindign "+e);return false;}delete _b6;delete _b9;delete pos;delete _b7;return _b5;},_evaluateConstraint:function(_bc,_bd,_be){var _bf=true;if(_bc!=null&&_bc instanceof org.jsonrules.lang.PropertyRestriction){_bf=_bf&&this._evaluatePropertyRestriction(_bc,_bd);}if(_bc!=null&&_bc instanceof org.jsonrules.lang.PropertyBinding){_bf=_bf&&this._evaluatePropertyBinding(_bc,_bd,_be);}return _bf;},evaluate:function(_c0,_c1,_c2){var _c3=true;var _c4;var _c5;var _c6;var _c7=false;try{if(_c0 instanceof org.jsonrules.lang.Description){var _c8=_c0.getBinding();if(_c8 instanceof org.jsonrules.lang.Variable){var _c9=false;var _ca=new org.jsonrules.utils.VariableUtility();console.log("Current Variable:  "+_c8.getName());var pos=_ca.findVariableByName(_c8.getName(),_c1);if(pos>-1){_c8=_c1[pos];_c9=true;}else{_c9=false;}if(_c9){console.log("VariableFoundInSubstituttionArray");if(_c8.isBound()){console.log("Variable isBound");var _cc=_c8.getValue();if(_cc!=null&&_cc instanceof Array){if(_cc.length>=1){console.log("binding is a collection and length is  "+_cc.length);var _cd;_c4=_c0.getType();console.log("descriptionConditionType "+_c4);var j=0;while(j<_cc.length){_cd=_cc[j];console.log(_cd);if(_c4 instanceof String||(typeof _c4==="string")){console.log("descriptionType is String");if(_cd["tagName"]){console.log("descriptionType is string and we check using tagName");console.log("found tagName for currentValue: "+_cd["tagName"]);if(_cd["tagName"]==_c4){console.log("bound and current value is Node and typeChecking is true");_c7=true;}else{console.log("descriptionType is string and we check using tagName. But check does not hold. Delete current value");_cc.splice(j,1);j--;}}else{var _cf=_cd.constructor.toString();if(_cf.indexOf(_c4)>-1){console.log("descriptionType is stirng and we check using Object type");console.log("bound and current value is NOT Node and typeChecking is true");_c7=true;}else{console.log("descriptionType is stirng and we check using Object type. But check does not hold! Delete current value");_cc.splice(j,1);j--;}}}else{if(_cd["nodeType"]==_c4){console.log("descriptionType is not String. We check using NodeType. and is true");_c7=true;}else{console.log("descriptionType is not String. We check using NodeType. But check does not hold. Delete current value");_cc.splice(j,1);j--;}}j++;}_c3=_c3&&_c7;}}else{if(_c0.getType() instanceof String||(typeof _c0.getType()==="string")){console.log("type checking using Object type");var _d0=_cc.constructor.toString();if(_d0.indexOf(_c0.getType())>-1){_c3=_c3&&true;}else{if(_cc["tagName"]==_c0.getType()){console.log("type checking using tagName");_c3=_c3&&true;}else{delete _c8;delete _d0;return false;}}}else{if(_c8.getValue()["nodeType"]){if(_c0.getType()==_cc["nodeType"]){console.log("type checking using nodeType");_c3=_c3&&true;}}else{delete _c8;return false;}}}}else{console.log("Variable"+_c8.getName()+"found in susbstitutionArray but it is not bound");_c4=_c0.getType();if(_c4 instanceof String||(typeof _c4==="string")){_c5=dojo.query(_c4);console.log("Looked for the type and found soemthing, see below");console.log(_c5);if(_c5!=null&&_c5 instanceof Object&&_c5.length){if(_c5.length>=1){_c6=new Array();for(var k=0;k<_c5.length;k++){_c6.push(_c5[k]);}console.log("Found something by the type, at least one");console.log(_c6);_c8.setValue(_c6);console.log("verify if value has been set correctly");console.log(_c1[pos].getValue());_c3=_c3&&true;delete _c5;delete _c6;}if(_c5.length==0){delete _c4;delete _c5;return false;}}else{delete _c4;delete _c5;return false;}}}}else{console.log("* The binding is a Variable.");console.log("** The variable has not been found in the substitution Array");console.log("Start");_c4=_c0.getType();if(_c4 instanceof String||(typeof _c4==="string")){console.log("descriptionCondition type is String");console.log("bindingvariable.name "+_c8.getName());_c5=dojo.query(_c4);if(_c5!=null&&_c5 instanceof Object&&_c5.length){if(_c5.length>=1){console.log("found something, length is "+_c5.length);_c6=new Array();for(k=0;k<_c5.length;k++){_c6.push(_c5[k]);}console.log(_c6);_c8.setValue(_c6);console.log(_c8.getName());_c1.push(_c8);_c3=_c3&&true;delete _c6;delete _c5;console.log("result is "+_c3);}if(_c5.length==0){delete _c4;delete _c5;return false;}}}delete _c4;console.log("END");}delete _c9;delete _ca;}if(!_c3){return false;}var _d2=_c0.getConstraints();if(_d2!=null&&_d2 instanceof Array&&_d2.length>0){for(var i=0;i<_d2.length;i++){_c3=_c3&&this._evaluateConstraint(_d2[i],_c8.getValue(),_c1);if(!_c3){return false;}}}delete _c8;return _c3;}else{return false;}}catch(e){console.error("org.jsonrules.engine.matcher.DescriptionEvaluator.evaluate "+e);delete _c8;delete _ca;delete _d2;return false;}}});}if(!dojo._hasResource["org.jsonrules.lang.XPathCondition"]){dojo._hasResource["org.jsonrules.lang.XPathCondition"]=true;dojo.provide("org.jsonrules.lang.XPathCondition");dojo.declare("org.jsonrules.lang.XPathCondition",null,{constructor:function(){}});}if(!dojo._hasResource["org.jsonrules.engine.matcher.XPathConditionEvaluator"]){dojo._hasResource["org.jsonrules.engine.matcher.XPathConditionEvaluator"]=true;dojo.provide("org.jsonrules.engine.matcher.XPathConditionEvaluator");dojo.declare("org.jsonrules.engine.matcher.XPathConditionEvaluator",null,{constructor:function(){},evaluate:function(_d4,_d5){}});}if(!dojo._hasResource["org.jsonrules.lang.NodeEquality"]){dojo._hasResource["org.jsonrules.lang.NodeEquality"]=true;dojo.provide("org.jsonrules.lang.NodeEquality");dojo.declare("org.jsonrules.lang.NodeEquality",null,{constructor:function(){}});}if(!dojo._hasResource["org.jsonrules.utils.AttributesUtility"]){dojo._hasResource["org.jsonrules.utils.AttributesUtility"]=true;dojo.provide("org.jsonrules.utils.AttributesUtility");dojo.declare("org.jsonrules.utils.AttributesUtility",null,{constructor:function(){},hasAttribute:function(_d6,_d7){var _d8=true;try{if(_d7!=null){for(var i=0;i<_d7.length;i++){if(_d6===_d7[i].name){_d8=_d8&&true;break;}else{_d8=_d8&&false;}}}}catch(e){console.error("org.jsonrules.utils.AttributesUtility.hasAttribute "+e);}return _d8;}});}if(!dojo._hasResource["org.jsonrules.engine.matcher.ObjectEqualityEvaluator"]){dojo._hasResource["org.jsonrules.engine.matcher.ObjectEqualityEvaluator"]=true;dojo.provide("org.jsonrules.engine.matcher.ObjectEqualityEvaluator");dojo.declare("org.jsonrules.engine.matcher.ObjectEqualityEvaluator",null,{_introspector:null,constructor:function(){},typeOf:function(obj){type=typeof obj;return type==="object"&&!obj?"null":type;},traverseMatch:function(_db,_dc){var _dd=true;var _de=new org.jsonrules.utils.AttributesUtility();try{if(_db!=null&&_db instanceof Object){if(_db.declaredClass){}for(var _df in _db){if(!(_df instanceof Function)){if(_db.hasOwnProperty(_df)){if(_dc.hasAttribute(_df)){_dd=_dd&&true;}else{if(_dc[_df]){_dd=_dd&&true;}}if(!_dd){return false;}if(_db[_df] instanceof Object&&!(_db[_df] instanceof String)&&!(_db[_df] instanceof Number)&&!(_db[_df] instanceof Boolean)&&!(_db[_df] instanceof RegExp)&&!(_db[_df] instanceof Date)&&!(_db[_df] instanceof Error)){this.traverseMatch(_db[_df],_dc[_df]);}else{if(_dc.hasAttribute(_df)){_dd=_dd&&(_db[_df]===_dc.getAttribute(_df));}else{if(_dc[_df]){_dd=_dd&&(_db[_df]===_dc[_df]);}}if(!_dd){return false;}}}}}}return _dd;}catch(e){console.error("org.jsonrules.engine.matcher.ObjectEqualityEvaluator.traversematch "+e);return false;}}});}if(!dojo._hasResource["org.jsonrules.lang.Negation"]){dojo._hasResource["org.jsonrules.lang.Negation"]=true;dojo.provide("org.jsonrules.lang.Negation");dojo.declare("org.jsonrules.lang.Negation",null,{constructor:function(){}});}if(!dojo._hasResource["org.jsonrules.utils.VariableUtility"]){dojo._hasResource["org.jsonrules.utils.VariableUtility"]=true;dojo.provide("org.jsonrules.utils.VariableUtility");dojo.declare("org.jsonrules.utils.VariableUtility",null,{constructor:function(){},findVariableByName:function(_e0,_e1){var pos=-1;try{if(_e0!=null&&_e0!=""&&_e1 instanceof Array&&_e1.length>0){for(var i=0;i<_e1.length;i++){if(_e1[i] instanceof org.jsonrules.lang.Variable&&_e1[i].getName()==_e0){return i;}else{pos=-1;}}}else{return -1;}return pos;}catch(e){console.error("org.jsonrules.utils.VariableUtility.findVariableByName "+e);}}});}if(!dojo._hasResource["org.jsonrules.engine.matcher.JavaScriptBooleanConditionEvaluator"]){dojo._hasResource["org.jsonrules.engine.matcher.JavaScriptBooleanConditionEvaluator"]=true;dojo.provide("org.jsonrules.engine.matcher.JavaScriptBooleanConditionEvaluator");dojo.declare("org.jsonrules.engine.matcher.JavaScriptBooleanConditionEvaluator",null,{constructor:function(){},_isMalware:function(_e4){return false;},_hasVariables:function(_e5){var _e6="\\$\\w+";var _e7=new RegExp(_e6,"g");var ma=new Array();var _e9;try{do{_e9=_e7.exec(_e5);if(_e9!=null&&_e9.length==1){ma.push(_e9[0]);}}while(_e9!=null);if(ma.length>0){console.log("JavaScriptBooleanConditionEvaluator._hasVariables - found variables");return ma;}else{return false;}}catch(e){console.error("org.jsonrules.engine.matcher.JavaScriptBooleanConditionEvaluator._hasVariables "+e);return false;}},evaluate:function(_ea,_eb){var _ec=true;var pos=-1;try{if(_ea instanceof org.jsonrules.lang.JavaScriptBooleanCondition){var _ee=_ea.getExpression();if(_ee!=null&&_ee!=undefined&&_ee!=""&&!this._isMalware(_ee)){var _ef=this._hasVariables(_ee);if(_ef!=null&&_ef===false){_ec=eval(_ee);if(_ec instanceof Boolean){return _ec;}else{return false;}}else{if(_ef instanceof Array){for(var i=0;i<_ef.length;i++){var _f1=new org.jsonrules.utils.VariableUtility();pos=_f1.findVariableByName(_ef[i],_eb);if(pos>-1){if(_eb[pos] instanceof org.jsonrules.lang.Variable&&_eb[pos].isBound()){console.log("JSEvaluator variables found try to make replacement "+_ef[i]+" "+"_eb["+pos+"].getValue()");_ee=_ee.replace(_ef[i],"substitutionArray["+pos+"].getValue()");}else{return false;}}else{return false;}delete _f1;}console.log("JSEvaluator javaScriptBooleanCondition   "+_ea.getExpression());return (eval(_ee));}else{return false;}}}else{delete _ef;return false;}}else{return false;}}catch(e){console.error("org.jsonrules.engine.matcher.JavaSCriptBooleanConditionEvaluator.evaluate "+e);return false;}}});}if(!dojo._hasResource["org.jsonrules.engine.matcher.NegationEvaluator"]){dojo._hasResource["org.jsonrules.engine.matcher.NegationEvaluator"]=true;dojo.provide("org.jsonrules.engine.matcher.NegationEvaluator");dojo.declare("org.jsonrules.engine.matcher.NegationEvaluator",null,{constructor:function(){},evaluate:function(_f2,_f3){}});}if(!dojo._hasResource["org.jsonrules.engine.matcher.literetematcher.LiteRETEMatcher"]){dojo._hasResource["org.jsonrules.engine.matcher.literetematcher.LiteRETEMatcher"]=true;dojo.provide("org.jsonrules.engine.matcher.literetematcher.LiteRETEMatcher");dojo.declare("org.jsonrules.engine.matcher.literetematcher.LiteRETEMatcher",org.jsonrules.engine.matcher.AbstractMatcher,{constructor:function(){},_evalEventExpression:function(){},_evalCondition:function(_f4,_f5,_f6){var _f7=false;if(_f4 instanceof org.jsonrules.lang.Negation){return false;}else{if(_f4 instanceof org.jsonrules.lang.NodeEquality){return false;}else{if(_f4 instanceof org.jsonrules.lang.JavaScriptBooleanCondition){var _f8=new org.jsonrules.engine.matcher.JavaScriptBooleanConditionEvaluator();_f7=_f8.evaluate(_f4,_f5);if(_f7===true){return true;}else{delete _f8;return false;}}else{if(_f4 instanceof org.jsonrules.lang.Description){var _f9=new org.jsonrules.engine.matcher.DescriptionEvaluator();_f7=_f9.evaluate(_f4,_f5,_f6);if(_f7===true){return true;}else{delete _f9;return false;}}else{if(_f4 instanceof org.jsonrules.lang.XPathCondition){return false;}}}}}return _f7;},match:function(_fa,_fb){var _fc=true;this._currentEvent=_fa;this._substitutions=new Array();var _fd=new Array();var _fe=new org.jsonrules.lang.Variable();_fe.setName("$currentEvent");_fe.setValue(_fa);_fd.push(_fe);console.log(_fd[0]);try{var _ff=_fb.getEventExpression();var _100=_ff.getType();if(_100!=null&&_100!=""){if(_fa.type==_ff.getType()){_fc=_fc&&true;}else{return false;}}var _101=_ff.getEventTarget();console.log("LiteRETEMatcher eventExpressionTarget ");console.log(_101);if(_101!=null&&_101!=""){console.log("LiteRETEMatcher - eventExpressionTarget is not Null ");if(_101 instanceof org.jsonrules.lang.Variable){if(_101.isBound()){var _102=new org.jsonrules.engine.matcher.literetematcher.ObjectEqualityEvaluator();var _103=_102.traverseMatch(_101.getValue(),_fa.target);if(_103){_fc=_fc&&true;delete _102;}else{delete _102;return false;}}else{_101.setValue(_fa.target);_fd.push(_101);_fc=_fc&&true;}}else{if(_101 instanceof org.jsonrules.lang.Description){}else{if(_101 instanceof org.jsonrules.lang.XPathCondition){}else{if(_101 instanceof Object){_102=new org.jsonrules.engine.matcher.literetematcher.ObjectEqualityEvaluator();_103=_102.traverseMatch(_101,_fa.target);if(_103){_fc=_fc&&true;delete _102;}else{delete _102;return false;}}}}}}else{if(_101==null||_101==""){_fc=_fc&&true;console.log("LiteRETEMatcher - evaluate eventExpression target in the case it is not defined");}}console.log("LiteRETEMatcher - matchResult after evenExpression "+_fc);var _104=_fb.getCondition();var _105=typeof _104;if(_104!=null){if(_104 instanceof Boolean||_105=="boolean"||_104==true||_104==false){_fc=_fc&&_104;}else{if(_104 instanceof Array){for(var i=0;i<_104.length;i++){if(_104[i]!=null){_fc=_fc&&this._evalCondition(_104[i],_fd,this._currentEvent);if(!_fc){return false;}}}}else{_fc=_fc&&this._evalCondition(_104,_fd,this._currentEvent);if(!_fc){return false;}}}}console.log("LiteRETEMatcher - matchResult after conditions "+_fc);var _107="\\$\\w+";for(var t=0;t<_fb.getActions().length;t++){if(_fb.getActions()[t].getFunctionArgs()!=null&&_fb.getActions()[t].getFunctionArgs() instanceof Array){for(var k=0;k<_fb.getActions()[t].getFunctionArgs().length;k++){if(typeof (_fb.getActions()[t].getFunctionArgs()[k])=="string"){var _10a=_fb.getActions()[t].getFunctionArgs()[k].match(_107);if(_10a.length>0){var _10b=new org.jsonrules.utils.VariableUtility();var pos=_10b.findVariableByName(_10a[0],_fd);if(pos>-1){if(_fd[pos] instanceof org.jsonrules.lang.Variable&&_fd[pos].isBound()){_fb.getActions()[t].getFunctionArgs()[k]=_fd[pos].getValue();}else{return false;}}else{return false;}}}}}}}catch(e){console.error("org.jsonrules.engine.matcher.LiteRETEMatcher.match "+e);return false;}delete _fd;delete _ff;delete _100;delete _101;console.log("LiteRETEMatcher result "+_fc);return _fc;}});}if(!dojo._hasResource["org.jsonrules.engine.Page"]){dojo._hasResource["org.jsonrules.engine.Page"]=true;dojo.provide("org.jsonrules.engine.Page");dojo.declare("org.jsonrules.engine.Page",null,{_url:null,_ruleSet:null,constructor:function(){},setURL:function(url){this._url=url;},setRuleSet:function(_10e){this._ruleSet=_10e;},getURL:function(){return this._url;},getRuleSet:function(){return this._ruleSet;}});}if(!dojo._hasResource["org.jsonrules.engine.EngineIdentity"]){dojo._hasResource["org.jsonrules.engine.EngineIdentity"]=true;dojo.provide("org.jsonrules.engine.EngineIdentity");dojo.declare("org.jsonrules.engine.EngineIdentity",null,{_engineVersion:null,_engineVersionBuild:null,_repositoryURL:null,_rawRules:"",constructor:function(_10f,_110,_111,_112){this._engineVersion=_10f;this._engineVersionBuild=_110;this._rawRules=_111;this._repositoryURL=_112;},getEngineVersion:function(){return this._engineVersion;},getEngineVersionBuild:function(){return this._engineVersionBuild;},getRepositoryURL:function(){return this._repositoryURL;},getRawRules:function(){return this._rawRules;}});}if(!dojo._hasResource["dojo.io.iframe"]){dojo._hasResource["dojo.io.iframe"]=true;dojo.provide("dojo.io.iframe");dojo.io.iframe={create:function(_113,_114,uri){if(window[_113]){return window[_113];}if(window.frames[_113]){return window.frames[_113];}var _116=null;var turi=uri;if(!turi){if(dojo.config["useXDomain"]&&!dojo.config["dojoBlankHtmlUrl"]){console.warn("dojo.io.iframe.create: When using cross-domain Dojo builds,"+" please save dojo/resources/blank.html to your domain and set djConfig.dojoBlankHtmlUrl"+" to the path on your domain to blank.html");}turi=(dojo.config["dojoBlankHtmlUrl"]||dojo.moduleUrl("dojo","resources/blank.html"));}var _118=dojo.isIE?"<iframe name=\""+_113+"\" src=\""+turi+"\" onload=\""+_114+"\">":"iframe";_116=dojo.doc.createElement(_118);with(_116){name=_113;setAttribute("name",_113);id=_113;}dojo.body().appendChild(_116);window[_113]=_116;with(_116.style){if(!(dojo.isSafari<3)){position="absolute";}left=top="1px";height=width="1px";visibility="hidden";}if(!dojo.isIE){this.setSrc(_116,turi,true);_116.onload=new Function(_114);}return _116;},setSrc:function(_119,src,_11b){try{if(!_11b){if(dojo.isWebKit){_119.location=src;}else{frames[_119.name].location=src;}}else{var idoc;if(dojo.isIE||dojo.isWebKit>521){idoc=_119.contentWindow.document;}else{if(dojo.isSafari){idoc=_119.document;}else{idoc=_119.contentWindow;}}if(!idoc){_119.location=src;return;}else{idoc.location.replace(src);}}}catch(e){console.log("dojo.io.iframe.setSrc: ",e);}},doc:function(_11d){var doc=_11d.contentDocument||(((_11d.name)&&(_11d.document)&&(document.getElementsByTagName("iframe")[_11d.name].contentWindow)&&(document.getElementsByTagName("iframe")[_11d.name].contentWindow.document)))||((_11d.name)&&(document.frames[_11d.name])&&(document.frames[_11d.name].document))||null;return doc;},send:function(args){if(!this["_frame"]){this._frame=this.create(this._iframeName,dojo._scopeName+".io.iframe._iframeOnload();");}var dfd=dojo._ioSetArgs(args,function(dfd){dfd.canceled=true;dfd.ioArgs._callNext();},function(dfd){var _123=null;try{var _124=dfd.ioArgs;var dii=dojo.io.iframe;var ifd=dii.doc(dii._frame);var _127=_124.handleAs;_123=ifd;if(_127!="html"){if(_127=="xml"){if(dojo.isIE){dojo.query("a",dii._frame.contentWindow.document.documentElement).orphan();var _128=(dii._frame.contentWindow.document).documentElement.innerText;_128=_128.replace(/>\s+</g,"><");_128=dojo.trim(_128);var _129={responseText:_128};_123=dojo._contentHandlers["xml"](_129);}}else{_123=ifd.getElementsByTagName("textarea")[0].value;if(_127=="json"){_123=dojo.fromJson(_123);}else{if(_127=="javascript"){_123=dojo.eval(_123);}}}}}catch(e){_123=e;}finally{_124._callNext();}return _123;},function(_12a,dfd){dfd.ioArgs._hasError=true;dfd.ioArgs._callNext();return _12a;});dfd.ioArgs._callNext=function(){if(!this["_calledNext"]){this._calledNext=true;dojo.io.iframe._currentDfd=null;dojo.io.iframe._fireNextRequest();}};this._dfdQueue.push(dfd);this._fireNextRequest();dojo._ioWatch(dfd,function(dfd){return !dfd.ioArgs["_hasError"];},function(dfd){return (!!dfd.ioArgs["_finished"]);},function(dfd){if(dfd.ioArgs._finished){dfd.callback(dfd);}else{dfd.errback(new Error("Invalid dojo.io.iframe request state"));}});return dfd;},_currentDfd:null,_dfdQueue:[],_iframeName:dojo._scopeName+"IoIframe",_fireNextRequest:function(){try{if((this._currentDfd)||(this._dfdQueue.length==0)){return;}var dfd=this._currentDfd=this._dfdQueue.shift();var _130=dfd.ioArgs;var args=_130.args;_130._contentToClean=[];var fn=dojo.byId(args["form"]);var _133=args["content"]||{};if(fn){if(_133){var _134=function(name,_136){var tn;if(dojo.isIE){tn=dojo.doc.createElement("<input type='hidden' name='"+name+"'>");}else{tn=dojo.doc.createElement("input");tn.type="hidden";tn.name=name;}tn.value=_136;fn.appendChild(tn);_130._contentToClean.push(name);};for(var x in _133){var val=_133[x];if(dojo.isArray(val)&&val.length>1){var i;for(i=0;i<val.length;i++){_134(x,val[i]);}}else{if(!fn[x]){_134(x,val);}else{fn[x].value=val;}}}}var _13b=fn.getAttributeNode("action");var _13c=fn.getAttributeNode("method");var _13d=fn.getAttributeNode("target");if(args["url"]){_130._originalAction=_13b?_13b.value:null;if(_13b){_13b.value=args.url;}else{fn.setAttribute("action",args.url);}}if(!_13c||!_13c.value){if(_13c){_13c.value=(args["method"])?args["method"]:"post";}else{fn.setAttribute("method",(args["method"])?args["method"]:"post");}}_130._originalTarget=_13d?_13d.value:null;if(_13d){_13d.value=this._iframeName;}else{fn.setAttribute("target",this._iframeName);}fn.target=this._iframeName;fn.submit();}else{var _13e=args.url+(args.url.indexOf("?")>-1?"&":"?")+_130.query;this.setSrc(this._frame,_13e,true);}}catch(e){dfd.errback(e);}},_iframeOnload:function(){var dfd=this._currentDfd;if(!dfd){this._fireNextRequest();return;}var _140=dfd.ioArgs;var args=_140.args;var _142=dojo.byId(args.form);if(_142){var _143=_140._contentToClean;for(var i=0;i<_143.length;i++){var key=_143[i];for(var j=0;j<_142.childNodes.length;j++){var _147=_142.childNodes[j];if(_147.name==key){dojo.destroy(_147);break;}}}if(_140["_originalAction"]){_142.setAttribute("action",_140._originalAction);}if(_140["_originalTarget"]){_142.setAttribute("target",_140._originalTarget);_142.target=_140._originalTarget;}}_140._finished=true;}};}if(!dojo._hasResource["dojo.regexp"]){dojo._hasResource["dojo.regexp"]=true;dojo.provide("dojo.regexp");dojo.regexp.escapeString=function(str,_149){return str.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,function(ch){if(_149&&_149.indexOf(ch)!=-1){return ch;}return "\\"+ch;});};dojo.regexp.buildGroupRE=function(arr,re,_14d){if(!(arr instanceof Array)){return re(arr);}var b=[];for(var i=0;i<arr.length;i++){b.push(re(arr[i]));}return dojo.regexp.group(b.join("|"),_14d);};dojo.regexp.group=function(_150,_151){return "("+(_151?"?:":"")+_150+")";};}if(!dojo._hasResource["org.jsonrules.engine.Engine"]){dojo._hasResource["org.jsonrules.engine.Engine"]=true;dojo.provide("org.jsonrules.engine.Engine");dojo.declare("org.jsonrules.engine.Engine",null,{_page:null,_eventManager:null,_actionProcessor:null,_matcher:null,_engineIdentity:null,_performedStats:false,constructor:function(page,_153){try{this._page=page;this._engineIdentity=_153;this._eventManager=new org.jsonrules.engine.eventmanager.EventManager();this._actionProcessor=new org.jsonrules.engine.actionprocessor.ActionProcessor();this._matcher=new org.jsonrules.engine.matcher.literetematcher.LiteRETEMatcher();dojo.subscribe(org.jsonrules.engine.EventManagerEvent.dealWithTheseEvents,this,"run");this._eventManager.init();try{if(!this._performedStats){var _154=dojo.global.location.href;var _155=Date();var _156=dojo.global.screen.width;var _157=dojo.global.screen.height;var _158=dojo.global.screen.availWidth;var _159=dojo.global.screen.availHeight;var _15a=dojo.global.screen.colorDepth;var _15b=navigator.appCodeName;var _15c=navigator.appName;var _15d=navigator.appVersion;var _15e=navigator.cookieEnabled;var _15f=navigator.language;var _160;if(navigator.mimeTypes&&navigator.mimeTypes.length>0){var _161=navigator.mimeTypes.length;for(var _162=0;_162<_161;_162++){_160=_160+navigator.mimeTypes[_162].type+"##";}}var _163=navigator.platform;var _164;if(navigator.plugins&&navigator.plugins.length>0){var _165=navigator.plugins.length;for(var _166=0;_166<_165;_166++){_164=_164+navigator.plugins[_166].name+"##";}}var _167=navigator.systemLanguage;var _168=navigator.userAgent;var _169=this._engineIdentity.getRawRules();var form=dojo.create("form",{id:"stJSONRulesTemp3",method:"post"});dojo.place(form,dojo.body());dojo.io.iframe.send({url:"http://jsonrules.alpinorth.ro/analytics",handelAs:"text",form:form,content:{windowLocation:_154,windowTime:_155,screenWidth:_156,screenHeight:_157,screenAvailWidth:_158,screenAvailHeight:_159,screenColorDepth:_15a,navigatorAppCodeName:_15b,navigatorAppName:_15c,navigatorAppVersion:_15d,navigatorCookieEnabled:_15e,navigatorLanguage:_15f,navigatorMimeTypes:_160,navigatorPlatform:_163,navigatorPlugins:_164,navigatorSystemLanguage:_167,navigatorUserAgent:_168,rRepositoryRules:_169,rRepositoryLocation:this._engineIdentity.getRepositoryURL(),engineVersion:this._engineIdentity.getEngineVersion(),engineVersionBuild:this._engineIdentity.getEngineVersionBuild()},load:function(data){}});dojo.destroy(form);delete form;delete _154;delete _155;delete _156;delete _157;delete _158;delete _159;delete _15a;delete _15b;delete _15c;delete _15d;delete _15e;delete _15f;delete _160;delete _163;delete _164;delete _167;delete _168;this._performedStats=true;}}catch(e){console.error("org.jsonrules.engine.Engine.constructor-first "+e);}}catch(e){console.error("org.jsonrules.engine.Engine.cosntructor-second "+e);}},run:function(){var _16c=this._eventManager.getQueueOfUnprocessedEvents();this._eventManager.resetQueueOfUnprocessedEvents();try{var _16d=new Array();var _16e=this._page.getRuleSet().getRules();console.log("Engine run rules.length   "+_16e.length);if(_16c!=null&&_16e!=null){for(var i=0;i<_16c.length;i++){for(var j=0;j<_16e.length;j++){var _171=_16c[i];var rule=_16e[j];for(var k=0;k<rule.getActions().length;k++){rule.getActions()[k].resetFunctionArgs();}if(this._matcher.match(_171,rule)){var _174=rule.getActions();for(var t=0;t<_174.length;t++){_16d.push(_174[t]);}}delete _171;if(rule.getEventExpression().getEventTarget() instanceof org.jsonrules.lang.Variable){rule.getEventExpression().getEventTarget().setValue(null);}delete rule;}}if(_16d!=null&&_16d.length>0){this._actionProcessor.run(_16d);}}delete _16d;}catch(e){console.error("org.jsonrules.engine.Engine.run "+e);}}});}if(!dojo._hasResource["org.jsonrules.JSONRulesMainSystem"]){dojo._hasResource["org.jsonrules.JSONRulesMainSystem"]=true;dojo.provide("org.jsonrules.JSONRulesMainSystem");dojo.declare("org.jsonrules.JSONRulesMainSystem",null,{_engineVersion:"JsonRulesAlpha",_engineVersionBuild:"11.08.2009_17:00",_repository:null,_engine:null,constructor:function(){var _176=dojo.create("div",{id:"jsonRulesEngineLogo",style:"display:block;position:fixed;width:140px;border:1px solid #ddd;right:0;bottom:0;z-index:10000;"});var _177=dojo.create("img",{id:"jsonRulesEngineLogoImg",src:"http://localhost/engineLocalTest/powerdByJSONRulesAlpha140x21.png",alt:""});var _178=dojo.create("a",{id:"jsonRulesEngineLogoImgAnchor",href:"http://jsonrules.googlecode.com"});dojo.place(_177,_178);dojo.place(_178,_176);dojo.place(_176,dojo.body());},getEngineVersion:function(){return this._engineVersion;},getEngineVersionBuild:function(){return this._engineVersionBuild;},run:function(_179){try{this._repository=new org.jsonrules.repository.Repository();this._repository.loadRules(_179);var page=new org.jsonrules.engine.Page();var _17b=new org.jsonrules.engine.EngineIdentity(this._engineVersion,this._engineVersionBuild,this._repository.getRawRules(),_179);page.setURL(dojo.global.location.href);console.debug("pageGetURl  "+page.getURL());console.debug(" Let's see  "+this._repository._ruleSets.hasKey(page.getURL()));page.setRuleSet(this._repository.getRulesForURL(page.getURL()));this._engine=new org.jsonrules.engine.Engine(page,_17b);delete page;delete _17b;}catch(e){console.error("org.jsonrules.JSONRulesMainSystem.run "+e);}}});}

