var gp_editor=!1,debug_area;function debug(d){debug_area||(debug_area=$('<div id="debug" style="position:absolute;top:0;left:0;background:#fff;padding:10px;z-index:99999;border:1px solid #333;max-width:30%;white-space:pre-wrap">').prependTo("body"));debug_area.prepend("<div>"+LOGO(d)+"</div><hr/>")}
function LOGO(d){var i=typeof d,g="\n<br/> ("+i+") ";switch(i){case "object":for(var m in d){g+="\n<b>"+m+"</b> = ";try{g+=d[m].toString().replace(/</g,"&lt;").replace(/>/g,"&gt;")}catch(j){g+=" -- not allowed -- "}}break;default:g+=d}return g}function GetCoords(d){d.hasClass("inner_size")&&(d=d.children(":first"));loc=d.offset();loc.w=d.outerWidth();loc.h=d.outerHeight();return loc}
$(function(){function d(){gplinks.gp_refresh=function(h,e){e.preventDefault();window.location=strip_from(window.location.href,"#")};gplinks.toggle_panel=function(h,e){var b=$("#simplepanel");e.preventDefault();var a="";b.hasClass("min");b.hasClass("minb")?(a="",c=0):b.hasClass("compact")?(a="minb toggledmin",c=3):(a="compact",c=1);b.hasClass("toggledmin")||b.unbind("mouseenter").bind("mouseenter",function(h){b.unbind(h).removeClass("toggledmin")});b.attr("class","keep_viewable "+a);gpui.cmpct=c;$gp.SaveGPUI()};
gplinks.toplink=function(h,a){a.preventDefault();if(!$("#simplepanel").hasClass("compact")){var b=$(this).next(),f=b.is(":visible")&&0<b.height();$("#simplepanel .panelgroup2:visible").slideUp(300);gpui.vis=!1;f||(gpui.vis=h,b.slideDown(300));$gp.SaveGPUI()}};gplinks.collapsible=function(h,a){a.preventDefault();var b=$(this).parent();b.hasClass("one")&&b.hasClass("hidden")?(b.parent().find(".head").addClass("hidden"),b.parent().find(".collapsearea").slideUp(300),b.removeClass("hidden").next().slideDown(300)):
b.toggleClass("hidden").next().slideToggle(300)};gplinks.ajax_box=gplinks.admin_box=function(h,a){a.preventDefault();loading();var b=jPrep(this.href,"gpreq=flush");$.get(b,"",function(a){$gp.AdminBoxC(a);loaded()},"html")};gplinks.gpabox=function(a,e){e.preventDefault();loading();var b=jPrep(this.href)+"&gpx_content=gpabox";$.getJSON(b,ajaxResponse)};gpinputs.gpabox=function(){return $gp.post(this,"gpx_content=gpabox")};$gp.AdminBoxC=function(a,e){$gp.CloseAdminBox();if(""==a)return!1;var b=$(window),
f=Math.round((b.width()-640-40)/2),q=Math.max($(document).height(),i.outerHeight(!0));$gp.div("gp_admin_box1").css({zIndex:11E3,"min-height":q}).stop(!0,!0,!0).fadeTo(0,0).fadeTo(200,0.2);$gp.div("gp_admin_box").css({zIndex:"11001",left:f,top:b.scrollTop()}).stop(!0,!0,!0).fadeIn(400).html('<a class="gp_admin_box_close" name="admin_box_close"></a><div id="gp_admin_boxc" class="'+(e||"")+'" style="width:640px"></div>').find("#gp_admin_boxc").html(a);$(".messages").detach();return!0};$gp.CloseAdminBox=
function(a,e){e&&e.preventDefault();$("#gp_admin_box1").fadeOut();$("#gp_admin_box").fadeOut(300,function(){$("#gp_admin_boxc").hasClass("inline")?$("#gp_admin_boxc").children().appendTo("#gp_hidden"):$("#gp_admin_boxc").children().remove()});"undefined"!==typeof $.fn.colorbox&&$.fn.colorbox.close()};gplinks.admin_box_close=gpinputs.admin_box_close=$gp.CloseAdminBox;gplinks.remote=function(a,e){e.preventDefault();var b=strip_from(window.location.href,"#"),f=jPrep(this.href,"gpreq=body");gpRem&&(f+=
"&in="+encodeURIComponent(b)+"&blink="+encodeURIComponent(gpBLink));b=$(window).height()-130;$gp.AdminBoxC('<iframe src="'+f+'" style="height:'+b+'px;" frameborder="0" />',"iframe")};gpinputs.gpcheck=function(){this.checked?$(this).parent().addClass("checked"):$(this).parent().removeClass("checked")};gpinputs.check_all=function(){$(this).closest("form").find("input[type=checkbox]").prop("checked",this.checked)};$gp.SaveGPUI=function(){l="cmd=savegpui";$.each(gpui,function(a,e){l+="&gpui_"+a+"="+e});
$gp.postC(window.location.href,l)};gplinks.dd_menu=function(a,e){e.preventDefault();$(".messages").detach();var b=this,f=$(this).parent().find(".dd_list");f.show();if(f.find(".selected").length){var q=f.find("ul:first"),g=f.find(".selected").parent().position().top+q.scrollTop()-30;q.scrollTop(g)}$("body").on("click.gp_select",function(a){f.hide();f.off(".gp_select");$("body").off(".gp_select");$(a.target).closest(b).length&&a.stopPropagation()});e.stopPropagation()}}$gp.div=function(a){var e=$("#"+
a);0==e.length&&(e=$('<div id="'+a+'"></div>').appendTo("#gp_admin_html"));return e};if(isadmin){var i=$("body");if("undefined"!=typeof gp_bodyashtml)d();else{var g=function(h){var e,b,f;f=gpui.pw;300>f&&(f=a.outerWidth()-10);e=gpui.pposy;b=gpui.pposx;if(gpui.pdock||0==e&&0==b)b=a.offset(),e=Math.min(300,b.top+5),b=b.left+5;j.css({left:Math.max(10,b),top:Math.max(10,e)});admin_resizable&&j.width(f);gpui.pdock?j.addClass("docked"):j.removeClass("docked");h&&$gp.SaveGPUI()},m,j,a;m=$("#admincontent");
1>m.length||(a=m.parent().parent(),j=m.parent().wrap('<div id="admincontainer" class="gp_floating_area"></div>').parent().appendTo("#gp_admin_html"),$("#gpAfterContent").css("margin-top",j.height()+100),g(!1),SimpleDrag("#admincontent_panel",j,"absolute",function(a){gpui.pposx=a.left;gpui.pposy=a.top;gpui.pdock=!1;g(!0)}),gplinks.gp_docklink=function(a,e){e.preventDefault();gpui.pdock=!gpui.pdock;g(!0)});d();i.addClass("gpAdmin").trigger("AdminReady");window.setTimeout(function(){var a=function(a){a&&
(a.hasClass("gp_editing")||a.removeClass("gp_no_overlay"))},e=function(){if(n){var a=n.offset(),b=n.position(),e=$(window).scrollTop(),a=Math.max(0,e-(a.top-b.top));n.stop(!0,!0,!0).animate({top:a})}},b=function(){g&&window.clearTimeout(g);g=window.setTimeout(function(){f()},200)},f=function(){k=!1;d.find("span").stop(!0,!0,!0).hide(500);var a=d.find("div");a.stop(!0).animate({width:0,height:0},{complete:function(){a.hide()}})},g=!1,d,n=!1,k,r;d=$gp.div("gp_edit_overlay");d.bind("click",function(a){var b=
$(a.target);0<b.filter("a").length&&("gp_overlay_close"==b.attr("name")&&a.preventDefault(),k&&k.addClass("gp_no_overlay"));f()}).bind("mouseleave",function(){b()}).bind("mouseenter",function(){g&&window.clearTimeout(g)});$(".editable_area").bind("mousemove.gp mouseenter.gp",function(b){g&&window.clearTimeout(g);var f=$(this);0<f.parent().closest(".editable_area").length&&b.stopPropagation();if(!(k&&f.attr("id")==k.attr("id"))){k&&a(k);k=f;a:{var j=k,i;if(!j.hasClass("gp_no_overlay")){var b=j.attr("id").substr(13),
m=$("#ExtraEditLnks"+b).find("a");if(0==m.length&&(m=$("#ExtraEditLink"+b),0==m.length))break a;i=GetCoords(j);d.show().css({top:i.top-3,left:i.left-2,width:i.w+6});n?n.stop(!0,!0,!0).show():(n=$("<span>"),r=$("<div>"),d.html(r).append(n));r.stop(!0,!0,!0).css({height:0,width:0});e();m=m.clone(!0).removeClass("ExtraEditLink");n.html('<a class="gp_overlay_expand" name="gp_overlay_close"></a>').unbind("mouseenter").one("mouseenter",function(){j.hasClass("gp_no_overlay")||(n.html('<a class="gp_overlay_expand" name="gp_overlay_close"></a>').stop(!0,
!0,!0).show().append(m).find(".gp_overlay_expand").attr("class","gp_overlay_close"),r.stop(!0,!0,!0).show().delay(200).animate({width:i.w+4,height:i.h+5}))})}}}}).bind("mouseleave",function(){b();a(k)});$(window).scroll(function(){e()});$("#current_page_panel").bind("mouseenter.edb",function(){var a=0,b,e=$(window),h=$("#editable_areas_list").html("");b=$gp.div("gp_edit_box");$("a.ExtraEditLink").clone(!1).attr("class","").css("display","block").show().each(function(){var f,g,d;g=$(this);var n=g.attr("id").substr(13);
d=$("#ExtraEditArea"+n);if(d.hasClass("gp_no_overlay")||0==d.length)return!0;a++;f=this.title.replace(/_/g," ");f=decodeURIComponent(f);15<f.length&&(f=f.substr(0,14)+"...");g.attr("id","editable_mark"+n).text(f).appendTo(h).wrap("<li>").hover(function(){var a=GetCoords(d);b.stop(!0,!0,!0).css({top:a.top-3,left:a.left-2,width:a.w+4,height:a.h+5}).fadeIn();(e.scrollTop()>a.top||e.scrollTop()+e.height()<a.top)&&$("html,body").stop(!0,!0,!0).animate({scrollTop:Math.max(0,a.top-100)},"slow")},function(){b.stop(!0,
!0,!0).fadeOut()}).click(function(){$(this).unbind("mouseenter");window.setTimeout(function(){$(this).remove();b.hide()},100)})})});SimpleDrag("#simplepanel .toolbar, #simplepanel .toolbar a","#simplepanel","fixed",function(a){gpui.tx=a.left;gpui.ty=a.top;$gp.SaveGPUI()},!0);admin_resizable&&SimpleResize("#admincontainer",{min_w:300,finish:function(a,b){gpui.pposx=b;gpui.pw=a;$gp.SaveGPUI()}});$(".in_window").parent().bind("mouseenter",function(){var a=$(this).children(".in_window").css({right:"auto",
left:"100%",top:0});window.setTimeout(function(){var b=a.offset(),e=b.left+a.width(),b=b.top+a.height(),f=$(window);e>f.width()+f.scrollLeft()&&a.css({right:"100%",left:"auto"});e=f.height()+f.scrollTop();b>e&&a.css({top:e+-b-10})},1)})},500);$(document).on("keyup keypress paste change",".show_character_count",function(){$(this).parent().find(".character_count span").html(this.value.length)});window.onbeforeunload=function(){if(gp_editor&&"undefined"!=typeof gp_editor.checkDirty&&gp_editor.checkDirty())return"Unsaved changes will be lost."};
gplinks.inline_edit_generic=function(a,e){e.preventDefault();loading();if("function"==typeof gplinks[a])gplinks[a].call(this,a,e);else{$gp.LoadStyle("/include/css/inline_edit.css");var b=strip_from(this.href,"#"),f=$(this).attr("id").substr(13);script=b+"&cmd=inlineedit&area_id="+f;$.getScript(script,function(a){"false"==a&&(alert(gp_error),loaded())})}};$gp.LoadStyle=function(a){var e=(new Date).getTime();$('<link rel="stylesheet" type="text/css" />').appendTo("head").attr({href:gpBase+a+"?t="+e})};
$gp.Loaded={};$gp.LoadScripts=function(a,e,b){function f(){g--;0==g&&"function"==typeof e&&e.call(this)}var g=a.length,d=(new Date).getTime(),n="";b&&(n=gpBase);$.each(a,function(a,b){b=n+b;$gp.Loaded[b]?f():($gp.Loaded[b]=!0,$.getScript(jPrep(b,"t="+d),function(){f()}))})};$gp.htmlchars=function(a){return $("<a>").text(a||"").html()}}}});
function SimpleDrag(d,i,g,m){function j(b,g){if(b.hasClass("keep_viewable")){var d="fixed"==b.css("position"),h,i={};h=b.position();d&&(h.left-=e.scrollLeft(),h.top-=e.scrollTop());if(g)b.data({gp_left:h.left,gp_top:h.top});else if(d=b.data("gp_left"))h.left=i.left=d,h.top=i.top=b.data("gp_top");d=b.width();b.height();var j=e.height();h.top<a?i.top=a:h.top>j&&(i.top=j+2*a);d=e.width()-d-a;h.left>d&&(i.left=d);(i.left||i.top)&&b.css(i)}}var a=-10,h=$(i),e=$(window),b=$(document);$(d).die("mousedown.sdrag").live("mousedown.sdrag",
function(f){var d,i,j;f.preventDefault();if(!(1>h.length)){var k=h.offset();i=f.clientX-k.left+e.scrollLeft();j=f.clientY-k.top+e.scrollTop();b.bind("mousemove.sdrag",function(b){if(!d){var e=h.offset(),f=h.width(),g=h.height();d=$gp.div("admin_drag_box").css({top:e.top,left:e.left,width:f,height:g})}d.css({left:Math.max(a,b.clientX-i),top:Math.max(a,b.clientY-j)});b.preventDefault();return!1});b.unbind("mouseup.sdrag").bind("mouseup.sdrag",function(f){var k,p,s;b.unbind("mousemove.sdrag mouseup.sdrag");
if(!d)return!1;f.preventDefault();d.remove();d=!1;k=f.clientX-i;p=f.clientY-j;"absolute"==g&&(k+=e.scrollLeft(),p+=e.scrollTop());k=Math.max(a,k);p=Math.max(a,p);s={left:k,top:p};h.css(s).data({gp_left:k,gp_top:p});"function"==typeof m&&m.call(h,s,f);return!1});return!1}});("fixed"==h.css("position")||"fixed"==h.parent().css("position"))&&j(h.addClass("keep_viewable"),!0);e.resize(function(){$(".keep_viewable").each(function(){j($(this),!1)})})}
function RenamePrep(){function d(){j.val().replace(/_/g," ").toLowerCase()!=m?$("#gp_rename_redirect").show(500):$("#gp_rename_redirect").hide(300)}function i(){var a=$("input.title_label").val();$("input.new_title.sync_label").val(g(a));$("input.browser_title.sync_label").val(a);d();return!0}function g(a){a=a.replace(/[\x00-\x1F\x7F]/g,"");a=a.replace(/(\?|\*|:|#)/g,"");a=a.replace(/(<(\/?[a-zA-Z0-9][^<>]*)>)/ig,"");a=a.replace(/[\\]/g,"/");a=a.replace(/^\.+[\/\/]/,"/");a=a.replace(/[\/\/]\.+$/,
"/");a=a.replace(/[\/\/]\.+[\/\/]/g,"/");a=a.replace(/[\/\/]+/g,"/");a="."==a?"":a.replace(/^\/\/*/g,"");return a.replace(/ /g,"_")}var m,j;m=$("#gp_rename_form").find("input[name=old_title]").val().toLowerCase();j=$("input.new_title");i();$("input[disabled=disabled]").each(function(a,d){$(d).fadeTo(400,0.6)});$("input.title_label").bind("keyup change",i);$(".label_synchronize a").click(function(a){a.preventDefault();var a=$(this).closest("td"),d=a.find("a:visible");a.find("a").show();d.hide();d=
a.find("a:visible");d.length&&(d.hasClass("slug_edit")?(a.find("input").addClass("sync_label").prop("disabled","disabled").fadeTo(400,0.6),i()):a.find("input").removeClass("sync_label").prop("disabled","").fadeTo(400,1))});gplinks.showmore=function(a,d){d.preventDefault();$("#gp_rename_table tr").show(500);$(this).parent().remove()};j.bind("keyup change",function(){d()})}
function SimpleResize(d,i){var i=$.extend({},{max_w:1E4,min_w:0,finish:function(){}},i),g=$(d);1>g.length||($handle_areas=$('<span class="gp_admin_resize"></span><span class="gp_admin_resize gp_resize_right"></span>').appendTo(g).bind("mousedown.sres",function(d){var j=d.clientX,a=start_w=g.width(),h=start_l=g.position().left,e=$(this);d.preventDefault();$(document).bind("mousemove.sres",function(b){$("body").disableSelection();b.preventDefault();e.hasClass("gp_resize_right")?a=b.clientX-j+start_w:
(h=b.clientX-j+start_l,a=j-b.clientX+start_w);a=Math.min(i.max_w,a);a=Math.max(i.min_w,a);g.width(a);h=Math.max(0,h);g.css({left:h});return!1}).unbind("mouseup.sres").bind("mouseup.sres",function(b){b.preventDefault();$("body").enableSelection();$(document).unbind("mousemove.sres mouseup.sres");i.finish.call(g,a,h);return!1});return!1}))}$.fn.disableSelection=function(){return $(this).attr("unselectable","on").css("-moz-user-select","none").each(function(){this.onselectstart=function(){return!1}})};
$.fn.enableSelection=function(){return $(this).attr("unselectable","off").css("-moz-user-select","").each(function(){this.onselectstart=function(){return!1}})};