(function(h){h.taconite=function(a){j(a)};h.taconite.debug=0;h.taconite.version="3.01";h.taconite.defaults={cdataWrap:"div"};if(typeof h.fn.replace=="undefined"){h.fn.replace=function(a){return this.after(a).remove()}}if(typeof h.fn.replaceContent=="undefined"){h.fn.replaceContent=function(a){return this.empty().append(a)}}h.expr[":"].taconiteTag="a.taconiteTag";h.taconite._httpData=h.httpData;h.httpData=h.taconite.detect=function(a,c){var d=a.getResponseHeader("content-type");if(h.taconite.debug){g("[AJAX response] content-type: ",d,";  status: ",a.status," ",a.statusText,";  has responseXML: ",a.responseXML!=null);g("type: "+c);g("responseXML: "+a.responseXML)}var b=h.taconite._httpData(a,c);if(b&&b.documentElement){var e=b.documentElement.tagName;g("XML document root: ",e);if(e=="taconite"){g("taconite command document detected");h.taconite(b)}}else{g("jQuery core httpData returned: "+b);g('httpData: response is not XML (or not "valid" XML)')}return b};h.taconite.enableAutoDetection=function(a){h.httpData=a?h.taconite.detect:h.taconite._httpData};var i=0;function g(){if(!h.taconite.debug||!window.console||!window.console.log){return}if(!i++){g("Plugin Version: "+h.taconite.version)}window.console.log("[taconite] "+[].join.call(arguments,""))}function j(d){var b=true,c;try{h.event.trigger("taconite.begin.notify",[d]);b=f(d)}catch(a){b=c=a}h.event.trigger("taconite.complete.notify",[d,!!b,b===true?null:b]);if(c){throw c}}function f(l){var b={wrap:1};if(typeof l=="string"){l=d(l)}if(!l||!l.documentElement){g("$.taconite invoked without valid document; nothing to process");return false}try{var e=new Date().getTime();a(l.documentElement.childNodes);h.taconite.lastTime=(new Date().getTime())-e;g("time to process response: "+h.taconite.lastTime+"ms")}catch(c){if(window.console&&window.console.error){window.console.error("[taconite] ERROR processing document: "+c)}throw c}return true;function d(k){var r;g("attempting string to document conversion");try{if(window.ActiveXObject){r=new ActiveXObject("Microsoft.XMLDOM");r.async="false";r.loadXML(k)}else{var s=new DOMParser();r=s.parseFromString(k,"text/xml")}}catch(t){if(window.console&&window.console.error){window.console.error("[taconite] ERROR parsing XML string for conversion: "+t)}throw t}var q=r&&r.documentElement&&r.documentElement.tagName!="parsererror";g("conversion ",q?"successful!":"FAILED");return r}function a(U){var P=0;for(var R=0;R<U.length;R++){if(U[R].nodeType!=1){continue}var aa=U[R],V=aa.tagName;if(V=="eval"){var K=(aa.firstChild?aa.firstChild.nodeValue:null);g('invoking "eval" command: ',K);if(K){h.globalEval(K)}continue}var L=aa.getAttribute("select");var Y=h(L);if(!Y[0]){g("No matching targets for selector: ",L);continue}var q=aa.getAttribute("cdataWrap")||h.taconite.defaults.cdataWrap;var N=[];if(aa.childNodes.length>0){P=1;for(var S=0,X=[];S<aa.childNodes.length;S++){X[S]=v(aa.childNodes[S])}N.push(b[V]?M(X):X)}var k=aa.getAttribute("name");var Q=aa.getAttribute("value");if(k!==null){N.push(k)}if(Q!==null){N.push(Q)}for(var S=1;true;S++){Q=aa.getAttribute("arg"+S);if(Q===null){break}N.push(Q)}if(h.taconite.debug){var T=X?"...":N.join(",");g("invoking command: $('",L,"').",V,"("+T+")")}Y[V].apply(Y,N)}if(P){W()}function W(){if(!h.browser.opera&&!h.browser.msie){return}h("select:taconiteTag").each(function(){h("option:taconiteTag",this).each(function(){this.setAttribute("selected","selected");this.taconiteTag=null});this.taconiteTag=null})}function M(m){for(var o=0,p=[];o<m.length;o++){if(m[o].nodeType==1){p.push(m[o])}}return p}function v(m){var o=m.nodeType;if(o==1){return n(m)}if(o==3){return O(m.nodeValue)}if(o==4){return ab(m.nodeValue)}return null}function ab(m){var o=document.createElement(q);o.innerHTML=m;return o}function O(m){if(h.browser.msie){m=m.replace(/\n/g,"\r").replace(/\s+/g," ")}return document.createTextNode(m)}function n(m){var w,r=m.tagName.toLowerCase();if(h.browser.msie){var o=m.getAttribute("type");if(r=="table"||o=="radio"||o=="checkbox"||r=="button"||(r=="select"&&m.getAttribute("multiple"))){w=document.createElement("<"+r+" "+Z(null,m,true)+">")}}if(!w){w=document.createElement(r);Z(w,m)}if(h.browser.msie&&r=="td"){var s=m.getAttribute("colspan");if(s){w.colSpan=parseInt(s)}}if(h.browser.msie&&!w.canHaveChildren){if(m.childNodes.length>0){w.text=m.text}}else{for(var p=0,u=m.childNodes.length;p<u;p++){var t=v(m.childNodes[p]);if(t){w.appendChild(t)}}}if(h.browser.msie||h.browser.opera){if(r=="select"||(r=="option"&&m.getAttribute("selected"))){w.taconiteTag=1}}return w}function Z(w,t,p){for(var u=0,s="";u<t.attributes.length;u++){var o=t.attributes[u],r=h.trim(o.name),m=h.trim(o.value);if(p){s+=(r+'="'+m+'" ')}else{if(r=="style"){w.style.cssText=m;w.setAttribute(r,m)}else{h.attr(w,r,m)}}}return s}}}})(jQuery);