function openConfirmDeletePopup(a,b){var c=b.href;$("#dialog-message").dialog({modal:true,autoOpen:false,buttons:{No:function(){$(this).dialog("close");return false},Yes:function(){$(this).dialog("close");window.location.href=c;return true}}});$("#dialog-message").dialog("open");a!=null&&$("#dialog-message > p > span#dm_msg").text(a);return false}function FrontEndConfirmDeletePopup(a,b){var c=b.name,d="javascript:__doPostBack('"+c+"','')";$("#dialog-message").dialog({modal:true,autoOpen:false,buttons:{No:function(){$(this).dialog("close");return false},Yes:function(){$(this).dialog("close");window.location.href=d;return true}}});$("#dialog-message").dialog("open");a!=null&&$("#dialog-message > p > span#dm_msg").text(a);return false};(function(a){a.fn.tablePagination=function(c){var b={firstArrow:(new Image).src="./images/first.gif",prevArrow:(new Image).src="./images/prev.gif",lastArrow:(new Image).src="./images/last.gif",nextArrow:(new Image).src="./images/next.gif",rowsPerPage:5,currPage:1,optionsForRows:[5,10,25,50,100],ignoreRows:[]};c=a.extend(b,c);return this.each(function(){var c=a(this)[0],g,h,j,k,l,n,m;if(c.id){g="#"+c.id+"+#tablePagination #tablePagination_totalPages";h="#"+c.id+"+#tablePagination #tablePagination_currPage";j="#"+c.id+"+#tablePagination #tablePagination_rowsPerPage";k="#"+c.id+"+#tablePagination #tablePagination_firstPage";l="#"+c.id+"+#tablePagination #tablePagination_prevPage";n="#"+c.id+"+#tablePagination #tablePagination_nextPage";m="#"+c.id+"+#tablePagination #tablePagination_lastPage"}else{g="#tablePagination #tablePagination_totalPages";h="#tablePagination #tablePagination_currPage";j="#tablePagination #tablePagination_rowsPerPage";k="#tablePagination #tablePagination_firstPage";l="#tablePagination #tablePagination_prevPage";n="#tablePagination #tablePagination_nextPage";m="#tablePagination #tablePagination_lastPage"}var t=a.makeArray(a("tbody tr",c)),i=a.grep(t,function(c){return a.inArray(c,b.ignoreRows)==-1},false),o=i.length,f=p(),d=b.currPage>f?1:b.currPage;a.inArray(b.rowsPerPage,b.optionsForRows)==-1&&b.optionsForRows.push(b.rowsPerPage);function q(d){if(d==0||d>f)return;var e=(d-1)*b.rowsPerPage,g=e+b.rowsPerPage-1;a(i).show();for(var c=0;c<i.length;c++)(c<e||c>g)&&a(i[c]).hide()}function p(){var c=Math.round(o/b.rowsPerPage),d=c*b.rowsPerPage<o?c+1:c;a(g).length>0&&a(g).html(d);return d}function e(b){if(b<1||b>f)return;d=b;q(d);a(h).val(d)}function s(){var f=false,d=b.optionsForRows;d.sort(function(a,b){return a-b});var e=a(j)[0];e.length=0;for(var c=0;c<d.length;c++)if(d[c]==b.rowsPerPage){e.options[c]=new Option(d[c],d[c],true,true);f=true}else e.options[c]=new Option(d[c],d[c]);if(!f)b.optionsForRows==d[0]}function r(){var a=[];a.push("<div id='tablePagination'>");a.push("<span id='tablePagination_perPage'>");a.push("<select id='tablePagination_rowsPerPage'><option value='5'>5</option></select>");a.push("per page");a.push("</span>");a.push("<span id='tablePagination_paginater'>");a.push("<img id='tablePagination_firstPage' src='"+b.firstArrow+"'>");a.push("<img id='tablePagination_prevPage' src='"+b.prevArrow+"'>");a.push("Page");a.push("<input id='tablePagination_currPage' type='input' value='"+d+"' size='1'>");a.push("of <span id='tablePagination_totalPages'>"+f+"</span>");a.push("<img id='tablePagination_nextPage' src='"+b.nextArrow+"'>");a.push("<img id='tablePagination_lastPage' src='"+b.lastArrow+"'>");a.push("</span>");a.push("</div>");return a.join("").toString()}if(a(g).length==0)a(this).after(r());else a("#tablePagination_currPage").val(d);s();q(d);a(k).bind("click",function(){e(1)});a(l).bind("click",function(){e(d-1)});a(n).bind("click",function(){e(d+1)});a(m).bind("click",function(){e(f)});a(h).bind("change",function(){e(this.value)});a(j).bind("change",function(){b.rowsPerPage=parseInt(this.value,10);f=p();e(1)})})}})(jQuery);(function(a){a.extend({tablesorter:new function(){var b=[],d=[];this.defaults={cssHeader:"header",cssAsc:"headerSortUp",cssDesc:"headerSortDown",sortInitialOrder:"asc",sortMultiSortKey:"shiftKey",sortForce:null,sortAppend:null,textExtraction:"simple",parsers:{},widgets:[],widgetZebra:{css:["even","odd"]},headers:{},widthFixed:false,cancelSelection:true,sortList:[],headerList:[],dateFormat:"us",decimal:".",debug:false};function c(b,a){g(b+","+((new Date).getTime()-a.getTime())+"ms")}this.benchmark=c;function g(a){if(typeof console!="undefined"&&typeof console.debug!="undefined")console.log(a);else alert(a)}function h(c,e){if(c.config.debug)var f="";var j=c.tBodies[0].rows;if(c.tBodies[0].rows[0])for(var i=[],h=j[0].cells,l=h.length,b=0;b<l;b++){var d=false;if(a.metadata&&a(e[b]).metadata()&&a(e[b]).metadata().sorter)d=k(a(e[b]).metadata().sorter);else if(c.config.headers[b]&&c.config.headers[b].sorter)d=k(c.config.headers[b].sorter);if(!d)d=p(c,h[b]);if(c.config.debug)f+="column:"+b+" parser:"+d.id+"\n";i.push(d)}c.config.debug&&g(f);return i}function p(d,e){for(var f=b.length,c=1;c<f;c++)if(b[c].is(a.trim(j(d.config,e)),d,e))return b[c];return b[0]}function k(c){for(var d=b.length,a=0;a<d;a++)if(b[a].id.toLowerCase()==c.toLowerCase())return b[a];return false}function n(b){if(b.config.debug)var l=new Date;for(var i=b.tBodies[0]&&b.tBodies[0].rows.length||0,k=b.tBodies[0].rows[0]&&b.tBodies[0].rows[0].cells.length||0,m=b.config.parsers,g={row:[],normalized:[]},f=0;f<i;++f){var h=b.tBodies[0].rows[f],e=[];g.row.push(a(h));for(var d=0;d<k;++d)e.push(m[d].format(j(b.config,h.cells[d]),b,h.cells[d]));e.push(f);g.normalized.push(e);e=null}b.config.debug&&c("Building cache for "+i+" rows:",l);return g}function j(d,b){if(!b)return"";var c="";if(d.textExtraction=="simple")if(b.childNodes[0]&&b.childNodes[0].hasChildNodes())c=b.childNodes[0].innerHTML;else c=b.innerHTML;else if(typeof d.textExtraction=="function")c=d.textExtraction(b);else c=a(b).text();return c}function e(b,p){if(b.config.debug)var m=new Date;for(var j=p,l=j.row,e=j.normalized,o=e.length,i=e[0].length-1,n=a(b.tBodies[0]),g=[],d=0;d<o;d++){g.push(l[e[d][i]]);if(!b.config.appender)for(var k=l[e[d][i]],q=k.length,h=0;h<q;h++)n[0].appendChild(k[h])}b.config.appender&&b.config.appender(b,g);g=null;b.config.debug&&c("Rebuilt table:",m);f(b);setTimeout(function(){a(b).trigger("sortEnd")},0)}function y(b){if(b.config.debug)var f=new Date;for(var h=a.metadata?true:false,e=[],d=0;d<b.tHead.rows.length;d++)e[d]=0;$tableHeaders=a("thead th",b);$tableHeaders.each(function(c){this.count=0;this.column=c;this.order=t(b.config.sortInitialOrder);if(r(this)||s(b,c))this.sortDisabled=true;!this.sortDisabled&&a(this).addClass(b.config.cssHeader);b.config.headerList[c]=this});if(b.config.debug){c("Built headers:",f);g($tableHeaders)}return $tableHeaders}function r(b){return a.metadata&&a(b).metadata().sorter===false?true:false}function s(a,b){return a.config.headers[b]&&a.config.headers[b].sorter===false?true:false}function f(b){for(var c=b.config.widgets,d=c.length,a=0;a<d;a++)l(c[a]).format(b)}function l(b){for(var c=d.length,a=0;a<c;a++)if(d[a].id.toLowerCase()==b.toLowerCase())return d[a]}function t(a){if(typeof a!="Number")i=a.toLowerCase()=="desc"?1:0;else i=a==(0||1)?a:0;return i}function x(d,b){for(var c=b.length,a=0;a<c;a++)if(b[a][0]==d)return true;return false}function m(h,e,c,d){e.removeClass(d[0]).removeClass(d[1]);var f=[];e.each(function(){if(!this.sortDisabled)f[this.column]=a(this)});for(var g=c.length,b=0;b<g;b++)f[c[b][0]].addClass(d[c[b][1]])}function w(b){var d=b.config;if(d.widthFixed){var c=a("<colgroup>");a("tr:first td",b.tBodies[0]).each(function(){c.append(a("<col>").css("width",a(this).width()))});a(b).prepend(c)}}function q(e,b){for(var f=e.config,g=b.length,a=0;a<g;a++){var d=b[a],c=f.headerList[d[0]];c.count=d[1];c.count++}}function o(g,d,e){if(g.config.debug)var l=new Date;for(var a="var sortWrapper = function(a,b) {",k=d.length,b=0;b<k;b++){var h=d[b][0],f=d[b][1],m=u(g.config.parsers,h)=="text"?f==0?"sortText":"sortTextDesc":f==0?"sortNumeric":"sortNumericDesc",i="e"+b;a+="var "+i+" = "+m+"(a["+h+"],b["+h+"]); ";a+="if("+i+") { return "+i+"; } ";a+="else { "}var j=e.normalized[0].length-1;a+="return a["+j+"]-b["+j+"];";for(var b=0;b<k;b++)a+="}; ";a+="return 0; ";a+="}; ";eval(a);e.normalized.sort(sortWrapper);g.config.debug&&c("Sorting on "+d.toString()+" and dir "+f+" time:",l);return e}function u(a,b){return a[b].type}this.construct=function(b){return this.each(function(){if(!this.tHead||!this.tBodies)return;var d,k,g,i,c,p=0,r;this.config={};c=a.extend(this.config,a.tablesorter.defaults,b);d=a(this);g=y(this);this.config.parsers=h(this,g);i=n(this);var j=[c.cssDesc,c.cssAsc];w(this);g.click(function(p){d.trigger("sortStart");var n=d[0].tBodies[0]&&d[0].tBodies[0].rows.length||0;if(!this.sortDisabled&&n>0){var q=a(this),f=this.column;this.order=this.count++%2;if(!p[c.sortMultiSortKey]){c.sortList=[];if(c.sortForce!=null)for(var k=c.sortForce,b=0;b<k.length;b++)k[b][0]!=f&&c.sortList.push(k[b]);c.sortList.push([f,this.order])}else if(x(f,c.sortList))for(var b=0;b<c.sortList.length;b++){var h=c.sortList[b],l=c.headerList[h[0]];if(h[0]==f){l.count=h[1];l.count++;h[1]=l.count%2}}else c.sortList.push([f,this.order]);setTimeout(function(){m(d[0],g,c.sortList,j);e(d[0],o(d[0],c.sortList,i))},1);return false}}).mousedown(function(){if(c.cancelSelection){this.onselectstart=function(){return false};return false}});d.bind("update",function(){this.config.parsers=h(this,g);i=n(this)}).bind("sorton",function(f,d){a(this).trigger("sortStart");c.sortList=d;var b=c.sortList;q(this,b);m(this,g,b,j);e(this,o(this,b,i))}).bind("appendCache",function(){e(this,i)}).bind("applyWidgetId",function(b,a){l(a).format(this)}).bind("applyWidgets",function(){f(this)});if(a.metadata&&a(this).metadata()&&a(this).metadata().sortlist)c.sortList=a(this).metadata().sortlist;c.sortList.length>0&&d.trigger("sorton",[c.sortList]);f(this)})};this.addParser=function(c){for(var e=b.length,d=true,a=0;a<e;a++)if(b[a].id.toLowerCase()==c.id.toLowerCase())d=false;d&&b.push(c)};this.addWidget=function(a){d.push(a)};this.formatFloat=function(b){var a=parseFloat(b);return isNaN(a)?0:a};this.formatInt=function(b){var a=parseInt(b);return isNaN(a)?0:a};this.isDigit=function(e,c){var b="\\"+c.decimal,d="/(^[+]?0("+b+"0+)?$)|(^([-+]?[1-9][0-9]*)$)|(^([-+]?((0?|[1-9][0-9]*)"+b+"(0*[1-9][0-9]*)))$)|(^[-+]?[1-9]+[0-9]*"+b+"0+$)/";return RegExp(d).test(a.trim(e))};this.clearTableBody=function(b){if(a.browser.msie){function c(){while(this.firstChild)this.removeChild(this.firstChild)}c.apply(b.tBodies[0])}else b.tBodies[0].innerHTML=""}}});a.fn.extend({tablesorter:a.tablesorter.construct});var b=a.tablesorter;b.addParser({id:"text",is:function(){return true},format:function(b){return a.trim(b.toLowerCase())},type:"text"});b.addParser({id:"digit",is:function(d,b){var c=b.config;return a.tablesorter.isDigit(d,c)},format:function(b){return a.tablesorter.formatFloat(b)},type:"numeric"});b.addParser({id:"currency",is:function(a){return/^[\u00a3$\u20ac?.]/.test(a)},format:function(b){return a.tablesorter.formatFloat(b.replace(new RegExp(/[^0-9.]/g),""))},type:"numeric"});b.addParser({id:"ipAddress",is:function(a){return/^\d{2,3}[\.]\d{2,3}[\.]\d{2,3}[\.]\d{2,3}$/.test(a)},format:function(g){for(var e=g.split("."),d="",f=e.length,c=0;c<f;c++){var b=e[c];if(b.length==2)d+="0"+b;else d+=b}return a.tablesorter.formatFloat(d)},type:"numeric"});b.addParser({id:"url",is:function(a){return/^(https?|ftp|file):\/\/$/.test(a)},format:function(a){return jQuery.trim(a.replace(new RegExp(/(https?|ftp|file):\/\//),""))},type:"text"});b.addParser({id:"isoDate",is:function(a){return/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(a)},format:function(b){return a.tablesorter.formatFloat(b!=""?new Date(b.replace(new RegExp(/-/g),"/")).getTime():"0")},type:"numeric"});b.addParser({id:"percent",is:function(b){return/\%$/.test(a.trim(b))},format:function(b){return a.tablesorter.formatFloat(b.replace(new RegExp(/%/g),""))},type:"numeric"});b.addParser({id:"usLongDate",is:function(a){return a.match(new RegExp(/^[A-Za-z]{3,10}\.? [0-9]{1,2}, ([0-9]{4}|'?[0-9]{2}) (([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(AM|PM)))$/))},format:function(b){return a.tablesorter.formatFloat(new Date(b).getTime())},type:"numeric"});b.addParser({id:"shortDate",is:function(a){return/\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}/.test(a)},format:function(b,d){var c=d.config;b=b.replace(/\-/g,"/");if(c.dateFormat=="us")b=b.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$1/$2");else if(c.dateFormat=="uk")b=b.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$2/$1");else if(c.dateFormat=="dd/mm/yy"||c.dateFormat=="dd-mm-yy")b=b.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2})/,"$1/$2/$3");return a.tablesorter.formatFloat(new Date(b).getTime())},type:"numeric"});b.addParser({id:"time",is:function(a){return/^(([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(am|pm)))$/.test(a)},format:function(b){return a.tablesorter.formatFloat(new Date("2000/01/01 "+b).getTime())},type:"numeric"});b.addParser({id:"metadata",is:function(){return false},format:function(f,c,d){var b=c.config,e=!b.parserMetadataName?"sortValue":b.parserMetadataName;return a(d).metadata()[e]},type:"numeric"});b.addWidget({id:"zebra",format:function(b){if(b.config.debug)var c=new Date;a("tr:visible",b.tBodies[0]).filter(":even").removeClass(b.config.widgetZebra.css[1]).addClass(b.config.widgetZebra.css[0]).end().filter(":odd").removeClass(b.config.widgetZebra.css[0]).addClass(b.config.widgetZebra.css[1]);b.config.debug&&a.tablesorter.benchmark("Applying Zebra widget",c)}})})(jQuery);if(!this.JSON)JSON={};(function(){function c(a){return a<10?"0"+a:a}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(){return this.getUTCFullYear()+"-"+c(this.getUTCMonth()+1)+"-"+c(this.getUTCDate())+"T"+c(this.getUTCHours())+":"+c(this.getUTCMinutes())+":"+c(this.getUTCSeconds())+"Z"};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()}}var h=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,f=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,a,d,i={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},b;function g(a){f.lastIndex=0;return f.test(a)?'"'+a.replace(f,function(a){var b=i[a];return typeof b==="string"?b:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function e(m,n){var i,j,h,k,l=a,f,c=n[m];if(c&&typeof c==="object"&&typeof c.toJSON==="function")c=c.toJSON(m);if(typeof b==="function")c=b.call(n,m,c);switch(typeof c){case"string":return g(c);case"number":return isFinite(c)?String(c):"null";case"boolean":case"null":return String(c);case"object":if(!c)return"null";a+=d;f=[];if(Object.prototype.toString.apply(c)==="[object Array]"){k=c.length;for(i=0;i<k;i+=1)f[i]=e(i,c)||"null";h=f.length===0?"[]":a?"[\n"+a+f.join(",\n"+a)+"\n"+l+"]":"["+f.join(",")+"]";a=l;return h}if(b&&typeof b==="object"){k=b.length;for(i=0;i<k;i+=1){j=b[i];if(typeof j==="string"){h=e(j,c);h&&f.push(g(j)+(a?": ":":")+h)}}}else for(j in c)if(Object.hasOwnProperty.call(c,j)){h=e(j,c);h&&f.push(g(j)+(a?": ":":")+h)}h=f.length===0?"{}":a?"{\n"+a+f.join(",\n"+a)+"\n"+l+"}":"{"+f.join(",")+"}";a=l;return h}}if(typeof JSON.stringify!=="function")JSON.stringify=function(h,c,f){var g;a="";d="";if(typeof f==="number")for(g=0;g<f;g+=1)d+=" ";else if(typeof f==="string")d=f;b=c;if(c&&typeof c!=="function"&&(typeof c!=="object"||typeof c.length!=="number"))throw new Error("JSON.stringify");return e("",{"":h})};if(typeof JSON.parse!=="function")JSON.parse=function(a,c){var b;function d(f,g){var b,e,a=f[g];if(a&&typeof a==="object")for(b in a)if(Object.hasOwnProperty.call(a,b)){e=d(a,b);if(e!==undefined)a[b]=e;else delete a[b]}return c.call(f,g,a)}h.lastIndex=0;if(h.test(a))a=a.replace(h,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)});if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){b=eval("("+a+")");return typeof c==="function"?d({"":b},""):b}throw new SyntaxError("JSON.parse");}})();(function(a){a.fn.htmlarea=function(a){if(a&&typeof a==="string"){for(var e=[],c=1;c<arguments.length;c++)e.push(arguments[c]);var d=b(this[0]),f=d[a];if(f)return f.apply(d,e)}return this.each(function(){b(this,a)})};var b=window.jHtmlArea=function(a,c){return a.jquery?b(a[0]):a.jhtmlareaObject?a.jhtmlareaObject:new b.fn.init(a,c)};b.fn=b.prototype={jhtmlarea:"0.7.0",init:function(g,k){if(g.nodeName.toLowerCase()==="textarea"){var f=a.extend({},b.defaultOptions,k);g.jhtmlareaObject=this;var d=this.textarea=a(g),h=this.container=a("<div/>").addClass("jHtmlArea").width(d.width()).insertAfter(d),i=this.toolbar=a("<div/>").addClass("ToolBar").appendTo(h);c.initToolBar.call(this,f);var e=this.iframe=a("<iframe/>").height(d.height());e.width(d.width()-(a.browser.msie?0:4));var j=this.htmlarea=a("<div/>").append(e);h.append(j).append(d.hide());c.initEditor.call(this,f);c.attachEditorEvents.call(this);e.height(e.height()-i.height());i.width(d.width()-2);f.loaded&&f.loaded.call(this)}},dispose:function(){this.textarea.show().insertAfter(this.container);this.container.remove();this.textarea[0].jhtmlareaObject=null},execCommand:function(a,b,c){this.iframe[0].contentWindow.focus();this.editor.execCommand(a,b||false,c||null);this.updateTextArea()},ec:function(a,b,c){this.execCommand(a,b,c)},queryCommandValue:function(a){this.iframe[0].contentWindow.focus();return this.editor.queryCommandValue(a)},qc:function(a){return this.queryCommandValue(a)},getSelectedHTML:function(){if(a.browser.msie)return this.getRange().htmlText;else{var b=this.getRange().cloneContents();return a("<p/>").append(a(b)).html()}},getSelection:function(){return a.browser.msie?this.editor.selection:this.iframe[0].contentDocument.defaultView.getSelection()},getRange:function(){var a=this.getSelection();return!a?null:a.getRangeAt?a.getRangeAt(0):a.createRange()},html:function(a){if(a)this.pastHTML(a);else return toHtmlString()},pasteHTML:function(b){this.iframe[0].contentWindow.focus();var c=this.getRange();if(a.browser.msie)c.pasteHTML(b);else if(a.browser.mozilla){c.deleteContents();c.insertNode(a(b.indexOf("<")!=0?a("<span/>").append(b):b)[0])}else{c.deleteContents();c.insertNode(a(this.iframe[0].contentWindow.document.createElement("span")).append(a(b.indexOf("<")!=0?"<span>"+b+"</span>":b))[0])}c.collapse(false);c.select()},cut:function(){this.ec("cut")},copy:function(){this.ec("copy")},paste:function(){this.ec("paste")},bold:function(){this.ec("bold")},italic:function(){this.ec("italic")},underline:function(){this.ec("underline")},strikeThrough:function(){this.ec("strikethrough")},image:function(b){if(a.browser.msie&&!b)this.ec("insertImage",true);else this.ec("insertImage",false,b||prompt("Image URL:","http://"))},removeFormat:function(){this.ec("removeFormat",false,[]);this.unlink()},link:function(){if(a.browser.msie)this.ec("createLink",true);else this.ec("createLink",false,prompt("Link URL:","http://"))},unlink:function(){this.ec("unlink",false,[])},orderedList:function(){this.ec("insertorderedlist")},unorderedList:function(){this.ec("insertunorderedlist")},superscript:function(){this.ec("superscript")},subscript:function(){this.ec("subscript")},p:function(){this.formatBlock("<p>")},h1:function(){this.heading(1)},h2:function(){this.heading(2)},h3:function(){this.heading(3)},h4:function(){this.heading(4)},h5:function(){this.heading(5)},h6:function(){this.heading(6)},heading:function(b){this.formatBlock(a.browser.msie?"Heading "+b:"h"+b)},indent:function(){this.ec("indent")},outdent:function(){this.ec("outdent")},insertHorizontalRule:function(){this.ec("insertHorizontalRule",false,"ht")},justifyLeft:function(){this.ec("justifyLeft")},justifyCenter:function(){this.ec("justifyCenter")},justifyRight:function(){this.ec("justifyRight")},increaseFontSize:function(){if(a.browser.msie)this.ec("fontSize",false,this.qc("fontSize")+1);else if(a.browser.safari)this.getRange().surroundContents(a(this.iframe[0].contentWindow.document.createElement("span")).css("font-size","larger")[0]);else this.ec("increaseFontSize",false,"big")},decreaseFontSize:function(){if(a.browser.msie)this.ec("fontSize",false,this.qc("fontSize")-1);else if(a.browser.safari)this.getRange().surroundContents(a(this.iframe[0].contentWindow.document.createElement("span")).css("font-size","smaller")[0]);else this.ec("decreaseFontSize",false,"small")},forecolor:function(a){this.ec("foreColor",false,a||prompt("Enter HTML Color:","#"))},formatBlock:function(a){this.ec("formatblock",false,a||null)},showHTMLView:function(){this.updateTextArea();this.textarea.show();this.htmlarea.hide();a("ul li:not(li:has(a.html))",this.toolbar).hide();a("ul:not(:has(:visible))",this.toolbar).hide();a("ul li a.html",this.toolbar).addClass("highlighted")},hideHTMLView:function(){this.updateHtmlArea();this.textarea.hide();this.htmlarea.show();a("ul",this.toolbar).show();a("ul li",this.toolbar).show().find("a.html").removeClass("highlighted")},toggleHTMLView:function(){this.textarea.is(":hidden")?this.showHTMLView():this.hideHTMLView()},toHtmlString:function(){return this.editor.body.innerHTML},toString:function(){return this.editor.body.innerText},updateTextArea:function(){this.textarea.val(this.toHtmlString())},updateHtmlArea:function(){this.editor.body.innerHTML=this.textarea.val()}};b.fn.init.prototype=b.fn;b.defaultOptions={toolbar:[["html"],["bold","italic","underline","strikethrough","|","subscript","superscript"],["increasefontsize","decreasefontsize"],["orderedlist","unorderedlist"],["indent","outdent"],["justifyleft","justifycenter","justifyright"],["link","unlink","image","horizontalrule"],["p","h1","h2","h3","h4","h5","h6"],["cut","copy","paste"]],css:null,toolbarText:{bold:"Bold",italic:"Italic",underline:"Underline",strikethrough:"Strike-Through",cut:"Cut",copy:"Copy",paste:"Paste",h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4",h5:"Heading 5",h6:"Heading 6",p:"Paragraph",indent:"Indent",outdent:"Outdent",horizontalrule:"Insert Horizontal Rule",justifyleft:"Left Justify",justifycenter:"Center Justify",justifyright:"Right Justify",increasefontsize:"Increase Font Size",decreasefontsize:"Decrease Font Size",forecolor:"Text Color",link:"Insert Link",unlink:"Remove Link",image:"Insert Image",orderedlist:"Insert Ordered List",unorderedlist:"Insert Unordered List",subscript:"Subscript",superscript:"Superscript",html:"Show/Hide HTML Source View"}};var c={toolbarButtons:{strikethrough:"strikeThrough",orderedlist:"orderedList",unorderedlist:"unorderedList",horizontalrule:"insertHorizontalRule",justifyleft:"justifyLeft",justifycenter:"justifyCenter",justifyright:"justifyRight",increasefontsize:"increaseFontSize",decreasefontsize:"decreaseFontSize",html:function(){this.toggleHTMLView()}},initEditor:function(c){var a=this.editor=this.iframe[0].contentWindow.document;a.designMode="on";a.open();a.write(this.textarea.val());a.close();if(c.css){var b=a.createElement("link");b.rel="stylesheet";b.type="text/css";b.href=c.css;a.getElementsByTagName("head")[0].appendChild(b)}},initToolBar:function(b){var g=this,f=function(b,c,d){return a("<li/>").append(a("<a href='javascript:void(0);'/>").addClass(b).attr("title",c).click(function(){d.call(g,a(this))}))};function e(i){for(var e=a("<ul/>").appendTo(g.toolbar),h=0;h<i.length;h++){var d=i[h];if((typeof d).toLowerCase()==="string")if(d==="|")e.append(a('<li class="separator"/>'));else{var j=function(b){var a=c.toolbarButtons[b]||b;return(typeof a).toLowerCase()==="function"?function(b){a.call(this,b)}:function(){this[a]();this.editor.body.focus()}}(d.toLowerCase()),k=b.toolbarText[d.toLowerCase()];e.append(f(d.toLowerCase(),k||d,j))}else e.append(f(d.css,d.text,d.action))}}if(b.toolbar.length!==0&&c.isArray(b.toolbar[0]))for(var d=0;d<b.toolbar.length;d++)e(b.toolbar[d]);else e(b.toolbar)},attachEditorEvents:function(){var b=this,c=function(){b.updateHtmlArea()};this.textarea.click(c).keyup(c).keydown(c).mousedown(c).blur(c);var d=function(){b.updateTextArea()};a(this.editor.body).click(d).keyup(d).keydown(d).mousedown(d).blur(d);a("form").submit(function(){b.toggleHTMLView();b.toggleHTMLView()});if(window.__doPostBack){var e=__doPostBack;window.__doPostBack=function(){if(b)if(b.toggleHTMLView){b.toggleHTMLView();b.toggleHTMLView()}return e.apply(window,arguments)}}},isArray:function(a){return a&&typeof a==="object"&&typeof a.length==="number"&&typeof a.splice==="function"&&!a.propertyIsEnumerable("length")}}})(jQuery)
