var tabSwitch=function(a){this.init(a)};$.extend(tabSwitch.prototype,{current_tab:"",current_div:"",tabObj:{},content_prefix:"",saveButton_class:"",infodiv:false,ajax_request:false,reload_all:false,init:function(a){this.current_tab=1;this.content_prefix=a.content_prefix||"bkbox_content_";this.saveButton_class=a.saveButton_class||"button_save";this.formelement_class=a.formelement_class||"formelement";this.extra=a.extra;this.initTabs();this.initFirstDiv();this.initSaveButton()},initTabs:function(){var a=1;var b=this;$(".bkbox_menu a").each(function(){b.tabObj[a]={parent:$(this).parent()};a++})},initFirstDiv:function(){if($("div.bkbox div._ac").attr("id")!=undefined){this.current_div=$("div.bkbox div._ac").attr("id").replace(this.content_prefix,"")}},initSaveButton:function(){var a=this;$("#"+this.content_prefix+this.current_div+" div."+this.saveButton_class).click(function(){var d=$(this).attr("file");var c=$(this).attr("mode");var b=$(this).attr("extra");a.submitTabForm(d,b,c)})},initInfoDiv:function(){this.infodiv=false;if($("#"+this.content_prefix+this.current_div+" div:first").attr("class")=="notice_outer"){this.infodiv=$("#"+this.content_prefix+this.current_div+" div:first")}},changeTab:function(e,a,b,c){var d=c||false;if(this.ajax_request!==false){this.ajax_request.abort()}if(this.current_tab!=e){$("#"+this.content_prefix+this.current_div).css("display","none");this.current_div=b;$("#"+this.content_prefix+this.current_div).css("display","inline");this.tabObj[this.current_tab].parent.attr("class","bkbox_menu_link");this.current_tab=e;this.tabObj[this.current_tab].parent.attr("class","bkbox_menu_link_ac")}if(d!==false&&d!="false"){this.loadTabContent(a,c)}},loadTabContent:function(a,c){$("#"+this.content_prefix+this.current_div).html('<img id="progress_src" src="http://img.webme.com/images/progress.gif"/>');var b=this;this.ajax_request=$.post(a,{mode:c,extra:this.extra},function(d){$("#"+b.content_prefix+b.current_div).html(d);this.ajax_request=null})},submitTabForm:function(d,a,c){var e={};var b=this;$("#"+this.content_prefix+this.current_div+" ."+this.formelement_class).each(function(){if($(this).attr("type")=="checkbox"){if($(this).attr("checked")===true){e[$(this).attr("name")]=1}else{e[$(this).attr("name")]=0}}else{e[$(this).attr("name")]=escape(GetHTML($(this).attr("id")))}});e.mode=c,e.extra=a;this.setSpecificExtraVars(a);this.deleteInfoDiv();$("#"+this.content_prefix+this.current_div).prepend('<img id="extra_loading_src" src="http://img.webme.com/images/progress.gif"/>');$.post(d,e,function(f){b.handleResponse(f)})},handleResponse:function(a){$("#extra_loading_src").remove();if(this.reload_all==true){$("#"+this.content_prefix+this.current_div).html(a)}else{$("#"+this.content_prefix+this.current_div).prepend(a)}},deleteInfoDiv:function(){this.initInfoDiv();if(this.infodiv!==false){this.infodiv.remove()}},setSpecificExtraVars:function(a){this.reload_all=false;if(a=="profistats"){if($("#profistatsagb").attr("checked")==true){this.reload_all=true}}}});var menu_lastid=1;var menu_mo_lastid=1;var tabs_lastid=1;var tabs_lastid_inner="tabs_text";function mouseoverbutton(a){$("#button_caption_"+a).css("color","black")}function mouseoutbutton(a){$("#button_caption_"+a).css("color","#6e4b0f")}function bkmenuClick(a){$("#bkbox_menu_li_"+menu_lastid).blur();$("#bkbox_menu_li_"+menu_lastid).attr("class","bkbox_menu_link");$("#bkbox_menu_li_"+a).attr("class","bkbox_menu_link_ac");menu_lastid=a}function tabClick(b,a){if($("#tabs_li_"+b).attr("class")!="tabs_active"){$("#tabs_r_"+b).attr("src","img/tabs_ac_r.gif");$("#tabs_li_"+b).attr("class","tabs_active");$("#tabs_r_"+tabs_lastid).attr("src","img/tabs_r.gif");$("#tabs_li_"+tabs_lastid).attr("class","tabs");tabs_lastid=b;$("#"+tabs_lastid_inner).css("display","none");if(b==1){$("#textarea_"+a).css("display","block");tabs_lastid_inner="textarea_"+a}else{if(b==2){$("#tabs_umfrage").css("display","block");tabs_lastid_inner="tabs_umfrage"}else{if(b==3){$("#tabs_uhr").css("display","block");tabs_lastid_inner="tabs_uhr"}else{if(b==4){$("#tabs_login").css("display","block");tabs_lastid_inner="tabs_login"}else{if(b==5){$("#tabs_topliste").css("display","block");tabs_lastid_inner="tabs_topliste"}}}}}$("#form_row"+a).attr("class","formrow_ac");lastid=a}}function showHideOptions(a,b){if($("#options").css("display")=="none"){$("#options").fadeIn("slow");$("#button_options").attr("class","button_up");$("#button_caption_shadow_2").html(b);$("#button_caption_2").html(b)}else{$("#options").fadeOut("slow");$("#button_options").attr("class","button_down");$("#button_caption_shadow_2").html(a);$("#button_caption_2").html(a)}}function changeCat(a){if(a=="neu"){$("#form_row2_1").css("display","block");$("#form_element2_1").focus()}else{$("#form_row2_1").css("display","none");$("#form_element1").focus()}}function selectPic(b){var a=$("#form_element"+b);if(a.attr("checked")===true){$("#form_row"+b).attr("class","formrow_ac")}else{$("#form_row"+b).attr("class","formrow")}}function selectAll(a){var b=Number(a)+1;if($("#form_element"+b).attr("checked")===true){for(i=1;i<=a;i++){$("#form_element"+i).attr("checked",true);$("#form_row"+i).attr("class","formrow_ac")}}else{for(i=1;i<=a;i++){$("#form_element"+i).attr("checked",false);$("#form_row"+i).attr("class","formrow")}}}function changeAction(a){if(a=="move"){$("#moveform").css("display","block")}else{$("#moveform").css("display","none")}}function picselect(a,b){if(a=="add"){$("#newpic").css("display","block");$("#preview").html("")}else{$("#newpic").css("display","none");$("#preview").html('<div class="img"><img id="preview_pic" src="'+b+a+'" width="112" /></div>')}}function inserttodiv(b,a){$("#"+b).html(a)}function after_update_idplist(){$("#editpage_loading_save_src").attr("src","http://img.webme.com/images/progress.gif")}var idp_liste_vorher;function send_idp_list(){var a=$("#menu_dragme li");var c="";for(var b=0,d=a.length;b<d;b++){if(a[b].id!="menu_link_99999"){c+=a[b].id+"-"}}if(idp_liste_vorher!=c){$.post("editpage.php",{mode:"update_pos",pos_list:escape(c)},function(e){$("#dummy_return").html(e);$("#editpage_loading_save").css("display","none")});$("#editpage_loading_save").css("display","inline");setTimeout(function(){after_update_idplist()},200)}idp_liste_vorher=c}function toggle_header(){$("#header").toggle();$("#menu").toggle()}function selectDropdownOption(b,c){for(var a=0;a<b.options.length;a++){if(b.options[a].value==c){b.options[a].selected=true}else{b.options[a].selected=false}}}function boldit(){if($("#bold").attr("checked")==true){$("#editpage_edit_main_titel").css("font-weight","bold")}else{$("#editpage_edit_main_titel").css("font-weight","normal")}}function italicit(){if($("#italic").attr("checked")==true){$("#editpage_edit_main_titel").css("font-style","italic")}else{$("#editpage_edit_main_titel").css("font-style","normal")}}function underlineit(){if($("#underline").attr("checked")==true){$("#editpage_edit_main_titel").css("text-decoration","underline")}else{$("#editpage_edit_main_titel").css("text-decoration","none")}}function colorizeit(){if($("#colorcheckbox").attr("checked")==true){$("#editpage_edit_main_titel").css("color",$("#textfarbe").val())}else{$("#editpage_edit_main_titel").css("color","")}}function laden_beendet(){fckLoaded=true;$("#editpage_loading").hide();$("#editpage_menu_kat_0").fadeIn("slow")}function makeListSortable(){$("#menu_dragme").sortable({update:function(){send_idp_list()}})}var currentIdp=0;function showEditpageDivs(b,c){var a=parseInt(b);var d=c||false;$("#editpage_progress_image").css("display","none");$("#editor_r .extra"+a).each(function(){$(this).css("display","block")});if(d===true){$("#arrows_table").css("display","none")}if(b!=0){$("#bildwaehler_button").css("position","absolute")}else{$("#bildwaehler_button").css("position","relative")}}function onCompleteLoadingPage(a){$("#editpage_edit_main_titel").css("font-weight","normal");$("#editpage_edit_main_titel").css("font-style","normal");$("#editpage_edit_main_titel").css("text-decoration","none");$("#arrows_table").attr("display","none");$("#editpage_progress_image").css("display","none");jQuery.each(a,function(b,c){if(b=="selectmainidp"){$("#editpage_edit_main_subpage_select").val(c)}if(b=="farbe"){if(c!==""&&c.length>3){$("#colorcheckbox").get(0).checked=true;$("#editpage_edit_main_titel").css("color",c)}else{$("#colorcheckbox").get(0).checked=false;$("#editpage_edit_main_titel").css("color","")}}if(b=="content"){SetHTML(c)}if($("#"+b).get(0)!==undefined){var e=$("#"+b).get(0).tagName.toLowerCase();if(e=="input"){if($("#"+b).attr("type").toLowerCase()=="text"||$("#"+b).attr("type").toLowerCase()=="hidden"){$("#"+b).get(0).value=unescape(c)}else{if($("#"+b).attr("type").toLowerCase()=="checkbox"){switch(b){case"bold":var d=c==1?"bold":"normal";$("#editpage_edit_main_titel").css("font-weight",d);break;case"italic":d=c==1?"italic":"normal";$("#editpage_edit_main_titel").css("font-style",d);break;case"underline":d=c==1?"underline":"none";$("#editpage_edit_main_titel").css("text-decoration",d);break}if(c==1){$("#"+b).get(0).checked=true}else{$("#"+b).get(0).checked=false}}}}else{if(e=="a"){$("#"+b).attr("href","extras.php?mode=edit&extraidp="+c)}else{if(e=="select"){$("#"+b).val(c)}}}}});showEditpageDivs(a.extra)}function disableAllElements(){$("#editor_r div").each(function(){if($(this).attr("class")!="nodisable"){$(this).css("display","none")}})}function changeCurrentIdp(a){if(currentIdp>0&&a!=currentIdp){$("#menu_link_"+currentIdp).css("font-weight","normal")}$("#menu_link_"+a).css("font-weight","bold");currentIdp=a;$("#editpage_edit_main_idp").val(currentIdp)}var ajax_request=false;function loadPageContent(c){newPageMode=false;if(ajax_request!==false){ajax_request.abort()}changeCurrentIdp(c);disableAllElements();$("#editpage_progress_image").css("display","inline");$("#editpage_progress_src").attr("src","http://img.webme.com/images/progress.gif");var b={idp:c,mode:"getPageData"};var a={type:"POST",url:"editpage.php",data:b,success:function(e,d){ajax_request=false;if(d=="timeout"){handleEditpageTimeout(true)}else{onCompleteLoadingPage(e)}},error:function(){$("#editpage_loading_save").css("display","none");ajax_request=false;handleEditpageTimeout(true)},dataType:"json"};$.ajaxSetup({timeout:CONFIG__USERADMIN_AJAX_TIMEOUT});ajax_request=$.ajax(a)}function handleEditpageResponse(a){$("#editpage_message").fadeIn("slow");$("#editpage_message_text").html(a)}var newPageMode=false;function createNewPage(a){newPageMode=true;$("#menu_link_"+currentIdp).css("font-weight","normal");$("#menu_link_99999").css("font-weight","bold");currentIdp=99999;var b={titel:{type:"text",value:unescape(a),id:"editpage_edit_main_titel"},extra:{type:"text",value:0},kommentierbar:{type:"checkbox",value:false},login:{type:"text",value:0},farbe:{type:"text",value:"",id:"textfarbe"},bold:{type:"checkbox",value:false},italic:{type:"checkbox",value:false},underline:{type:"checkbox",value:false},externer_link:{type:"text",value:""},colorcheckbox:{type:"checkbox",value:false},fontweight:{type:"style",attr:"font-weight",value:"normal",id:"editpage_edit_main_titel"},fontstyle:{type:"style",attr:"font-style",value:"normal",id:"editpage_edit_main_titel"},textdecoration:{type:"style",attr:"text-decoration",value:"none",id:"editpage_edit_main_titel"},color:{type:"style",attr:"color",value:"",id:"editpage_edit_main_titel"},extratype:{type:"select",value:0,id:"editpage_edit_main_typ"},idp:{type:"text",value:99999,id:"editpage_edit_main_idp"},subpage:{type:"select",value:0,id:"editpage_edit_main_subpage_select"}};jQuery.each(b,function(c,d){var e=(d.id!==undefined)?d.id:c;if(d.type=="text"){$("#"+e).attr("value",d.value)}else{if(d.type=="checkbox"){$("#"+e).attr("checked",d.value)}else{if(d.type=="style"){$("#"+e).css(d.attr,d.value)}else{if(d.type=="select"){$("#"+e).val(d.value)}}}}});disableAllElements();showEditpageDivs(0,true);SetHTML("")}function changeExtraType(a){disableAllElements();showEditpageDivs(a,newPageMode);$("#extra").get(0).value=a}function toggleeditor(){if($("#editpage_menu_kat_0").css("display")=="none"){$("#editpage_menu_kat_0").css("display","inline");$("#editor_menu").css("width","100px");$("#expand").css("background","url(/img/expand.png)")}else{$("#editpage_menu_kat_0").css("display","none");$("#editor_menu").css("width","1px");$("#expand").css("background","url(/img/collapse.png)")}}function page_save(){if(ajax_request!==false){ajax_request.abort()}$("#editpage_loading_save").css("display","inline");var b={mode:"edit2",content:escape(GetHTML("html")),titel:escape($("#editpage_edit_main_titel").val()),idp:$("#editpage_edit_main_idp").val(),externeurl:escape($("#externeurl").val()),extra:$("#extra").val(),bold:$("#bold").attr("checked"),italic:$("#italic").attr("checked"),underline:$("#underline").attr("checked"),farbe:$("#textfarbe").val(),main:$("#editpage_edit_main_subpage_select").val(),colorcheckbox:$("#colorcheckbox").attr("checked"),kommentierbar:$("#kommentierbar").attr("checked")};if($("#login").val()!="undefined"&&$("#login").val()!=undefined){b.login=$("#login").val()}var a={type:"POST",url:"editpage.php",data:b,success:function(d,c){$("#editpage_loading_save").css("display","none");ajax_request=false;if(c=="timeout"){handleEditpageTimeout()}else{handleEditpageResponse(d)}},error:function(){$("#editpage_loading_save").css("display","none");ajax_request=false;handleEditpageTimeout()}};$.ajaxSetup({timeout:CONFIG__USERADMIN_AJAX_TIMEOUT});ajax_request=$.ajax(a);setTimeout(function(){$("#editpage_loading_save_src").attr("src","http://img.webme.com/images/progress.gif")},200)}function handleEditpageTimeout(a){if(a==true){showEditpageDivs(0)}$("#editpage_message").css("display","inline");$("#editpage_message div").each(function(){$(this).css("display","block")});$("#editpage_message_text").html('<font color="red"><img height="16" width="16" alt="Error" src="http://img.webme.com/images/error.png"/> Error:<br/>Request Timeout</font><br/><br/>')}function makearraytoparams(a){if(a!==""){for(var b=0;b<a.length;b++){a[b][1]=encodeURIComponent(a[b][1]);a[b]=a[b].join("=")}a=a.join("&")}return a}function submit_addpic(){if($("#picselect_"+bildkat).val()=="add"){$("#addpic").submit()}else{InsertHTML('<br /><img src="'+$("#preview_pic").attr("src")+'"/>',$("#insert_pic_to_id").val());$("#bildwaehler").fadeOut("slow")}}function setidpvorher(){idpvorher=-1}function changebildkat(a){bildkat=a;$("#addpic div.picselect").each(function(){$(this).css("display","none")});$("#kat_"+a).css("display","inline")}function GetHTML(b){if(typeof FCKeditorAPI=="undefined"){return $("#"+b).val()}else{var a=FCKeditorAPI.GetInstance(b);if(a!=null){return a.GetXHTML(true)}else{return $("#"+b).val()}}}function InsertHTML(a,c){if(c=="undefined"){c="html"}if(activateFCK==true){var b=FCKeditorAPI.GetInstance(c)}if(b!=null){if(b.EditMode==FCK_EDITMODE_WYSIWYG){b.InsertHtml(a)}else{b.SwitchEditMode();b.InsertHtml(a)}}else{document.getElementById(c).value+=a}}function replace_textareas_with_html(){var b="/js/editor/";var a=new FCKeditor("html");if(screen.width>1100){a.ToolbarSet="Default"}else{a.ToolbarSet="Default_Small"}a.BasePath=b;a.ReplaceTextarea()}var check_content="";var seen_editor_error=0;var show_editor_again=0;var set_content_after_loading="";function FCKeditor_OnComplete(a){laden_beendet();a.Events.AttachEvent("OnFocus",DoSomething);if(show_editor_again==1){set_content_fck(set_content_after_loading);setTimeout("$('#error_message_1').fadeOut('slow');",2000);show_editor_again=0}}function set_content_fck(a){var b=FCKeditorAPI.GetInstance("html");if(b.EditMode==FCK_EDITMODE_WYSIWYG){check_content=a;if($.browser.msie==false&&a.search(/<body/)!=-1){document.getElementById("typ_content").innerHTML='<div id="error_message_1"><b>'+ERROR_NORMAL_EDITOR+'</b></div><div id="typ_content_loaded"><hr / style="margin-top:22px;"><br /><textarea id="html" name="content" style="width:100%;height:300px;">'+a+'</textarea><input type="button" onclick="$(\'#bildwaehler\').fadeIn(\'slow\');" value="'+INSERT_IMAGE+'"></div>';document.getElementById("editpage_progress_image").style.display="none";show_editor_again=1}else{b.SetHTML(a)}}else{b.SwitchEditMode();b.SetHTML(a)}}function DoSomething(){return}function SetHTML(a,b){if(activateFCK==false){a=unescape(a);$("#html").val(a)}else{if(show_editor_again==1){if(a.search(/<body/)!=-1){$("#html").val(a)}else{$("#error_message_1").html("<b>"+BITTE_WARTEN_INITIALISIERE+"</b>");set_content_after_loading=a;replace_textareas_with_html()}}else{set_content_fck(a)}}};