(function(){var q=YAHOO.util.Connect,f=YAHOO.lang,n=YAHOO.util.Event,t=YAHOO.util.Dom,u=YAHOO.util.Dom.get,i={LOADING:1,DISPATCHED:2,ERROR:3,EMPTY:4,proxy:"/dispatcher.php?uri=",CSSNODE:1,JSNODE:2},A=/<script([^>]*)>([\s\S]*?)<\/script>/igm,B=/src=(['"]?)([^"']*)\1/i,C=/<link([^>]*)(>[\s]*<\/link>|>)/igm,D=/href=(['"]?)([^"']*)\1/i,E=/<style([^>]*)>([\s\S]*?)<\/style>/igm,v=/([\w-.]+)\s*=\s*(".*?"|'.*?'|\w+)*/im,F=RegExp("url\\s*\\(([^\\)]*)","igm"),w=/^((?:http|https):\/\/)((?:\w+[.|-]?)*\w+)(\/.*)$/i;
YAHOO.util.Dispatcher=function(){function x(a){f.isString(a)&&(a=a.replace(/^\s*(\S*(\s+\S+)*)\s*$/,"$1"),a=a.replace(/^(['|"])*(\S*(?:\s+\S+)*)\1$/,"$2"));return a}function o(a,b){var c=null,e={},b=b||{};if(f.isString(a))for(;c=v.exec(a);)c[2]=b.hasOwnProperty(c[1])?b[c[1]]:c[2],c[2]&&(e[c[1]]=x(c[2])),a=a.replace(v,"");return e}function r(a){a=(f.isString(a)&&a.indexOf("/")>-1?a:m.baseURI)+"";return a.substr(0,a.lastIndexOf("/")+1)}function p(a,b){b&&!w.test(b)&&b.indexOf("/")!==0&&(b=a+b);return b}
function s(a,b){for(var c=null;a.indexOf("&amp;")>-1;)a=a.replace("&amp;","&");b.proxy=b.proxy||i.proxy;f.isFunction(b.firewall)?a=b.firewall.apply(b,[a]):!b.monolithic&&b.proxy&&(c=a.match(w))&&c[2]!==document.domain&&(a=b.proxy+escape(a));return a}function l(a,b){var c=null,e=!0,g=null,j="",j=0,b=b||{};if(d.isAlive(a))if(g=h[a].chunks.shift(),f.isObject(g)&&g.src){c={success:function(c){if(f.isString(c.responseText))if(g.type===i.JSNODE)y(a,c.responseText,b);else if(g.type===i.CSSNODE&&d.applyCSS(c.responseText,
g.params,b))k[b.hash].status=i.DISPATCHED,l(a,b)},failure:function(){l(a,b)}};b.hash=k.length;for(j=0;j<k.length;j++)if(k[j].uri==g.src){k[j].status==i.DISPATCHED&&!b.override&&(e=!1);b.hash=j;break}if(e){if(j=s(g.src,b),f.isString(j)&&j!=="")k[b.hash]={uri:g.src,proxy:j,status:i.LOADING},b.handle=q.asyncRequest("GET",j,c)}else l(a,b)}else b.hash=null,y(a,g.content,b);else d.kill(a),f.isFunction(b.after)&&b.after.apply(b,[b.element])}function y(a,b,c){var e=i.EMPTY;if(b&&b!==""){c.scope=c.scope?c.scope:
window;try{if(e=i.DISPATCHED,this.scriptScope=null,!c.hash||k[c.hash].status!=i.DISPATCHED)d.area=a,d.destroyer=h[a].destroyer,this.scriptScope=new new Function("_container_",b+"; return this;")(c.scope)}catch(g){if(e=i.ERROR,f.isFunction(c.error))c.error.apply(c,[a,b,k]);else throw Error("Dispacher: Script Execution Error ("+g+")");}}if(f.isNumber(c.hash))k[c.hash].status=e,c.hash=null;l(a,c)}function G(a,b,c){c.action=c.action?c.action:"replace";switch(c.action){case "tabview":z(a.get("contentEl"),
c);try{a.set("content",b)}catch(e){return!1}break;case "update":b=a.innerHTML+b;try{a.innerHTML=b}catch(g){return!1}break;default:z(a,c);try{a.innerHTML=b}catch(d){return!1}}return!0}function z(a,b){var c=b.guid,e=0;f.isObject(h[c].destroyer)&&h[c].destroyer.fire(a,b);if(t.inDocument(a))for(e=0;e<a.childNodes.length;e++)n.purgeElement(a.childNodes[e],!0);t.addClass(a,H);h[c].destroyer=new YAHOO.util.CustomEvent("destroyer");f.isFunction(b.onDestroy)&&h[c].destroyer.subscribe(b.onDestroy)}function I(a,
b,c){c=c||{};c.uri=c.uri||null;c.relative=c.relative||m.relative;var e=!1,g=r(c.uri),b=b.replace(E,function(a,b,e){e&&d.applyCSS(e,o(b),c);return""}),b=b.replace(C,function(b,d){if(d&&(e=d.match(D)))c.relative&&(e[2]=p(g,e[2])),h[a].chunks.push({src:e[2],content:"",type:i.CSSNODE,params:o(d)});return""});return b=b.replace(A,function(b,d,f){if(d&&(e=d.match(B)))c.relative&&(e[2]=p(g,e[2])),h[a].chunks.push({src:e[2],content:"",type:i.JSNODE,params:o(d)});f&&h[a].chunks.push({src:null,content:f,type:i.JSNODE,
params:o(d)});return""})}var d={},h={},k=[],m={relative:!1,baseURI:document.location},H="yui-dispatchable";d.area=null;d.destroyer=null;d.fetch=function(a,b,c){c=c||{};c.uri=b;var e={success:function(b){b.responseText!="undefined"&&d.process(a,b.responseText,c)},failure:function(){}};if(b){b=s(b,c);c.handle=q.asyncRequest("GET",b,e);c.element=a;if(f.isFunction(c.before))c.before.apply(c,[c.element]),c.before=null;return c.handle}return null};d.post=function(a,b,c,e,d){d=d||{};if(d.uri=b){b=s(b,d);
d.handle=q.asyncRequest("POST",b,e,c);d.element=a;if(f.isFunction(d.before))d.before.apply(d,[d.element]),d.before=null;return d.handle}return null};d.process=function(a,b,c){var d=null,c=c||{};if(f.isObject(a)||(a=u(a)))d=c.guid||n.generateId(a),this.kill(d),c.element=a,c.content=b,c.guid=d,f.isFunction(c.before)&&c.before.apply(c,[c.element]),G(a,I(d,b,c),c)&&l(d,c);return d};d.delegate=function(a,b,c){c=c||{};c.action="tabview";c.uri=a.get("dataSrc")||null;a.loadHandler.success=function(b){d.process(a,
b.responseText,c)};f.isObject(b)&&b.addTab(a)};d.applyCSS=function(a,b,c){var b=b||{},d=document.createElement("style"),g=b.href||"",c=c||{};c.uri=c.uri||m.baseURI;c.relative=c.relative||m.relative;c.relative&&(g=r(c.uri),g=p(g,b.href));g=r(g);a=a.replace(F,function(a,b){b=x(b);return b="url("+p(g,b)});d.type="text/css";f.isObject(d.styleSheet)?d.styleSheet.cssText=a:d.appendChild(document.createTextNode(a));try{document.getElementsByTagName("head")[0].appendChild(d)}catch(h){throw Error("Dispacher: CSS Processing Error ("+
h+")");}return!0};d.jsLoader=function(a,b){if(f.isString(a)&&a!=="")return b=b||{},n.generateId(b),d.kill(b.id),h[b.id].chunks=[{src:a,content:"",type:i.JSNODE,params:{href:a}}],l(b.id,b),b.id;return null};d.cssLoader=function(a,b){if(f.isString(a)&&a!=="")return b=b||{},n.generateId(b),d.kill(b.id),h[b.id].chunks=[{src:a,content:"",type:i.CSSNODE,params:{href:a}}],l(b.id,b),b.id;return null};d.isAlive=function(a){return a&&f.isObject(h[a])&&h[a].chunks.length>0};d.kill=function(a){if(a&&!f.isObject(h[a]))h[a]=
{chunks:[],destroyer:null};else if(this.isAlive(a))h[a].chunks=[]};d.destroy=function(a){this.kill(a);a&&!f.isObject(h[a])&&h[a].destroyer.fire(u(a),{})};d.onDestroy=function(a){if(f.isObject([a])&&f.isObject(h[a].destroyer))return h[a].destroyer.subscribe.apply(d,[arguments.shift()]),!0;return!1};d.init=function(a){a=a||{};a.relative=a.relative||!1;m=a};d.toString=function(){return"Dispatcher Manager Plugin (Singlenton)"};return d}()})();
YAHOO.register("dispatcher",YAHOO.util.Dispatcher,{version:"2.3.0",build:"204"});
