function file_name_only(b){var a="/";if(b.match(/\\/)){a="\\"}sURL=b.substring(b.lastIndexOf(a)+1);return sURL}function htmlNumbers(d){var c=d;var b=new Array({num:"&#177;",name:String.fromCharCode(177)},{num:"&#8734;",name:String.fromCharCode(8734)},{num:"&#8800;",name:String.fromCharCode(8800)},{num:"&#126;",name:String.fromCharCode(126)},{num:"&#215;",name:String.fromCharCode(215)},{num:"&#247;",name:String.fromCharCode(247)},{num:"&#8804;",name:String.fromCharCode(8804)},{num:"&#8805;",name:String.fromCharCode(8805)},{num:"&#8723;",name:String.fromCharCode(8723)},{num:"&#8773;",name:String.fromCharCode(8773)},{num:"&#8706;",name:String.fromCharCode(8706)},{num:"&#8730;",name:String.fromCharCode(8730)},{num:"&#8594;",name:String.fromCharCode(8594)},{num:"&#8596;",name:String.fromCharCode(8596)},{num:"&#945;",name:String.fromCharCode(945)},{num:"&#946;",name:String.fromCharCode(946)},{num:"&#947;",name:String.fromCharCode(947)},{num:"&#948;",name:String.fromCharCode(948)},{num:"&#949;",name:String.fromCharCode(949)},{num:"&#952;",name:String.fromCharCode(952)},{num:"&#977;",name:String.fromCharCode(977)},{num:"&#956;",name:String.fromCharCode(956)},{num:"&#960;",name:String.fromCharCode(960)},{num:"&#961;",name:String.fromCharCode(961)},{num:"&#963;",name:String.fromCharCode(963)},{num:"&#964;",name:String.fromCharCode(964)},{num:"&#966;",name:String.fromCharCode(966)},{num:"&#969;",name:String.fromCharCode(969)},{num:"&#191;",name:String.fromCharCode(191)});for(var a in b){if(isNumeric(a)){c=c.replace(b[a].name,b[a].num)}}return c}function get_ents(c){var a=document.createElement("pre");var b=c.replace(/\&nbsp\;/gi,"\u00a0");b=document.createTextNode(b);a.appendChild(b);if(a.firstChild==null){return""}else{return a.firstChild.nodeValue}}function checkTextAreaLen(e){var c=e.name;if(c=="question"){var f=$j("#questionCounter");var k=$j("#questionCharactersText");var l=$j("#errorProfanityDescription");l.css({display:"none"});var p=$j("#image-upload-containerQuestion");var j=$j("#image-uploaded-containerQuestion");var d=QUESTION_MAX_CHARACTER_COUNTER}else{if(c=="answer"){var f=$j("#answerCounter");var k=$j("#answerCharactersText");var l=$j("#errorProfanityAnswer");l.html("&nbsp;");l.css({display:"none"});var p=$j("#image-upload-containerAnswer");var j=$j("#image-uploaded-containerAnswer");var d=ANSWER_MAX_CHARACTER_COUNTER}else{if(c="questionDetails"){var f=$j("#questionDetailsCounter");var k=$j("#questionDetailsCharactersText");var l=$j("#errorProfanityDetails");l.css({display:"none"});var d=QUESTIONDETAIL_MAX_CHARACTER_COUNTER}}}var b=$j("#"+c).text();if(BrowserDetect.browser=="Explorer"){var q=new RegExp(String.fromCharCode(13)+String.fromCharCode(10),"gi");b=b.replace(q,"<br><br>");q=/^<p>\&nbsp\;<\/p><br\/?><br\/?><p>\&nbsp\;<\/p>$/i;if(q.test(b)){b="<br><br>"}else{q=/^(<p>\&nbsp\;<\/p><br\/?><br\/?>)+<p>\&nbsp\;<\/p>$/i;if(q.test(b)){b=b.replace(/<p>\&nbsp\;<\/p>$/i,"");b=b.replace(/<br\/?>/gi,"")}else{q=/<br\/?><br\/?><p>\&nbsp\;<\/p>$/i;if(q.test(b)){b=b.replace(q,"<p>&nbsp;</p>")}b=b.replace(/<br\/?><br\/?>/gi,"&nbsp;")}}}var n=b;var h=/^<br\/?><br\/?>$/i;if(h.test(n)){n=n.replace(/<br\/?><br\/?>/gi,"&nbsp;")}else{h=/<br\/?>$/i;if(h.test(n)){n=n.replace(h,"")}h=/<br\/?>/gi;if(h.test(n)){n=n.replace(h,"&nbsp;")}}var g=stripHTML(n);var o=get_ents(g);if(BrowserDetect.browser=="Explorer"){h=/^<p>\&nbsp\;<\/p>$/i;if(h.test(b)){o="";if(c=="question"){$j("#question_rte").contents().find("body").html("")}else{if(c=="answer"){$j("#answer_rte").contents().find("body").html("")}}}}var m=d-o.length;var a=m;if(m<0){f.css({color:"f00"});k.css({color:"#f00"})}else{f.css({color:"#666"});k.css({color:"#666"})}if(a>=0){f.html(a);k.html("&nbsp;characters");if((typeof imageUploadContainerWasVisible!="undefined")&&imageUploadContainerWasVisible){imageUploadContainerWasVisible=false;p.show()}if((typeof imageUploadedContainerWasVisible!="undefined")&&imageUploadedContainerWasVisible){imageUploadedContainerWasVisible=false;j.show()}}else{f.html("");if((typeof p!="undefined")&&p.is(":visible")){imageUploadContainerWasVisible=true;p.hide()}if((typeof j!="undefined")&&j.is(":visible")){imageUploadedContainerWasVisible=true;j.hide()}k.html("You exceeded the limit of characters by "+Math.abs(a))}}function containsImgTag(c){var d=/<\S[^><]*>/g;var b=c.match(d);if(b!=null){for(i=0;i<b.length;i++){var a=b[i];a=a.toLowerCase();if(a.indexOf("<img")>=0){return true}}}return false}function closeRTEPopups(){$j.jQRTE.jqp_c()}function validateRTEContent(f,b,g,j){var e=$j("#"+f).text();e=$j.trim(e);var l=e;if(BrowserDetect.browser=="Explorer"){var m=new RegExp(String.fromCharCode(13)+String.fromCharCode(10),"gi");l=l.replace(m,"<br>")}l=stripHTML(l);l=get_ents(l);l=$j.trim(l);var a=false;if(e.length>b){$j("#counter-button-container img").css("cursor","pointer");if(document.getElementById("unableToSubmit")){$j.facebox(document.getElementById("unableToSubmit").innerHTML);$j("#facebox .body").css({width:"335px"});$j("#facebox .footer").css({width:"335px"});$j("#facebox").css({left:($j(window).width()-$j("#facebox").width())/2})}return false}containsImgTagB=false;if(l.length==0){if(containsImgTag(e)){containsImgTagB=true}}var d=isEmpty(l);if((l.length>g)||((l.length==0)&&!containsImgTagB&&!j)||(d&&!containsImgTagB&&!j)){if(l.length==0||d){var c=$j("#"+f+"Counter");var h=$j("#"+f+"CharactersText");var k=$j("#errorProfanityDescription");c.html("");h.html($j("#"+f+"EmptyMessage").text());h.css({color:"#f00"});k.css({display:"none"})}$j("#counter-button-container img").css("cursor","pointer");return false}return true}function setSrcImageValue(b){var a=$j("#"+b).text();a=$j.trim(a);$j("#auxDiv").html(a);$j("#auxDiv img").each(function(){var c=file_name_only(new String($j(this).attr("src")));if($j(this).attr("longdesc")!=""){$j(this).attr("src",$j(this).attr("longdesc"))}});a=$j("#auxDiv").html();$j("#auxDiv").html("");return a}function loadAgainImage(a){a.attr("src","/images/ajax-loader.gif");window.setTimeout(function(){a.attr("src",a.attr("longdesc"))},15000)}function requestQuestionAnswerImage(f,b,d){var a="/image/imageIsReady";var c=file_name_only(new String(f));var e={imageSrc:f,imageSrcFilename:c,type:b};goAjax(a,e,function(g){afterRequestQuestionAnswerImage(g,f,b,d)})}function afterRequestQuestionAnswerImage(data,imageSrc,type,uniqid){var response=eval("("+data+")");if(response.imageReady=="true"){$j("#"+type+"_rte").contents().find("body #"+uniqid).attr("src",imageSrc);$j("#"+type+"_rte").contents().trigger("keyup")}else{window.setTimeout(function(){requestQuestionAnswerImage(imageSrc,type)},15000)}}function enableRteAfterLogin(a,d,c,b){$j("#"+a+"-label-container #"+a+"-label").fadeOut("slow",function(){var e="";if(c){if(b){e="Question? "}e+="Write it here: ("}e+='<span id="'+a+'Counter">'+d+'</span><span id="'+a+'CharactersText"> characters</span>';if(c){e+=")"}$j("#"+a+"-label-container #"+a+"-label").html(e);$j("#"+a+"-label-container #"+a+"-label").fadeIn()});$j("#"+a+"_jqrte_body .jqrte_rte_div textarea").fadeOut("slow",function(){$j("#"+a+"_jqrte_body .jqrte_rte_div textarea").hide();$j("#"+a+"_rte").show();$j("#"+a+"_rte").jqrte_setIcon();$j("#"+a+"_rte").jqrte_setContent();$j("#"+a+"_rte").jqrte();$j("#"+a+"_rte").contents().trigger("keyup");$j("#"+a+"_jqrte_body .jqrte_menu_div table td").css({cursor:"pointer"})});$j("#"+a+"_jqrte_body .jqrte_menu_div .jqrte_menu td").unbind()}function setEventHandlerQuestionW3C(){$j(document.getElementById("question_rte").contentWindow.document).bind("paste cut click",function(a){setTimeout("updateTextArea('question')",100)})}function setEventHandlerQuestionDetailsW3C(){$j(document.getElementById("questionDetails_rte").contentWindow.document).bind("paste cut click",function(a){setTimeout("updateTextArea('questionDetails')",100)})}function setEventHandlerAnswerW3C(){$j(document.getElementById("answer_rte").contentWindow.document).bind("paste cut click",function(a){setTimeout("updateTextArea('answer')",100)})}function setEventHandlerQuestionIE(){if(document.getElementById("question_rte").contentWindow.document.body.onpaste==null){document.getElementById("question_rte").contentWindow.document.body.onpaste=function(a){setTimeout("updateTextArea('question')",100)}}if(document.getElementById("question_rte").contentWindow.document.body.oncut==null){document.getElementById("question_rte").contentWindow.document.body.oncut=function(a){setTimeout("updateTextArea('question')",100)}}}function setEventHandlerQuestionDetailsIE(){if(document.getElementById("questionDetails_rte").contentWindow.document.body.onpaste==null){document.getElementById("questionDetails_rte").contentWindow.document.body.onpaste=function(a){setTimeout("updateTextArea('questionDetails')",100)}}if(document.getElementById("questionDetails_rte").contentWindow.document.body.oncut==null){document.getElementById("questionDetails_rte").contentWindow.document.body.oncut=function(a){setTimeout("updateTextArea('questionDetails')",100)}}}function setEventHandlerAnswerIE(){if(document.getElementById("answer_rte").contentWindow.document.body.onpaste==null){document.getElementById("answer_rte").contentWindow.document.body.onpaste=function(a){setTimeout("updateTextArea('answer')",100)}}if(document.getElementById("answer_rte").contentWindow.document.body.oncut==null){document.getElementById("answer_rte").contentWindow.document.body.oncut=function(a){setTimeout("updateTextArea('answer')",100)}}}function updateTextArea(a){$j("#"+a+"_rte").contents().trigger("keyup")};