﻿function BL_GUI_CheckAjax(){if(typeof BL_GUI=='undefined'){BL_GUI_CheckAjax.delay(0.5);}else{BL_GUI_InitGUIAjax();}}
function BL_GUI_InitGUIAjax(){if(typeof BL_GUI!='undefined'){BL_GUI.SFAjaxCall();}}
function BL_GUI_CheckValidations(){for(var i=0;i<=BL_GUI_ValidArray.length-1;i++){new BL_GUI_ValidArray[i];}}
function BL_GUI_callValue(v){this.UserID=CallSINIMethod("GetValue",["SystemProperty","LoggedOnUserID",""]);this.v=CallSINIMethod("GetValue",["UserField",v,this.UserID]);if(typeof this.v!=="undefined"){return this.v;}else{return"";}}
function BL_GUI_callDocValue(v){this.DocID=CallSINIMethod("GetValue",["SystemProperty","CurrentUserDocument",""]);this.v=CallSINIMethod("GetValue",["VariableValue",v,this.DocID]);if(typeof this.v!=="undefined"){return this.v;}else{return"";}}
function BL_GUI_callDocVar(v){this.DocID=CallSINIMethod("GetValue",["SystemProperty","CurrentUserDocument",""]);this.v=CallSINIMethod("GetValue",["DocumentProperty",v,this.DocID]);if(typeof this.v!=="undefined"){return this.v;}else{return"";}}
function BL_GUI_callOrderValue(v){this.OrderID=CallSINIMethod("GetValue",["SystemProperty","PendingOrder",""]);this.v=CallSINIMethod("GetValue",["OrderProperty",v,this.OrderID]);if(typeof this.v!=="undefined"){return this.v;}else{return"";}}
function BL_GUI_gID(){this.UserID=CallSINIMethod("GetValue",["SystemProperty","LoggedOnUserID",""]);return this.UserID;}
function BL_GUI_getStep(){var ActTabPath=BL_GUI_GetCookieValue(BL_cfg["TabPathCookieKey"]);if(ActTabPath){var ArrTabPath=ActTabPath.split(".");return ArrTabPath[1];}else{return false;}}
function BL_GUI_setStep(NewStep){var ActTabPath=BL_GUI_GetCookieValue(BL_cfg["TabPathCookieKey"]);if(ActTabPath){var ArrTabPath=ActTabPath.split(".");ArrTabPath[1]=parseInt(NewStep);var NewTabPath=ArrTabPath[0]+"."+ArrTabPath[1];BL_GUI_SetCookie(BL_cfg["TabPathCookieKey"],NewTabPath);return true;}else{return false;}}
function BL_GUI_setTabPath(Level,Value){var ActTabPath=BL_GUI_GetCookieValue(BL_cfg["TabPathCookieKey"]);if(ActTabPath){var ArrTabPath=ActTabPath.split(".");switch(Level){case'top':ArrTabPath[0]=Value;break;case'sub':ArrTabPath[1]=Value;break;}
var NewTabPath=ArrTabPath[0]+"."+ArrTabPath[1];BL_GUI_SetCookie(BL_cfg["TabPathCookieKey"],NewTabPath);}}
function BL_GUI_getTabPath(){if(FormGetField(BL_cfg["TabPath"])){var ActTabPath=FormGetFieldValue(BL_cfg["TabPath"]);var ArrTabPath=ActTabPath.split(".");return ArrTabPath;}else{return false;}}
function BL_GUI_SetCookie(key,value){if(typeof key!='undefined'&&typeof value!='undefined'){document.cookie=key+"="+value;return true;}else{return false;}}
function BL_GUI_GetCookieValue(key){var CE=document.cookie.split(";");var CEArr;for(var i=0;i<=CE.length-1;i++){CEArr=CE[i].split("=");if(CEArr[0].strip()==key){return CEArr[1];}}
return false;}
function clog2(h,isSystem){(typeof isSystem=="undefined")?isSystem=false:"";if(typeof console!='undefined'){if(isSystem&&BL_cfg["DebugSystemMsg"]!==true){}else{if(isSystem&&BL_cfg["DebugSystemMsg"]){console.log("#BitsLib> "+h);}else if(BL_cfg["DebugMode"]){console.log("#> "+h);}}}}
function clog(msg,msgObj,msgType,BL_Obj){var valid=false;(BL_cfg["DebugMode"])?valid=true:"";if(typeof BL_GUI!=="undefined"){for(var i=0;i<BL_cfg["D"].length;i++){if(BL_cfg["D"][i]==BL_GUI.UserID){var valid=true;}}}
if(valid){(typeof msg==="undefined")?this.msg="":this.msg=msg;(typeof msgObj==="undefined")?this.msgObj=false:this.msgObj=msgObj;(typeof msgType==="undefined")?this.msgType=false:this.msgType=msgType;if(typeof console!=="undefined"){switch(this.msgObj){case"sys":if(BL_cfg["Debug_System"]){clogCreate(this.msg,this.msgType);}
break;case"element":if(BL_cfg["Debug_Elements"]){clogCreate(this.msg,this.msgType);}
break;case"ajax":if(BL_cfg["Debug_AJAX"]){clogCreate(this.msg,this.msgType);}
break;case"custom":if(BL_cfg["Debug_Custom"]){clogCreate(this.msg,this.msgType);}
break;default:clogCreate(this.msg,this.msgType);break;}}}}
function clogCreate(msg,msgType){switch(msgType){case"error":console.error(msg);break;case"info":console.info(msg);break;case"debug":console.debug(msg);break;case"warn":console.warn(msg);break;default:console.log(msg);break;}}
function BL_GUI_CheckFFValid(){var valid=true;var val=BL_GUI_ValidArray;BL_GUI_ValidMsg.clear();for(var i=0;i<=val.length-1;i++){if(val[i]()!=true){valid=false;}}
if(valid){__doPostBack('StepArea$StepNextN2$TheLabelButton','');}else{BL_GUI_ValidationPopup=new BL_GUI_Popup({id:'Validation',CorrectionX:0,WindowWidth:"500px",WindowHeight:"300px",MakeDraggable:true,title:"Es wurden Pflichtangaben nicht ausgef&uuml;llt.",AddContentStyle:""});var ErrMsg="";ErrMsg+="<div class='BL_GUI_Text_Reg12' style='margin: 0 0 20px 0;'>Um Fortzufahren korrigieren Sie bitte folgende Angaben:</div>";for(var i=0;i<BL_GUI_ValidMsg.length;i++){ErrMsg+="<div class='BL_GUI_Validation_LineWrapper'><div class='BL_GUI_Validation_LineIcon'></div>"+BL_GUI_ValidMsg[i]+"</div><br />";ErrMsg+="<div style='display: block; margin: 10px 0 0 0;'></div>";}
ErrMsg+="<input type='button' class='BL_GUI_BUTTON14' style='display: block; margin: 20px auto;' value='Jetzt korrigieren' id='BL_GUI_ValidationSubmiter'/>";BL_GUI_ValidationPopup.UpdateHTML(ErrMsg);BL_GUI_ValidationPopup.show();$('BL_GUI_ValidationSubmiter').observe("click",function(){BL_GUI_ValidationPopup.hide();});}}
function BL_GUI_EntityReplace(v){var a=BL_cfg["EntitiyReplace"];var html=v;for(x in a){if(typeof a[x]!="function"){var t=RegExp.escape(x);var reg=new RegExp(t,"g");html=html.replace(reg,a[x]);}}
return html;}
function BL_GUI_EntityRestore(v){var a=BL_cfg["EntitiyReplace"];var html=v;for(x in a){if(typeof a[x]!="function"){var t=RegExp.escape(a[x]);var reg=new RegExp(t,"g");html=html.replace(reg,x);}}
return html;}
function BL_GUI_ExecSFAction(partialID){if(typeof partialID==="string"&&partialID.length>5){eval($$('a[id*="'+partialID+'"]')[0].href);}}
function BL_GUI_Update(urlExtra,forceSynchronous){PFSF_AjaxUpdateForm();}
function BL_GUI_GetRealWidth(ElementID){if(typeof ElementID!=="undefined"){return ElementID.getWidth()-parseInt(ElementID.getStyle("paddingLeft"))-parseInt(ElementID.getStyle("paddingRight"))-2;}else{return 0;}}
function RE_BackjumpFromTBNavi(obj){if($('BL_GUI_PreviewNaviThumbnail_'+(obj.FromThumbnail-1))){$('BL_GUI_PreviewNaviThumbnail_'+(obj.FromThumbnail-1)).stopObserving("click",RE_BackJump);$('BL_GUI_PreviewNaviThumbnail_'+(obj.FromThumbnail-1)).observe("click",RE_BackJump.curry(obj.InMainTab,obj.InSubTabID,obj.InSubTab));}}
function RE_BackJump(MainTab,SubTab,SubTabNo){BL_GUI.BL_TAB_TopLevel.setActiveTab((MainTab-1));if(SubTab!==false){BL_GUI.Elements[SubTab].Tab.setActiveTab((SubTabNo-1));}}
function BL_GetParam(p){var s=window.location.href.split("?");var params=s[1].split(/\&/);var returnValue="";if(params.length>0){for(x in params){if(typeof params[x]!=="function"){if(params[x].split("=")[0]==p){returnValue=params[x].split("=")[1];}}}}
return returnValue;}
var BL_AJAXUPDATE=Class.create({initialize:function(options){this.options=Object.extend({},options||{});this.SFSection=$$('form')[0].readAttribute("action");clog("[BL_AJAX] init...","ajax","info");this.init();clog("[BL_AJAX] ready!","ajax","info");},init:function(){if(typeof this.SFSection!=="undefined"){if(this.SFSection.search(/^UserEditFormFilling.aspx/)!==-1){this.overwriteSFUpdate();}}},overwriteSFUpdate:function(){eval("window.PFSF_AjaxUpdateForm = function(urlExtra, forceSynchronous){"+"(typeof urlExtra == \"undefined\") ? urlExtra = \"\": \"\";"+"(typeof forceSynchronous == \"undefined\") ? forceSynchronous = false: \"\";"+"BL_AJAX.update_UserEditFormFilling(urlExtra, forceSynchronous);"+"}");eval("function PFSF_ShowHideConditionalFields(){return false;}");},update:function(){if(typeof this.SFSection!=="undefined"){switch(this.SFSection){case"UserEditFormFilling.aspx":this.update_UserEditFormFilling();break;default:PFSF_AjaxUpdateForm();break;}}},update_UserEditFormFilling:function(urlExtra,forceSynchronous){if(typeof BL_GUI!=="undefined"){if(BL_GUI.GUILoaded===false){clog("BL_AJAX] update locked while building GUI.","ajax","info");}else{if(BL_GUI.isUpdating){BL_GUI.updateIsSchedule=true;clog("[BL_AJAX] busy ... skipped and scheduled.","ajax","info");}else{BL_GUI.isUpdating=true;if(urlExtra.substr(0,5)!="quick"){BL_GUI.AjaxWaitCreate();}
clog("[BL_AJAX] init Update ...","ajax","info");if(PFSF_AjaxUrl==""||PFSF_AjaxUrl==undefined||PFSF_AjaxSkip){return false;}
if(PFSF_xmlRequest!=null){PFSF_xmlRequest.abort();}
(typeof urlExtra!="string")?urlExtra="":"";if(urlExtra.substr(0,5)=="quick"){}else{var pleaseWait=PFSF_Find("txtPleaseWait");if(pleaseWait==undefined||pleaseWait==null)
pleaseWait=PFSF_Find("StepArea_txtPleaseWait");if(pleaseWait!=undefined&&pleaseWait!=null){pleaseWait.innerHTML="<span class='previewWaitMessage'><img src='Images/AjaxWait.gif' alt='' height='18' width='18' style='vertical-align: middle;'>&nbsp;"+PFSF_String_PleaseWait+"</span>";}
else{var updateProgress=document.getElementById("updateProgress");if(updateProgress!=undefined&&updateProgress!=null){updateProgress.style.display="";}}}
var req=newHttpRequest();PFSF_xmlRequest=req;req.open("POST",PFSF_AjaxUrl,!forceSynchronous);if(!forceSynchronous){req.onreadystatechange=function(){PFSF_CallHandleAjaxResponse();if(typeof BL_GUI!=="undefined"){for(var i=0;i<BL_GUI.boundAfterAjaxUpdate.length;i++){if(typeof BL_GUI.boundAfterAjaxUpdate[i]==="function"){BL_GUI.boundAfterAjaxUpdate[i]();}}}}}
req.setRequestHeader("Content-Type","application/x-www-form-urlencoded;");req.send(urlExtra+PFSF_ConstructAjaxQuery()+"&changeStamp="+PFSF_changeStamp);if(forceSynchronous)
PFSF_HandleAjaxResponse(true);return true;BL_GUI.SetPreviewSettings();}}}}});if(typeof PFSF_AjaxUpdateForm!=="undefined"){var BL_AJAX=new BL_AJAXUPDATE();}
