function Question(){}(function(A){A("body").ready(function(){if(A("#delete_question_link").is("*")){A("#delete_question_link").click(function(){dialogAction.deleteQuestion(A("#_question_id").val(),function(C){SearchHelper.invokeCampusTalkSearchController("&st="+A("#questionCategory").val(),"",1);window.location=A("#_webapp_path").val()+"/campustalk";
});});}var B=A("#_question_id").val();A("#flag_question_link").click(function(){LoginHelper.loadFlagDialog(B,"MESSAGE",A("#flag_question"));});Question.loadAnswers(B);});Question.loadAnswerDialog=function(B){if(A("#answer_question_dialog").is("*")){var C=A("#question_text_content").text();var D=A("#_question_category").val();
forward.getDialog("default?view=answer_question_dialog&questionId="+B+"&question="+C+"&category="+D,function(E){dwr.util.setValue("answer_question_dialog",E,{escapeHtml:false});A("#answer_question_dialog").dialog({autoOpen:false,resizable:false,modal:true,width:350,height:370,title:A("#answer_question_dialog").attr("title"),overlay:{opacity:0.5,background:"black"}});
A("#answer_question_dialog").dialog("open");A("#answer_question_text").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("#answer_question_dialog_form").validate({rules:{answer_question_text:{required:true,minlength:3,maxlength:1000}},errorLabelContainer:"#answer_question_error_container",submitHandler:function(F){id=A("#_question_id").val();
dialogAction.answerQuestion(id,A("#answer_question_text").val(),function(G){A("#answer_question_dialog").dialog("close");A("#answer_question_dialog").html("");Question.loadAnswers(id);});return false;}});});}};Question.loadAnswers=function(B){forward.getWidget("campustalk/question_answers?id="+B,function(C){dwr.util.setValue("question_answers_container",C,{escapeHtml:false});
A("#answer_question_link").click(function(){Question.loadAnswerDialog(B);});A("#answer_question_link_bottom").click(function(){Question.loadAnswerDialog(B);});A(".flag_answer_link").each(function(D,E){A(this).click(function(){var F=A(this).attr("rel");LoginHelper.loadFlagDialog(F,"MESSAGE",A("#flag_answer_"+F));
});});A(".flag_comment_link").each(function(D,E){A(this).click(function(){var F=A(this).attr("rel");LoginHelper.loadFlagDialog(F,"REVIEW",A("#flag_comment_"+F));});});A(".comment_answer_link").each(function(D,E){A(this).click(function(){var F=A(this).attr("rel");Question.loadAnswerCommentDialog(B,F,A("#answer_text_"+F).text());
});});A(".delete_answer_link").each(function(D,E){A(this).click(function(){var F=A(this).attr("rel");dialogAction.deleteAnswer(F,function(G){Question.loadAnswers(B);});});});A(".delete_comment_link").each(function(D,E){A(this).click(function(){var F=A(this).attr("rel");dialogAction.deleteMessageReview(F,function(G){Question.loadAnswers(B);
});});});A(".continue_conversation_link").each(function(D,E){A(this).click(function(){var F=A("#question_text_content").text();var G=A("#_question_category").val();forward.getDialog("default?view=answer_question_dialog&questionId="+B+"&question="+F+"&category="+G,function(H){dwr.util.setValue("answer_question_dialog",H,{escapeHtml:false});
A("#answer_question_dialog").dialog({autoOpen:false,resizable:false,modal:true,width:350,height:370,title:A("#answer_question_dialog").attr("title"),overlay:{opacity:0.5,background:"black"}});A("#answer_question_dialog").dialog("open");A("#answer_question_dialog_form").validate({rules:{answer_question_text:{required:true,minlength:3,maxlength:1000}},errorLabelContainer:"#answer_question_error_container",submitHandler:function(I){id=A("#_question_id").val();
dialog.answerQuestion(id,A("#answer_question_text").val(),function(J){A("#answer_question_dialog").dialog("close");A("#answer_question_dialog").html("");Question.loadAnswers(id);});return false;}});});});});});};Question.loadAnswerCommentDialog=function(B,D,E){if(A("#answer_comment_dialog").is("*")){var C=A("#_question_category").val();
forward.getDialog("default?view=answer_comment_dialog&questionId="+B+"&answerId="+D+"&question="+E+"&category="+C,function(F){dwr.util.setValue("answer_comment_dialog",F,{escapeHtml:false});A("#answer_comment_dialog").dialog({autoOpen:false,resizable:false,width:350,height:370,modal:true,title:A("#answer_comment_dialog").attr("title"),overlay:{opacity:0.5,background:"black"}});
A("#answer_comment_dialog").dialog("open");A("#answer_comment_dialog_form").validate({rules:{answer_comment_text:{required:true,minlength:3,maxlength:1000}},errorLabelContainer:"#answer_comment_error_container",submitHandler:function(G){dialogAction.commentAnswer(D,A("#answer_comment_text").val(),function(H){A("#answer_comment_dialog").dialog("close");
A("#answer_comment_dialog").html("");Question.loadAnswers(B);});return false;}});});}};})(jQuery);