var objParams={'params':{}};var jsStorage={_intErrorCount:null,data:{},_init:function(){jsStorage._intErrorCount=0;},set_data:function(in_strArea,in_objData){if("object"==typeof(in_objData)){var objNewData={};var objRefJsStoreDataArea={};if(jsStorage.data[in_strArea]){objRefJsStoreDataArea=jsStorage.data[in_strArea];}jQuery.each(in_objData,function(strDataName,objDataValue){if(typeof(objRefJsStoreDataArea[strDataName])=="object"){if(objRefJsStoreDataArea[strDataName].val==objDataValue.value){return true;}else if(objRefJsStoreDataArea[strDataName].err){delete(objRefJsStoreDataArea[strDataName].err);}objRefJsStoreDataArea[strDataName].val=objDataValue.value;}else{objNewData[strDataName]={"val":objDataValue.value};}});jsStorage.data[in_strArea]=jQuery.extend(jsStorage.data[in_strArea],objNewData);}},remove_data:function(in_strArea,in_strDataName){if("undefined"!=typeof(jsStorage.data[in_strArea])){var objRefJsStoreDataArea=jsStorage.data[in_strArea];if("undefined"!=typeof(objRefJsStoreDataArea[in_strDataName])){delete objRefJsStoreDataArea[in_strDataName];}}},getErrorCount:function(){var error=0;jQuery.each(jsStorage.data,function(strDataAreaName,strDataAreaNode){jQuery.each(strDataAreaNode,function(strDataName,objDataNode){if(undefined!=objDataNode.err){error++;}});});return error;},performJsonResponse:function(in_objJsonReturn){jQuery.each(in_objJsonReturn,function(strDataAreaName,strDataAreaNode){jQuery.each(strDataAreaNode,function(strDataName,objDataNode){var objRefJsStoreDataArea=jsStorage.data[strDataAreaName];if("undefined"!=typeof(objRefJsStoreDataArea[strDataName])){if(strDataAreaNode[strDataName].val==objRefJsStoreDataArea[strDataName].val){if(undefined!=strDataAreaNode[strDataName].err){objRefJsStoreDataArea[strDataName].err=1;}else if(undefined!=objRefJsStoreDataArea[strDataName].err){delete objRefJsStoreDataArea[strDataName].err;}}}});});}};function ajaxModule(){var self=this;var targetId="";var targetType="";var targetCallback="";var targetCallbackParams="";jQuery(document).ajaxStart(function(){var myPos=getElementPosition(targetId);showWaiting((myPos.x+myPos.w),myPos.y);});jQuery(document).ajaxStop(function(){hideWaiting();});this.sendRequest=function(in_hashPostParameters,in_strUrl,in_boolAjaxAsyncReq){if("boolean"!=typeof(in_boolAjaxAsyncReq)){in_boolAjaxAsyncReq="true";}jQuery.ajax({type:"POST",url:in_strUrl,timeout:5000,dataType:"json",async:in_boolAjaxAsyncReq,data:in_hashPostParameters,cache:false,success:function(responseData){processData(responseData.strJsonResponseData);},beforeSend:function(){},error:function(request_object,error_string,exception_object){if(boolTestsystem==true){if("object"==typeof(console)){console.debug(error_string);console.debug(request_object);}}}});};this.setTarget=function(in_strTargetId,in_strTargetCallback,in_strTargetCallbackParams){var strTargetType="";if("undefined"==typeof(in_strTargetCallback)){in_strTargetCallback="";}if("undefined"==typeof(in_strTargetCallbackParams)){in_strTargetCallbackParams="";}if("string"==typeof(in_strTargetId)){if("check_formular_fields"==in_strTargetId){strTargetType='CHECK_FORMULAR';in_strTargetId="";}else if("callback"==in_strTargetId){strTargetType='CALLBACK';in_strTargetId="";}else{if(jQuery("#"+in_strTargetId).length>0){var str_nodeName=jQuery("#"+in_strTargetId).attr("nodeName");switch(str_nodeName){case'SELECT':strTargetType='OPTIONS';break;case'INPUT':case'TEXTAREA':case'SPAN':case'DIV':default:strTargetType='TEXT';break;}}}}targetType=strTargetType;targetId=in_strTargetId;targetCallback=in_strTargetCallback;targetCallbackParams=in_strTargetCallbackParams;};this.getTargetType=function(){return targetType;};function processData(in_strData){switch(targetType){case"TEXT":updateTextNode(targetId,in_strData);break;case"OPTIONS":updateOptions(targetId,in_strData);break;case"CHECK_FORMULAR":updateFormularData(in_strData);break;case"CALLBACK":var strJoinedParams="";if("object"==typeof(targetCallbackParams)){strJoinedParams=targetCallbackParams.join(",");strJoinedParams=","+strJoinedParams;}eval(targetCallback+"("+JSON.stringify(in_strData)+strJoinedParams+")");break;default:if(boolTestsystem==true){if("object"==typeof(console)){console.debug("No targetType specified");}}}}function updateTextNode(tId,strData){if(strData){var objDiv=document.getElementById(tId);var textObj=document.createTextNode(strData);objDiv.appendChild(textObj);document.getElementById(tId).style.visibility="visible";}}function updateOptions(tId,strData){if(strData){var arrOptions=strData.split("\n");var arrOption;jQuery("#"+tId).empty();for(var i=0;i<arrOptions.length;i++){arrOption=arrOptions[i].split('=');jQuery("#"+tId).append("<option title='"+arrOption[0]+"' value='"+arrOption[0]+"'>"+arrOption[1]+"</option>");}if(arrOptions.length<=1){jQuery("#"+tId).attr("disabled","disabled");}else{jQuery("#"+tId).removeAttr("disabled");jQuery("#"+tId).show();}}}function updateFormularData(strData){jsStorage.performJsonResponse(strData.objParams);if(strData){jQuery.each(strData.objParams,function(strAreaName,strAreaNode){jQuery.each(strAreaNode,function(strDataName,strDataNode){if(strDataNode.err){jQuery("#"+strDataName).addClass("error").bind("click focus",function(e){jQuery("#"+strDataName).removeClass("error").unbind("click focus");jQuery("#label_"+strDataName+" > span").remove();});jQuery("#label_"+strDataName+" > span").remove();jQuery("#label_"+strDataName).append("<span class='error'><br />"+strDataNode.err+"</span>");}});});}}}