function Agent(){}(function(A){A("body").ready(function(){A.history.init(Agent.pageload);A("#tabProviderAbout").click(function(){var B=this.href;B=B.replace(/^.*#/,"");A.history.load(B);return false;});A("#tabProviderInfo").click(function(){var B=this.href;B=B.replace(/^.*#/,"");A.history.load(B);return false;
});});Agent.pageload=function(B){if(B){if(B=="wall"){Agent.loadAgentTabAbout(A("#_provider_id").val());}else{if(B=="info"){Agent.loadAgentTabInfo(A("#_provider_id").val());}}}else{if(A("#box_container_OVERVIEW")!=null&&A("#box_container_OVERVIEW").is("*")){Agent.enableAgentTabInfo(A("#_provider_id").val());
}else{Agent.loadAgentTabInfo(A("#_provider_id").val());}}};Agent.loadAgentAddArticle=function(B){forward.getWidget("article/add?id="+B,function(C){A("#article_add_container").html(C);A("#article_close_link").click(function(){Agent.loadAgentTabAbout(B);});A("#article_content").htmlarea({css:"http://www.globalcampus.com/static/61/css/jhtmlarea/jHtmlArea.Editor.css",toolbar:["p","h2","h3","|","bold","italic","underline","|","orderedList","unorderedList","|","link","unlink","|","image","|","html"]});
A("#article_add_form").validate({rules:{article_title:{required:true,minlength:3,maxlength:100},article_content:{required:true,minlength:3,maxlength:3000}},errorLabelContainer:"#article_add_error",submitHandler:function(D){article.addProviderArticle(A("#_provider_id").val(),A("#_entity_type").val(),A("#article_title").val(),A("#article_content").val(),function(E){Agent.loadAgentTabAbout(A("#_provider_id").val());
});return false;}});});};Agent.loadAgentAddContent=function(B){forward.getWidget("content/add?id="+B,function(C){A("#content_add_container").html(C);A("#content_close_link").click(function(){Agent.loadAgentTabAbout(B);});A("#content_add_form").validate({rules:{content_title:{required:true,minlength:3,maxlength:100},content_url:{required:true,minlength:10,maxlength:100}},errorLabelContainer:"#content_add_error",submitHandler:function(D){content.addProviderVideo(A("#_provider_id").val(),A("#_entity_type").val(),A("#content_title").val(),A("#content_url").val(),function(E){Agent.loadAgentTabAbout(A("#_provider_id").val());
});return false;}});});};Agent.enableAgentTabAbout=function(B){ProviderHelper.enableSuperUserManagement(B);ProviderHelper.enableShareLinks();A(".action_container").show();ReviewHelper.enableSingleReview(B,"#review_container");A("#help_article_link").click(function(){A("#help_article_container").slideToggle("slow");
});A("#add_article_header_link").click(function(){Agent.loadAgentAddArticle(B);});A("#add_article_link").click(function(){Agent.loadAgentAddArticle(B);});A("#add_content_link").click(function(){Agent.loadAgentAddContent(B);});A("#add_content_header_link").click(function(){Agent.loadAgentAddContent(B);
});};Agent.loadAgentTabAbout=function(B){A(".tabProviderAboutItem").attr("id","navOn");A(".tabProviderInfoItem").removeAttr("id");forward.getWidget(A("#_url_prefix").val()+"/about?id="+B,function(C){A("#tab_container").html("");A("#tab_container").append(C);Agent.enableAgentTabAbout(B);});};Agent.loadAgentTabInfo=function(B){A(".tabProviderInfoItem").attr("id","navOn");
A(".tabProviderAboutItem").removeAttr("id");forward.getWidget(A("#_url_prefix").val()+"/info?id="+B,function(C){A("#tab_container").html("");A("#tab_container").append(C);Agent.enableAgentTabInfo(B);});};Agent.enableAgentTabInfo=function(B){ProviderHelper.enableSuperUserManagement(B);ProviderHelper.enableShareLinks();
A(".action_container").show();ProviderHelper.enableBox(A("#_provider_id").val(),"CONTACT");ProviderHelper.enableBox(A("#_provider_id").val(),"OVERVIEW");A("#provider_add_university_link").click(function(){forward.getWidget("agent/add_university",function(C){A("#university_add_container").html(C);A("#university_close_link").click(function(){Agent.loadAgentTabInfo(B);
});A("#university_name").autocomplete("/autocomplete/search",{matchContains:true,extraParams:{type:function(){return"UNIVERSITY";}},formatItem:function(F,E,D){return F[0];},formatResult:function(D){return D[0];}}).result(function(D,F,E){A("#university_id").val(F[2]);});A("#university_add_form").validate({rules:{university_id:{required:true}},errorLabelContainer:"#university_add_error",submitHandler:function(D){agent.addUniversity(A("#_provider_id").val(),A("#university_id").val(),function(E){Agent.loadAgentTabInfo(A("#_provider_id").val());
});return false;}});});});A("#provider_add_country_link").click(function(){forward.getWidget("agent/add_country",function(C){A("#country_add_container").html(C);A("#country_close_link").click(function(){Agent.loadAgentTabInfo(B);});A("#country_add_form").validate({rules:{country_id:{required:true}},errorLabelContainer:"#country_add_error",submitHandler:function(D){agent.addCountry(A("#_provider_id").val(),A("#country_id").val(),function(E){Agent.loadAgentTabInfo(A("#_provider_id").val());
});return false;}});});});A(".delete_country_link").each(function(C,D){A(this).click(function(){var E=A(this).attr("rel");agent.removeAssociation(A("#_provider_id").val(),E,function(F){Agent.loadAgentTabInfo(A("#_provider_id").val());});});});A(".delete_university_link").each(function(C,D){A(this).click(function(){var E=A(this).attr("rel");
agent.removeAssociation(A("#_provider_id").val(),E,function(F){Agent.loadAgentTabInfo(A("#_provider_id").val());});});});};})(jQuery);