var TbgTimer={startTbgJs:new Date,log:function(){}},Tobago={COMPONENT_SEP:":",SUB_COMPONENT_SEP:"::",EMPTY_HREF:window.all?"#":"javascript:;",scriptIdRegExp:RegExp("[/.-]","g"),scriptFragmentRegExp:/(?:<script(?:\n|.)*?>)(?:(?:\n|\s)*?<!--)?((\n|.)*?)(?:<\/script>)/,page:null,form:null,action:null,contextPath:null,blankPage:null,focusId:undefined,errorFocusId:undefined,lastFocusId:undefined,resizeAction:undefined,resizeEventCount:0,htmlIdIndex:0,createHtmlId:function(){return"__tbg_id_"+this.htmlIdIndex++},
reloadTimer:{},jsObjects:[],eventListeners:[],browser:undefined,acceleratorKeys:{set:function(a){var b=a.modifier+a.key;this[b]||(this[b]=a)},get:function(a){if(!a.type!=Tobago.Utils.acceleratorKeyEvent()){var b=a.which?a.which:a.keyCode;if(b!=0){b=String.fromCharCode(b).toLowerCase();var c="";if(a.altKey)c+="alt";if(a.ctrlKey||a.metaKey)c+="ctrl";if(a.shiftKey)c+="shift";if(c.length==0)c="none";return this[c+b]}}},remove:function(a){if(a.ieHelperElementId!=null){var b=document.getElementById(a.ieHelperElementId);
b!=null&&b.parentNode.removeChild(b)}a=a.modifier+a.key;this[a]&&delete this[a]},observe:function(a){if(!a)a=window.event;var b=this.get(a);if(b){a.cancelBubble=true;if(a.stopPropagation){a.stopPropagation();a.preventDefault()}return b.func(a)}}},registeredScripts:{},scriptLoaders:[],ajaxComponents:{},pageIsComplete:false,scriptLoadingActive:false,isSubmit:false,initMarker:false,init:function(a){if(!this.initMarker){this.initMarker=true;this.page=this.element(a);this.form=this.element(this.page.id+
this.SUB_COMPONENT_SEP+"form");this.addBindEventListener(this.form,"submit",this,"onSubmit");this.action=this.element(this.form.id+"-action");this.contextPath=this.element(this.page.id+this.SUB_COMPONENT_SEP+"context-path");this.blankPage=this.contextPath.value+"/org/apache/myfaces/tobago/renderkit/html/standard/blank.html";this.actionPosition=this.element(this.page.id+this.SUB_COMPONENT_SEP+"action-position");this.addBindEventListener(window,"unload",this,"onUnload");Tobago.init0();this.applicationOnload&&
this.applicationOnload();this.addBindEventListener(document,Tobago.Utils.acceleratorKeyEvent(),this.acceleratorKeys,"observe");Tobago.resizeAction&&window.setTimeout(Tobago.registerResizeAction,1E3);window.setTimeout(Tobago.finishPageLoading,1)}},finishPageLoading:function(){Tobago.registerCurrentScripts();Tobago.startScriptLoaders();Tobago.pageIsComplete=true;Tobago.setFocus()},registerResizeAction:function(){Tobago.addEventListener(window,"resize",Tobago.resizePage)},onSubmit:function(){if(jQuery.isFunction(Tobago.applicationOnsubmit))if(!Tobago.applicationOnsubmit()){this.isSubmit=
false;Tobago.action.value=oldAction;Tobago.form.target=oldTarget;return false}var a=Tobago.element("tobago::partialIds");a&&this.form.removeChild(a);this.isSubmit=true;a=this.createInput("hidden",this.form.id+"-clientDimension");a.value=jQuery("body").width()+";"+jQuery("body").height();this.form.appendChild(a);Tobago.onBeforeUnload();return true},onBeforeUnload:function(){Tobago.transition&&Tobago.createOverlay(jQuery("body"));Tobago.transition=Tobago.oldTransition},createOverlay:function(a,b){if(a==
null||typeof a.size!="function"){a=Tobago.element(a);if(!a)return;a=jQuery(a)}if(a.children(".tobago-page-overlay").size()>0)if(a.children(".tobago-page-overlay-markup-error").size()>0)Tobago.deleteOverlay(a);else return;Tobago.ie6bugfix(a.get(0));a.append("<div class='tobago-page-overlay tobago-page-overlay-markup-"+(b?"error":"wait")+"'><div class='tobago-page-overlayCenter'><img></div></div>");var c=a.find(".tobago-page-overlayCenter"),d=c.children("img"),e=b?jQuery("body > .tobago-page-overlayErrorPreloadedImage").attr("src"):
jQuery("body > .tobago-page-overlayWaitPreloadedImage").attr("src");d.attr("src",e);c.show();jQuery.browser.msie&&parseInt(jQuery.browser.version)<=6&&a.children(".tobago-page-overlay").css({width:a.css("width"),height:a.css("height")});a.children(".tobago-page-overlay").css({backgroundColor:jQuery(".tobago-page").css("background-color"),filter:"alpha(opacity=80)",opacity:0}).show().delay(b?0:1E3).animate({opacity:"0.8"},b?0:250,"linear",function(){jQuery.browser.msie&&parseInt(jQuery.browser.version)<=
6&&d.attr("src",d.attr("src"))})},deleteOverlay:function(a){if(a==null||typeof a.size!="function"){a=Tobago.element(a);if(!a)return;a=jQuery(a)}a.children(".tobago-page-overlay").remove()},ie6bugfix:function(a){if(this.getBrowser().type=="msie"&&this.getBrowser().version<=6){var b=document.createElement("IFRAME");b.id=a.id+"-iframe-overlay";b.style.backgroundColor="red";b.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)";b.style.zIndex=9999;b.frameBorder="0";b.style.position=
"absolute";b.src=Tobago.blankPage;b.style.top="0px";b.style.left="0px";b.style.width=a.scrollWidth+"px";b.style.height=a.scrollHeight+"px";a.appendChild(b)}},onUnload:function(){if(this.isSubmit&&this.applicationOnunload)this.applicationOnunload();else!this.isSubmit&&this.applicationOnexit&&this.applicationOnexit();this.destroyObjects()},addJsObject:function(a){this.jsObjects[this.jsObjects.length]=a},destroyObjects:function(){this.removeEventListeners();for(var a=0;a<this.jsObjects.length;a++)try{this.destroyObject(this.jsObjects[a])}catch(b){}this.jsObjects.length=
0;delete this.jsObjects;delete this.page;delete this.form;delete this.action;delete this.actionPosition;delete this.contextPath;delete this.blankPage;delete this.lastFocusId},removeEventListeners:function(){for(var a=0,b=0;b<this.eventListeners.length;b++){var c=this.eventListeners[b];this.removeEventListener(c);delete c.element;delete c.event;delete c.func;this.eventListeners[b]=undefined;a++}delete this.eventListeners},destroyObject:function(a){if(a.htmlElement){delete a.htmlElement.jsObjects;delete a.htmlElement}else if(typeof a==
"Object")this.destroyJsObject(a);else if(typeof a=="Array"){a.length=0;delete a}},destroyJsObject:function(a){try{for(var b in a)delete a[b];delete a}catch(c){}},isPageComplete:function(){return this.pageIsComplete},submitAction:function(a,b,c){c=c||{};var d=c.transition===undefined||c.transition==null||c.transition;c.focus&&this.form.appendChild(this.createInput("hidden",this.page.id+this.SUB_COMPONENT_SEP+"lastFocusId",c.focus));Tobago.setActionPosition(a);Tobago.Popup.unlockBehind();Tobago.Transport.request(function(){if(!this.isSubmit){this.isSubmit=
true;Tobago.Transport.requests.shift();var e=Tobago.action.value,f=Tobago.form.target;Tobago.action.value=b;if(c.target)Tobago.form.target=c.target;Tobago.oldTransition=Tobago.transition;Tobago.transition=d&&!c.target;var g=Tobago.onSubmit();if(g)try{Tobago.form.submit()}catch(h){Tobago.deleteOverlay(jQuery("body"));Tobago.isSubmit=false;alert("Submit failed: "+h)}Tobago.action.value=e;if(c.target)Tobago.form.target=f;if(c.target||!d||!g){this.isSubmit=false;Tobago.Transport.pageSubmited=false}}},
true)},setActionPosition:function(a){var b=jQuery(a).offset(),c=Tobago.getWidth(a);a=Tobago.getHeight(a);Tobago.actionPosition.value=(b?parseInt(b.left)+"px,":"0px,")+(b?parseInt(b.top)+"px,":"0px,")+c+"px,"+a+"px"},getJsfState:function(){var a=Tobago.element(Tobago.page.id+Tobago.SUB_COMPONENT_SEP+"jsf-state-container"),b="";if(a)for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.tagName=="INPUT"){if(b.length>0)b+="&";b+=encodeURIComponent(d.name);b+="=";b+=encodeURIComponent(d.value)}}return b},
replaceJsfState:function(a){if(a.indexOf("<script type")==0){a=a.match(RegExp(Tobago.scriptFragmentRegExp,"im"),"")[1];eval(a)}else{var b=Tobago.element(this.page.id+this.SUB_COMPONENT_SEP+"jsf-state-container");if(b)b.innerHTML=a}},clearReloadTimer:function(a){(a=Tobago.reloadTimer[a])&&clearTimeout(a)},addReloadTimeout:function(a,b,c){Tobago.clearReloadTimer(a);Tobago.reloadTimer[a]=setTimeout(b,c)},resetForm:function(){this.form.reset()},navigateToUrl:function(a){document.location.href=a},registerScript:function(a){this.registeredScripts[this.genScriptId(a)]=
true},hasScript:function(a){return this.registeredScripts[this.genScriptId(a)]},genScriptId:function(a){a=a.substring(a.indexOf("/html/"));return a.replace(this.scriptIdRegExp,"_")},styleFileLoaded:function(a){for(var b=document.getElementsByTagName("head")[0].childNodes,c=0;c<b.length;c++){var d=b[c];if(d.tagName&&d.tagName.toUpperCase()=="LINK")if(d.rel=="stylesheet"&&d.type=="text/css"&&a==d.href.replace(/^http:\/\/.*?\//,"/"))return true}return false},ensureStyleFile:function(a){if(!this.styleFileLoaded(a)){var b=
document.createElement("link");b.rel="stylesheet";b.type="text/css";b.href=a;document.getElementsByTagName("head")[0].appendChild(b)}},ensureStyleFiles:function(a){for(var b=0;b<a.length;b++)this.ensureStyleFile(a[b])},registerCurrentScripts:function(){for(var a=document.getElementsByTagName("head")[0].childNodes,b=0;b<a.length;b++){var c=a[b];c.nodeType==1&&c.tagName.toUpperCase()=="SCRIPT"&&typeof c.src=="string"&&Tobago.registerScript(c.src)}},addScriptLoader:function(a){if(!this.pageIsComplete||
this.scriptLoadingActive)this.scriptLoaders.push(a);else{this.scriptLoadingActive=true;a.ensureScripts()}},startScriptLoaders:function(){if(this.pageIsComplete)if(this.scriptLoaders.length>0){this.scriptLoadingActive=true;this.scriptLoaders.shift().ensureScripts()}else{this.scriptLoadingActive=false;delete this.tbgScLoSt}else for(;this.scriptLoaders.length>0;)this.scriptLoaders.shift().executeCommands()},addAjaxComponent:function(a,b){if(b)this.ajaxComponents[a]=b},reloadComponent:function(a,b,c,
d){var e=this.ajaxComponents[b];if(typeof e=="string"){c||(c=e);Tobago.Updater.update(a,c,b,d)}else if(typeof e=="object"&&e.tagName){if(!c)c=e.id;Tobago.Updater.update(a,c,b,d)}else if(typeof e=="object"&&typeof e.reloadWithAction=="function"){c||(c=e.id?e.id:"_tbg_no_action_");e.reloadWithAction(a,c,d)}else e===undefined&&Tobago.Updater.update(a,c,b,d)},toolbarFocus:function(a,b){window.event&&b.altKey&&a.click()},selectOneListboxChange:function(a){if(a.oldValue==undefined)a.oldValue=-1},selectOneListboxClick:function(a){if(a.oldValue==
undefined||a.oldValue==a.selectedIndex)a.selectedIndex=-1;a.oldValue=a.selectedIndex},selectOneRadioInit:function(a){a=document.getElementsByName(a);for(var b=0;b<a.length;b++)a[b].oldValue=a[b].checked},selectOneRadioClick:function(a,b,c,d){b=document.getElementsByName(b);for(var e=0;e<b.length;e++)if(d)b[e].checked=b[e].oldValue;else if(b[e]!=a){b[e].checked=false;b[e].oldValue=false}if(!c&&!d){if(a.oldValue==a.checked)a.checked=false;a.oldValue=a.checked}},resizePage:function(){Tobago.resizeEventCount++;
window.setTimeout(Tobago.resizePageAction,250)},resizePageAction:function(){Tobago.resizeEventCount--;Tobago.resizeEventCount==0&&Tobago.resizeAction()},escapeClientId:function(a){return Tobago.Utils.escapeClientId(a)},selectWidthJQuery:function(a,b){return Tobago.Utils.selectWidthJQuery(a,b)},calculateScrollbarWeights:function(a){a=jQuery(Tobago.Utils.escapeClientId(a));var b=a.prev();a.val(""+(100-b.prop("clientWidth"))+";"+(100-b.prop("clientHeight")))},clickOnElement:function(a){if(a=this.element(a))if(a.click)a.click();
else{var b=document.createElement("input");b.type="button";b.style.width="0px;";b.style.height="0px;";b.style.border="0px;";b.style.padding="0px;";b.style.margin="0px;";a.appendChild(b);b.click();a.removeChild(b)}},setFocus:function(){var a;a=this.errorFocusId!==undefined?this.errorFocusId:this.lastFocusId!==undefined?this.lastFocusId:this.focusId;var b=this.element(a);if(!b&&a!==undefined){a=document.getElementsByName(a);if(a.length>0)b=a[0]}if(b)try{b.focus()}catch(c){}else if(typeof this.focusId==
"undefined"){b=32768;var d=a=null,e=0;a:for(;e<document.forms.length;e++){var f=document.forms[e];if(f!=null)for(var g=0;g<f.elements.length;g++){var h=f.elements[g];if(h!=null)if(!h.disabled&&!h.readOnly&&this.isFocusType(h.type)){if(b>h.tabIndex&&h.tabIndex>0){b=h.tabIndex;a=h;if(b==1)break a}if(d==null&&h.tabIndex==0)d=h}}}if(a!=null)try{a.focus()}catch(j){}else if(d!=null)try{d.focus()}catch(k){}}},isFocusType:function(a){return a=="text"||a=="textarea"||a=="select-one"||a=="select-multiple"||
a=="checkbox"||a=="password"||a=="radio"||a=="reset"||a=="submit"?true:false},isInputElement:function(a){a=a.toUpperCase();if(a=="INPUT"||a=="TEXTAREA"||a=="SELECT"||a=="A"||a=="BUTTON")return true;return false},createInput:function(a,b,c){var d=document.createElement("INPUT");if(a)d.type=a;if(b)d.name=b;if(c)d.value=c;return d},addCssClass:function(a,b){a=Tobago.element(a);a.className=a.className+" "+b},removeCssClass:function(a,b){a=Tobago.element(a);for(var c=" "+a.className+" ",d=RegExp(" "+b+
" ","g");c.match(d);)c=c.replace(d," ");c=c.replace(/  /g," ");a.className=c},clearSelection:function(){if(document.selection)document.selection.empty();else window.getSelection&&window.getSelection().removeAllRanges()},getRuntimeStyle:function(a){return a.runtimeStyle?a.runtimeStyle:document.defaultView.getComputedStyle(a,null)},findAnchestorWithTagName:function(a,b){for(a=this.element(a);a.parentNode&&(!a.tagName||a.tagName.toUpperCase()!=b.toUpperCase());)a=a.parentNode;return a},setElementWidth:function(a,
b){var c=this.element(a);if(c)c.style.width=b},addEventListener:function(a,b,c){a=new Tobago.EventListener(a,b,c);a.element.addEventListener?a.element.addEventListener(a.event,a.func,false):a.element.attachEvent("on"+a.event,a.func)},removeEventListener:function(a,b,c){if(!b&&!c&&a.element&&a.event&&a.func){c=a.func;b=a.event;a=a.element}if(a.removeEventListener)a.removeEventListener(b,c,true);else a.detachEvent&&a.detachEvent("on"+b,c)},bind:function(a,b){for(var c=[],d=2;d<arguments.length;d++)c.push(arguments[d]);
return function(){for(var e=[],f=0;f<arguments.length;f++)e.push(arguments[f]);a[b].apply(a,e.concat(c))}},bind2:function(a,b){for(var c=[],d=2;d<arguments.length;d++)c.push(arguments[d]);return function(){for(var e=0;e<arguments.length;e++)c.push(arguments[e]);a[b].apply(a,c)}},bindAsEventListener:function(a,b){return function(c){a[b].call(a,c||window.event)}},addBindEventListener:function(a,b,c,d){this.addEventListener(a,b,this.bindAsEventListener(c,d))},stopEventPropagation:function(a){if(!a)a=
window.event;a.cancelBubble=true;if(a.stopPropagation){a.stopPropagation();a.preventDefault()}},getAbsoluteTop:function(a){for(var b=0,c=false;a&&a.offsetParent;){b+=a.offsetTop;b-=a.scrollTop;if(c&&a.currentStyle)b+=a.currentStyle.borderTopWidth.replace(/\D/g,"")-0;a=a.offsetParent;c=true}return Math.max(b,0)},getWidth:function(a){var b=0;if(a){b=a.offsetWidth;if(b===undefined)b=0}return b},getHeight:function(a){var b=0;if(a){b=a.offsetHeight;if(b===undefined)b=0}return b},getAbsoluteLeft:function(a){for(var b=
0,c=false;a&&a.offsetParent;){b+=a.offsetLeft;b-=a.scrollLeft;if(c&&a.currentStyle)b+=a.currentStyle.borderLeftWidth.replace(/\D/g,"")-0;a=a.offsetParent;c=true}return b},getBrowserInnerLeft:function(){return document.all?document.body.scrollLeft:window.scrollX},getBrowserInnerTop:function(){return document.all?document.body.scrollTop:window.scrollY},doEditorCommand:function(a,b){var c=this.element(b);c.value.substring(c.selectionStart,c.selectionEnd);c.selectionStart--;c.focus()},element:function(a){try{if(typeof a===
"string")return document.getElementById(a);if(typeof a.currentTarget=="object")return a.currentTarget;if(typeof a.srcElement=="object")return a.srcElement;if(typeof a.tagName=="string")return a}catch(b){}},extend:function(a,b){for(var c in b)a[c]=b[c];return a},fixPngAlphaAll:function(){},fixPngAlpha:function(){},getBrowser:function(){if(!this.browser){var a=navigator.userAgent.toLowerCase();this.browser=a.indexOf("msie 7")!=-1?{type:"msie",version:7}:a.indexOf("msie")!=-1?{type:"msie",version:-1}:
a.indexOf("gecko")!=-1?{type:"mozilla",version:-1}:{type:"unknown",version:-1}}return this.browser},replaceElement:function(a,b){if(typeof window.Range!="undefined"&&typeof Range.prototype.createContextualFragment=="function"){var c=document.createRange();c.setStartBefore(a);c=c.createContextualFragment(b);a.parentNode.replaceChild(c,a)}else{a.insertAdjacentHTML("beforeBegin",b);a.parentNode.removeChild(a)}},parsePartialIds:function(a){if(jQuery.isArray(a))return a;return a.split(",")},setDefaultAction:function(a){Tobago.action.value=
a},isFunction:function(a){return typeof a=="function"||typeof a=="object"&&a.call},raiseEvent:function(a,b){if(document.createEvent){var c=document.createEvent("Events");c.initEvent(a,true,true);b.dispatchEvent(c)}else if(document.createEventObject){c=document.createEventObject();b.fireEvent("on"+a,c)}},toString:function(a){var b="",c;for(c in a)if(c&&a[c]){var d=""+a[c];if(d!="")b+="\r\n"+c+"="+d}return b}};
Tobago.init0=function(a){Tobago.Menu.init(a);Tobago.TabGroup.init(a);Tobago.Tree.init(a);Tobago.ToolBar.init(a);Tobago.SelectManyShuttle.init(a);Tobago.fixPngAlphaAll(a)};Tobago.Config={set:function(a,b,c){this[a]||(this[a]={});this[a][b]=c},get:function(a,b){for(;a&&!(this[a]&&this[a][b]);)a=this.getFallbackName(a);return a?this[a][b]:0},fallbackNames:{},getFallbackName:function(a){if(this.fallbackNames[a])return this.fallbackNames[a];else if(a!="Tobago")return"Tobago"}};
Tobago.Config.set("Tobago","themeConfig","standard/standard");Tobago.In=function(a,b,c,d){this.id=a;this.required=b;this.requiredClass=c;this.maxLength=d;this.setup()};
Tobago.In.prototype.setup=function(){var a;if(this.required){a=Tobago.element(this.id);a.value&&a.value.length>0&&Tobago.removeCssClass(this.id,this.requiredClass);Tobago.addBindEventListener(a,"focus",this,"enterRequired");Tobago.addBindEventListener(a,"blur",this,"leaveRequired")}if(this.maxLength&&this.maxLength>0){a=Tobago.element(this.id);Tobago.addBindEventListener(a,"change",this,"checkMaxLength");Tobago.addBindEventListener(a,"keypress",this,"checkMaxLength");jQuery.browser.msie&&Tobago.addBindEventListener(a,
"paste",this,"checkMaxLengthOnPaste")}};Tobago.In.prototype.checkMaxLengthOnPaste=function(a){if(!a)a=window.event;var b=Tobago.element(a),c=window.clipboardData.getData("Text"),d=document.selection.createRange();if(b.value.length-d.text.length+c.length>this.maxLength){c=c.substring(0,this.maxLength-b.value.length+d.text.length);d.text=c;a.returnValue=false}};
Tobago.In.prototype.checkMaxLength=function(a){if(!a)a=window.event;var b=Tobago.element(a),c=b.value.length;if(c>this.maxLength){b.value=b.value.substr(0,this.maxLength);return true}if(c<this.maxLength)return true;if(a.type=="change")return true;if(a)if(a.which<32||a.which==118&&(a.ctrlKey||a.metaKey))return true;return false};Tobago.In.prototype.enterRequired=function(){Tobago.removeCssClass(this.id,this.requiredClass)};
Tobago.In.prototype.leaveRequired=function(){var a=Tobago.element(this.id);if(!a.value||a.value.length==0)Tobago.addCssClass(a.id,this.requiredClass)};Tobago.Panel=function(a,b,c){this.startTime=new Date;this.id=a;this.autoReload=c;this.options={};this.setup();Tobago.addAjaxComponent(this.id,this)};Tobago.Panel.prototype.setup=function(){this.initReload()};Tobago.Panel.prototype.afterDoUpdateSuccess=function(){this.setup()};Tobago.Panel.prototype.afterDoUpdateNotModified=function(){this.setup()};
Tobago.Panel.prototype.afterDoUpdateError=function(){this.setup()};Tobago.Panel.prototype.initReload=function(){typeof this.autoReload=="number"&&this.autoReload>0&&Tobago.addReloadTimeout(this.id,Tobago.bind2(this,"reloadWithAction",null,this.id),this.autoReload)};Tobago.Panel.prototype.reloadWithAction=function(a,b,c){var d=Tobago.extend({},this.options);d=Tobago.extend(d,c);Tobago.Updater.update(a,b,this.id,d)};Tobago.Panel.prototype.prepareReload=function(){Tobago.createOverlay(jQuery(Tobago.Utils.escapeClientId(this.id)))};
Tobago.EventListener=function(a,b,c){this.element=a;this.event=b;this.func=c;Tobago.eventListeners[Tobago.eventListeners.length]=this};
Tobago.AcceleratorKey=function(a,b,c){this.func=a;this.key=b.toLowerCase();c||(c="alt");this.modifier=c;if(document.all&&(c=="alt"||c=="ctrl")){if(c=="alt"){this.ieHelperElementId="ieHelperElement_"+c+b;c=document.createElement("span");document.body.appendChild(c);c.innerHTML='<a id="'+this.ieHelperElementId+'" href="javascript:;" tabindex="-1" accesskey="'+b.toLowerCase()+'" onclick="return false;" ></a>';c.firstChild.attachEvent("onfocus",function(d){a(d)});Tobago.acceleratorKeys.set(this)}}else Tobago.acceleratorKeys.set(this)};
Tobago.ScriptLoader=function(a,b){this.scriptIndex=0;this.names=a;this.doAfter=b||";";this.ensureScript=function(c){this.actualScript=c;if(Tobago.hasScript(this.actualScript))this.ensureScripts();else{this.scriptElement=document.createElement("script");this.scriptElement.type="text/javascript";this.scriptElement.src=c;if(typeof this.scriptElement.onreadystatechange!="undefined")this.scriptElement.onreadystatechange=Tobago.bind(this,"stateReady");else this.scriptElement.onload=Tobago.bind(this,"stateOnLoad");
document.getElementsByTagName("head")[0].appendChild(this.scriptElement)}};this.stateReady=function(){if(window.event.srcElement.readyState=="loaded"||window.event.srcElement.readyState=="complete"){this.scriptElement.onreadystatechange=null;Tobago.registerScript(this.actualScript);this.ensureScripts()}};this.stateOnLoad=function(){this.scriptElement.onload=null;Tobago.registerScript(this.actualScript);this.ensureScripts()};this.ensureScripts=function(){if(this.scriptIndex<this.names.length)this.ensureScript(this.names[this.scriptIndex++]);
else{this.executeCommands();if(this.scriptElement){this.scriptElement.onreadystatechange&&delete this.scriptElement.onreadystatechange;this.scriptElement.onload&&delete this.scriptElement.onload;this.scriptElement&&delete this.scriptElement}delete this.actualScript;delete this.names;delete this.doAfter;Tobago.startScriptLoaders()}};this.executeCommands=function(){try{eval(this.doAfter)}catch(c){throw c;}};Tobago.addScriptLoader(this)};
Tobago.Transport={requests:[],currentActionId:null,pageSubmited:false,ajaxTransport:undefined,hasTransport:function(){if(this.ajaxTransport===undefined)try{this.ajaxTransport=this.getAjaxTransport()}catch(a){try{new ActiveXObject("Msxml2.XMLHTTP");this.ajaxTransport=this.getAjaxTransport()}catch(b){try{new ActiveXObject("Microsoft.XMLHTTP");this.ajaxTransport=this.getAjaxTransport()}catch(c){this.ajaxTransport=false}}}return this.ajaxTransport&&typeof this.ajaxTransport.request=="function"},request:function(a,
b,c){var d=0;if(b){this.pageSubmited=true;d=this.requests.push(a)}else if(this.pageSubmited)return false;else{if(c&&this.currentActionId==c)return false;d=this.requests.push(a);this.currentActionId=c}if(d==1){this.startTime=(new Date).getTime();this.requests[0]()}return true},requestComplete:function(){this.requests.shift();this.currentActionId=null;if(this.requests.length>0){this.startTime=(new Date).getTime();this.requests[0]()}},getAjaxTransport:function(){try{if(jQuery&&typeof jQuery.ajax=="function")return Tobago.Transport.JqueryTransport}catch(a){}try{if(dojo&&
typeof dojo.xhrPost=="function")return Tobago.Transport.DojoTransport}catch(b){}}};
Tobago.Transport.JqueryTransport={transportOptions:{dataType:"json",type:"POST",cache:false,complete:function(){setTimeout(Tobago.bind(Tobago.Transport,"requestComplete"),15)}},request:function(a){var b=Tobago.extend({},this.transportOptions);b.timeout=a.timeout;b.success=function(c,d){a.resultData=c;a.textStatus=d;Tobago.Updater.onSuccess(a)};b.error=function(c,d){a.xhr=c;a.textStatus=d;Tobago.Updater.onError(a)};return Tobago.Transport.request(function(){a.oldValue=Tobago.action.value;b.url=a.url;
Tobago.action.value=a.actionId;Tobago.partialRequestIds.value=a.ajaxComponentIds;b.data=jQuery(Tobago.form).serialize();a.xhr=jQuery.ajax(b)},false,a.actionId)}};
Tobago.Transport.DojoTransport={transportOptions:{handleAs:"json"},request:function(a){var b=Tobago.extend({},this.transportOptions);b.timeout=a.timeout;b.load=function(c,d){a.resultData=c;a.xhr=d.xhr;try{if(d.xhr.status===200){a.textStatus="success";Tobago.Updater.onSuccess(a);return}else if(d.xhr.status===304){a.textStatus="notmodified";Tobago.Updater.onSuccess(a);return}}catch(e){}Tobago.Updater.onError(a)};return Tobago.Transport.request(function(){a.oldValue=Tobago.action.value;b.url=a.url;b.form=
Tobago.form.id;Tobago.action.value=a.actionId;Tobago.partialRequestIds.value=a.ajaxComponentIds;dojo.xhrPost(b)},false,a.actionId)},error:function(a,b){requestOptions.xhr=b.xhr;if(b.xhr.status==304){requestOptions.textStatus="notmodified";Tobago.Updater.onSuccess(requestOptions)}else{requestOptions.textStatus="error";Tobago.Updater.onError(requestOptions)}Tobago.Transport.requestComplete();return a}};
function tobago_showHidden(){for(var a=0;a<document.forms.length;a++)for(var b=document.forms[a],c=0;c<b.elements.length;c++)if(b.elements[c].type=="hidden")b.elements[c].type="text"}var LOG={debug:function(){},info:function(){},warn:function(){},error:function(){},show:function(){}};
Tobago.Updater={CODE_SUCCESS:200,CODE_REDIRECT:302,CODE_NOT_MODIFIED:304,CODE_RELOAD_REQUIRED:309,CODE_ERROR:500,WAIT_ON_ERROR:false,WAIT_ON_RELOAD:false,options:{createOverlay:true,timeout:5E3},update:function(a,b,c,d){if(Tobago.Transport.hasTransport()){if(jQuery.isFunction(Tobago.applicationOnsubmit))if(!Tobago.applicationOnsubmit())return;var e=Tobago.extend({},this.options);d&&Tobago.extend(e,d);e.source=a;e.actionId=b;e.ajaxComponentIds=c;e.url=Tobago.form.action;var f;if(e.createOverlay){f=
Tobago.parsePartialIds(c);for(b=0;b<f.length;b++){d=f[b];var g=Tobago.ajaxComponents[d];if(g&&typeof g.prepareReload=="function")g.prepareReload();else g?Tobago.createOverlay(g):Tobago.createOverlay(jQuery(Tobago.Utils.escapeClientId(d)))}}Tobago.setActionPosition(a);if(!Tobago.partialRequestIds){a=document.createElement("input");a.type="hidden";a.id="tobago::partialIds";a.name=a.id;Tobago.form.appendChild(a);Tobago.partialRequestIds=a}if(!Tobago.Transport.ajaxTransport.request(e)){f||(f=Tobago.parsePartialIds(c));
this.doErrorUpdate(f)}}else Tobago.submitAction(a,b)},doErrorUpdate:function(a){for(var b=0;b<a.length;b++)this.updateComponent({ajaxId:a[b],responseCode:Tobago.Updater.CODE_ERROR})},showFailureMessage:function(){},onSuccess:function(a){if(a.textStatus==="notmodified")Tobago.Updater.handle304Response(Tobago.parsePartialIds(a.ajaxComponentIds));else{if(!a.resultData||!a.resultData.tobagoAjaxResponse){Tobago.Updater.WAIT_ON_ERROR&&alert("wait: initiating full reload");Tobago.submitAction(null,Tobago.page.id)}else if(a.resultData.responseCode==
Tobago.Updater.CODE_RELOAD_REQUIRED){a.resultData.jsfState&&Tobago.replaceJsfState(a.resultData.jsfState);Tobago.Updater.WAIT_ON_RELOAD&&alert("wait: full reload requeste: responseCode = "+a.resultData.responseCode);Tobago.submitAction(null,Tobago.page.id)}else if(a.resultData.responseCode==Tobago.Updater.CODE_REDIRECT){window.location=a.resultData.location;return}a.resultData.jsfState&&Tobago.replaceJsfState(a.resultData.jsfState);var b={},c;for(c in a.resultData)if(c.indexOf("ajaxPart_")==0){this.updateComponent(a.resultData[c]);
b[a.resultData[c].ajaxId]=true}Tobago.Updater.handleMissingResponses(a.ajaxComponentIds,b)}},handleMissingResponses:function(a,b){for(var c=Tobago.parsePartialIds(a),d,e=0;e<c.length;e++){var f=c[e];if(!b[f]){d||(d={responseCode:Tobago.Updater.CODE_NOT_MODIFIED,html:"error",script:function(){}});d.ajaxId=f;this.updateComponent(d)}}},handle304Response:function(a){for(var b=0;b<a.length;b++)Tobago.Updater.updateComponent({ajaxId:a[b],responseCode:Tobago.Updater.CODE_NOT_MODIFIED,html:"error",script:function(){}})},
onError:function(a){if(a.textStatus==="timeout")Tobago.Updater.doErrorUpdate(Tobago.parsePartialIds(a.ajaxComponentIds));else a.textStatus==="notmodified"?Tobago.Updater.handle304Response(Tobago.parsePartialIds(a.ajaxComponentIds)):Tobago.Updater.doErrorUpdate(Tobago.parsePartialIds(a.ajaxComponentIds))},updateComponent:function(a){var b=a.ajaxId;if(a.responseCode!=Tobago.Updater.CODE_RELOAD_REQUIRED)if(b=Tobago.ajaxComponents[b]){if(typeof b=="string")b=Tobago.element(b);if(typeof b.doUpdate!="function")b.doUpdate=
Tobago.Updater.doUpdate;b.doUpdate(a)}else Tobago.Updater.doUpdate(a)},doUpdate:function(a){if(typeof this.beforeDoUpdate=="function")if(!this.beforeDoUpdate())return;var b=Tobago.ajaxComponents[a.ajaxId];b=b!=null&&b.tagName!=null?jQuery(b):b!=null&&b.id!=null?jQuery(Tobago.Utils.escapeClientId(b.id)):jQuery(Tobago.Utils.escapeClientId(a.ajaxId));switch(a.responseCode){case Tobago.Updater.CODE_SUCCESS:b=jQuery(Tobago.Utils.escapeClientId(a.ajaxId));if(a.html.length>0){var c=jQuery(a.html);b.replaceWith(c)}try{eval("var updateScript = "+
a.script);eval("updateScript();");typeof this.afterDoUpdateSuccess=="function"&&this.afterDoUpdateSuccess();a.html.length>0&&Tobago.init0(c)}catch(d){throw d;}break;case Tobago.Updater.CODE_NOT_MODIFIED:typeof this.afterDoUpdateNotModified=="function"&&this.afterDoUpdateNotModified();Tobago.deleteOverlay(b);break;case Tobago.Updater.CODE_ERROR:typeof this.afterDoUpdateError=="function"&&this.afterDoUpdateError();Tobago.deleteOverlay(b);Tobago.createOverlay(b,true);break;default:Tobago.deleteOverlay(b)}}};
Tobago.ToolBar={};
Tobago.ToolBar.init=function(a){Tobago.Utils.selectWidthJQuery(a,".tobago-toolBar").find(".tobago-toolBar-item").not(".tobago-toolBar-item-markup-disabled").hover(function(){jQuery(this).toggleClass("tobago-toolBar-item-markup-hover")}).children(".tobago-toolBar-button, .tobago-toolBar-menu").mouseenter(function(){jQuery(this).addClass("tobago-toolBar-button-markup-hover").children("img").each(function(){var b=jQuery(this).data("tobago-srchover");b&&jQuery(this).attr("src",b)})}).mouseleave(function(){jQuery(this).removeClass("tobago-toolBar-button-markup-hover").children("img").each(function(){var b=jQuery(this).data("tobago-srcdefault");
b&&jQuery(this).attr("src",b)})});Tobago.Utils.selectWidthJQuery(a,".tobago-box-headerToolBar").find(".tobago-boxToolBar-item").not(".tobago-boxToolBar-item-markup-disabled").hover(function(){jQuery(this).toggleClass("tobago-boxToolBar-item-markup-hover")}).children(".tobago-boxToolBar-button, .tobago-boxToolBar-menu").mouseenter(function(){jQuery(this).addClass("tobago-boxToolBar-button-markup-hover").children("img").each(function(){var b=jQuery(this).data("tobago-srchover");b&&jQuery(this).attr("src",
b)})}).mouseleave(function(){jQuery(this).removeClass("tobago-boxToolBar-button-markup-hover").children("img").each(function(){var b=jQuery(this).data("tobago-srcdefault");b&&jQuery(this).attr("src",b)})});Tobago.Utils.selectWidthJQuery(a,".tobago-tabGroup-toolBar").find(".tobago-tabGroupToolBar-item").not(".tobago-tabGroupToolBar-item-markup-disabled").hover(function(){jQuery(this).toggleClass("tobago-tabGroupToolBar-item-markup-hover")}).children(".tobago-tabGroupToolBar-button, .tobago-tabGroupToolBar-menu").mouseenter(function(){jQuery(this).addClass("tobago-tabGroupToolBar-button-markup-hover").children("img").each(function(){var b=
jQuery(this).data("tobago-srchover");b&&jQuery(this).attr("src",b)})}).mouseleave(function(){jQuery(this).removeClass("tobago-tabGroupToolBar-button-markup-hover").children("img").each(function(){var b=jQuery(this).data("tobago-srcdefault");b&&jQuery(this).attr("src",b)})})};Tobago.ToolBar.checkToggle=function(a){a=document.getElementById(a);a.value="true"==a.value?"false":"true"};Tobago.ToolBar.setRadioValue=function(a,b){document.getElementById(a).value=b};Tobago.TabGroup={};
Tobago.TabGroup.init=function(a){a=Tobago.Utils.selectWidthJQuery(a,".tobago-tabGroup");a.filter("[switchType='client']").find(".tobago-tab").not(".tobago-tab-markup-disabled").click(function(){var b=Tobago.TabGroup.updateHidden(jQuery(this));jQuery(this).siblings(".tobago-tab-markup-selected").removeClass("tobago-tab-markup-selected");jQuery(this).addClass("tobago-tab-markup-selected");var c=jQuery(this).parents(".tobago-tabGroup:first");c.children(".tobago-tab-content-markup-selected").removeClass("tobago-tab-content-markup-selected");
c.children(".tobago-tab-content[tabgroupindex="+b+"]").addClass("tobago-tab-content-markup-selected");b=jQuery(this).parents(".tobago-tabGroup-header:first");Tobago.TabGroup.ensureScrollPosition(b)});a.filter("[switchType='reloadTab']").find(".tobago-tab").not(".tobago-tab-markup-disabled").click(function(){Tobago.TabGroup.updateHidden(jQuery(this));var b=jQuery(this).parents(".tobago-tabGroup:first");Tobago.Updater.update(b,b.attr("id"),b.attr("id"),{})});a.filter("[switchType='reloadPage']").find(".tobago-tab").not(".tobago-tab-markup-disabled").click(function(){Tobago.TabGroup.updateHidden(jQuery(this));
var b=jQuery(this).parents(".tobago-tabGroup:first");Tobago.submitAction(b.eq(0),b.attr("id"))});a.find(".tobago-tabGroupToolBar-button:first").click(function(){jQuery(this).parents(".tobago-tabGroup:first").find(".tobago-tab-markup-selected").prevAll(":not(.tobago-tab-markup-disabled):first").click()});a.find(".tobago-tabGroupToolBar-button:eq(1)").click(function(){jQuery(this).parents(".tobago-tabGroup:first").find(".tobago-tab-markup-selected").nextAll(":not(.tobago-tab-markup-disabled):first").click()});
a.find(".tobago-tabGroup-header").each(function(){Tobago.TabGroup.ensureScrollPosition(jQuery(this))})};Tobago.TabGroup.updateHidden=function(a){var b=a.parents(".tobago-tabGroup:first").children("input");a=a.attr("tabgroupindex");b.attr("value",a);return a};Tobago.TabGroup.ensureScrollPosition=function(a){var b=a.find(".tobago-tab-markup-selected"),c=b.position().left+b.outerWidth()-a.outerWidth();c>0&&a.scrollLeft(a.scrollLeft()+c+1);b=b.position().left;b<0&&a.scrollLeft(a.scrollLeft()+b)};
Tobago.SelectManyShuttle={};
Tobago.SelectManyShuttle.init=function(a){a=Tobago.Utils.selectWidthJQuery(a,".tobago-selectManyShuttle:not(.tobago-selectManyShuttle-disabled)");a.find(".tobago-selectManyShuttle-unselected").dblclick(function(){Tobago.SelectManyShuttle.moveSelectedItems(jQuery(this).parents(".tobago-selectManyShuttle"),true,false)});a.find(".tobago-selectManyShuttle-selected").dblclick(function(){Tobago.SelectManyShuttle.moveSelectedItems(jQuery(this).parents(".tobago-selectManyShuttle"),false,false)});a.find(".tobago-selectManyShuttle-addAll").click(function(){Tobago.SelectManyShuttle.moveSelectedItems(jQuery(this).parents(".tobago-selectManyShuttle"),
true,true)});a.find(".tobago-selectManyShuttle-add").click(function(){Tobago.SelectManyShuttle.moveSelectedItems(jQuery(this).parents(".tobago-selectManyShuttle"),true,false)});a.find(".tobago-selectManyShuttle-removeAll").click(function(){Tobago.SelectManyShuttle.moveSelectedItems(jQuery(this).parents(".tobago-selectManyShuttle"),false,true)});a.find(".tobago-selectManyShuttle-remove").click(function(){Tobago.SelectManyShuttle.moveSelectedItems(jQuery(this).parents(".tobago-selectManyShuttle"),false,
false)})};Tobago.SelectManyShuttle.moveSelectedItems=function(a,b,c){var d=a.find(".tobago-selectManyShuttle-unselected"),e=a.find(".tobago-selectManyShuttle-selected"),f=b?e:d;(b?d:e).find(c?"option":"option:selected").remove().appendTo(f);Tobago.SelectManyShuttle.copyValues(a)};Tobago.SelectManyShuttle.copyValues=function(a){var b=a.find(".tobago-selectManyShuttle-hidden");b.find("option").remove();a.find(".tobago-selectManyShuttle-selected option").clone().attr("selected","selected").appendTo(b)};
if(!Calendar)var Calendar={};Calendar.MONTH_LENGTH=[31,28,31,30,31,30,31,31,30,31,30,31];Calendar.isLeapYear=function(a){return a%4==0&&(a%100!=0||a%400==0)};Calendar.getMonthLength=function(a,b){if(a==2&&Calendar.isLeapYear(b))return 29;return Calendar.MONTH_LENGTH[a-1]};Calendar.getPreviousMonth=function(a){return a==1?12:a-1};Calendar.getDayOfWeek=function(a,b,c){var d=new Date;d.setDate(a);d.setMonth(b-1);d.setFullYear(c);return d.getDay()+1};
Calendar.firstDayOffset=function(a,b,c){return(Calendar.getDayOfWeek(1,a,b)+7-c)%7};Calendar._weekCount=function(a){return Math.floor((a+6)/7)};Calendar.weekCount=function(a,b,c){c=Calendar.firstDayOffset(a,b,c);a=Calendar.getMonthLength(a,b);return Calendar._weekCount(c+a)};function getFirstDayOfWeek(a){return parseInt(document.getElementById(a+":firstDayOfWeek").value,10)}function getMonthName(a,b){return document.getElementById(a+":monthNames").value.split(",")[b-1]}
function initCalendarData(a,b,c,d){document.getElementById(a+":day").value=d;document.getElementById(a+":month").value=c;document.getElementById(a+":year").value=b;recalculateValues(a)}
function addMonth(a,b){var c=0;if(b>0){c=Math.floor(b/12);b%=12}else{c=-Math.floor(-b/12);b=-(-b%12)}c=parseInt(document.getElementById(a+":year").value,10)+c;var d=parseInt(document.getElementById(a+":month").value,10)+b,e=parseInt(document.getElementById(a+":day").value,10);if(d<1){d=12;--c}else if(d>12){d=1;++c}if(e>Calendar.getMonthLength(d,c))e=Calendar.getMonthLength(d,c);initCalendarData(a,c,d,e);initCalendar(a)}
function recalculateValues(a){var b=parseInt(document.getElementById(a+":day").value,10),c=parseInt(document.getElementById(a+":month").value,10),d=parseInt(document.getElementById(a+":year").value,10);if(c<1){c+=12;--d}else if(c>12){c-=12;++d}if(b<1){--c;if(c<1){c+=12;--d}b+=Calendar.getMonthLength(c,d)}else if(b>Calendar.getMonthLength(c,d)){b-=Calendar.getMonthLength(c,d);++c;if(c>12){c-=12;++d}}document.getElementById(a+":day").value=b;document.getElementById(a+":month").value=c;document.getElementById(a+
":year").value=d}function selectDay(a,b,c){var d=document.getElementById(a+":month").value,e=document.getElementById(a+":year").value,f=getFirstDayOfWeek(a);f=Calendar.firstDayOffset(d,e,f);initCalendarData(a,e,d,b*7+c-f+1);initCalendar(a)}
function initCalendar(a){var b=parseInt(document.getElementById(a+":day").value,10),c=parseInt(document.getElementById(a+":month").value,10),d=parseInt(document.getElementById(a+":year").value,10),e=getFirstDayOfWeek(a);e=Calendar.firstDayOffset(c,d,e);var f=Calendar.getMonthLength(Calendar.getPreviousMonth(c,d),d),g=Calendar.getMonthLength(c,d);document.getElementById(a+":title").innerHTML=getMonthName(a,c)+" "+d;for(c=0;c<6;++c){document.getElementById(a+":"+c).style.display="";for(d=0;d<7;++d){var h=
document.getElementById(a+":"+c+":"+d),j=c*7+d-e+1,k="tobago-calendar-day";if(j<=0){j=f+j;k="tobago-calendar-day tobago-calendar-day-markup-disabled"}else if(j>g){k="tobago-calendar-day tobago-calendar-day-markup-disabled";j-=g}else if(j==b)k="tobago-calendar-day tobago-calendar-day-markup-selected";h.className=k;h.innerHTML=j}}}
function initCalendarParse(a,b){var c=document.getElementById(b);document.getElementById(a+":fieldId").value=b;var d=document.getElementById(b+":converterPattern");document.calendar.formatPattern=d?d.value:"yyyy-MM-dd";var e=new Date(getDateFromFormat(c.value,document.calendar.formatPattern));if(e.getTime()==0)e=new Date;else document.calendar.formatPattern.match(/d/)||e.setDate(e.getDate()+1);c=e.getDate();d=e.getMonth()+1;e=e.getFullYear();initCalendarData(a,e,d,c);initCalendar(a)}
function writeIntoField2(a){var b=a.id,c=b.lastIndexOf(":");return writeIntoField(a,b.substring(0,c))}
function writeIntoField(a,b){var c=document.getElementById(b+":calendar:fieldId");c=document.getElementById(c.value);var d=parseInt(document.getElementById(b+":calendar:day").value,10),e=parseInt(document.getElementById(b+":calendar:month").value,10),f=parseInt(document.getElementById(b+":calendar:year").value,10),g=b+":time"+Tobago.SUB_COMPONENT_SEP,h=document.getElementById(g+"hour");h=h?parseInt(h.value,10):0;var j=document.getElementById(g+"minute");j=j?parseInt(j.value,10):0;g=(g=document.getElementById(g+
"second"))?parseInt(g.value,10):0;d=new Date(f,e-1,d,h,j,g);Tobago.Popup.close(a);c.focus();d=formatDate(d,document.calendar.formatPattern);if(c.value!=d){c.value=d;Tobago.raiseEvent("change",c)}}function tbgGetTimeInput(a){if(a.parentNode.selectedId)input=document.getElementById(a.parentNode.selectedId);else{a=a.id.substring(0,a.id.lastIndexOf(":"));input=document.getElementById(a+":hour")}return input}
function tbgSetTimeInputValue(a,b){if(a.parentNode.parentNode.hourMode)if(b<0)b=23;else{if(b>23)b=0}else if(b<0)b=59;else if(b>59)b=0;if(b<10)b="0"+b;a.value=b;var c=a.id.substring(0,a.id.lastIndexOf(Tobago.SUB_COMPONENT_SEP)),d=document.getElementById(c);if(d){c=c+Tobago.SUB_COMPONENT_SEP;var e=document.getElementById(c+"hour");if(e){e=parseInt(e.value,10);if(e<10)e="0"+e}else e="00";var f=document.getElementById(c+"minute");if(f){f=parseInt(f.value,10);if(f<10)f="0"+f}else f="00";d.value=e+":"+
f;if(c=document.getElementById(c+"second")){c=parseInt(c.value,10);if(c<10)c="0"+c;d.value=d.value+":"+c}}}function tbgDecTime(a){a=tbgGetTimeInput(a);tbgSetTimeInputValue(a,a.value-1);a.focus()}function tbgIncTime(a){a=tbgGetTimeInput(a);tbgSetTimeInputValue(a,a.value-0+1);a.focus()}function tbgTimerInputFocus(a,b){a.parentNode.parentNode.selectedId=a.id;a.parentNode.parentNode.hourMode=b;Tobago.addCssClass(a,"tobago-time-input-markup-selected");a.oldValue=a.value}
function tbgTimerInputBlur(a){var b=parseInt(a.value,10);if(b==NaN)a.value=a.oldValue;else{if(a.parentNode.parentNode.hourMode){if(b>23||b<0)b=a.oldValue}else if(b>59||b<0)b=a.oldValue;tbgSetTimeInputValue(a,b);Tobago.removeCssClass(a,"tobago-time-input-markup-selected")}}
function tbgInitTimeParse(a,b){var c=document.getElementById(b);if(c){var d=document.getElementById(b+":converterPattern"),e=new Date(getDateFromFormat(c.value,d?d.value:"HH:mm"));if(e.getTime()==0)e=new Date;c=e.getHours();d=e.getMinutes();e=e.getSeconds();tbgInitTimeData(a,c,d,e)}}
function tbgInitTimeData(a,b,c,d){if(document.getElementById(a)){a=a+Tobago.SUB_COMPONENT_SEP;var e=document.getElementById(a+"hour");if(e)e.value=b<10?"0"+b:b;if(b=document.getElementById(a+"minute"))b.value=c<10?"0"+c:c;if(c=document.getElementById(a+"second"))c.value=d<10?"0"+d:d}}function tbgTimerKeyUp(a,b){if(!b)b=window.event;switch(b.keyCode){case 38:tbgSetTimeInputValue(a,a.value-0+1);break;case 40:tbgSetTimeInputValue(a,a.value-1)}}
DateFormatSymbols=function(){this.eras=["BC","AD"];this.months=["January","February","March","April","May","June","July","August","September","October","November","December"];this.shortMonths=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];this.weekdays=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];this.shortWeekdays=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];this.ampms=["AM","PM"];this.zoneStrings=[[0,"long-name","short-name"]];var a=new Date;
a.setYear(a.getYear()-80);this.twoDigitYearStart=a};SimpleDateFormatParserContext=function(){this.year=this.retValue=this.newIndex=0;this.ambigousYear=false;this.ampm=this.sec=this.min=this.hour=this.dayOfWeek=this.day=this.month=0;this.dateStr=""};SimpleDateFormat=function(a,b){this.pattern=a;this.dateFormatSymbols=b?b:new DateFormatSymbols};
SimpleDateFormat.prototype._handle=function(a,b,c){var d=0,e=0,f=false,g=0,h=0,j=0,k=null,l=new SimpleDateFormatParserContext;if(b!=null){l.year=this._fullYearFromDate(b.getYear());l.month=b.getMonth();l.day=b.getDate();l.dayOfWeek=b.getDay();l.hour=b.getHours();l.min=b.getMinutes();l.sec=b.getSeconds()}for(;d<this.pattern.length;){h=this.pattern.charAt(d);j=d<this.pattern.length-1?this.pattern.charAt(d+1):0;if(h=="'"&&g!="\\"){f=!f;d++}else if(f){if(c){if(this.pattern.charAt(d)!=a.charAt(e))return null}else l.dateStr+=
this.pattern.charAt(d);d++;e++}else{if(!(h=="\\"&&g!="\\")){if(k==null)k="";k+=h;if(h!=j){this._handlePatternSub(l,k,a,e,c);k=null;if(l.newIndex<0)break;e=l.newIndex}}d++}g=h}this._handlePatternSub(l,k,a,e,c);return l};SimpleDateFormat.prototype.parse=function(a){if(!a||a.length==0)return null;a=this._handle(a,null,true);if(a.retValue==-1)return null;this._adjustTwoDigitYear(a);return this._createDateFromContext(a)};
SimpleDateFormat.prototype._createDateFromContext=function(a){return new Date(a.year,a.month,a.day,a.hour,a.min,a.sec)};SimpleDateFormat.prototype.format=function(a){return this._handle(null,a,false).dateStr};SimpleDateFormat.prototype._parseString=function(a,b,c,d){b=b.substr(c);b=this._prefixOf(d,b);if(b!=-1){a.retValue=b;a.newIndex=c+d[b].length;return a}a.retValue=-1;a.newIndex=-1;return a};
SimpleDateFormat.prototype._parseNum=function(a,b,c,d){for(c=Math.min(c,b.length-d);c>0;c--){var e=b.substring(d,d+c);a.retValue=this._parseInt(e);if(a.retValue!=-1){a.newIndex=d+c;return a}}a.retValue=-1;a.newIndex=-1;return a};
SimpleDateFormat.prototype._handlePatternSub=function(a,b,c,d,e){if(!(b==null||b.length==0))if(b.charAt(0)=="y")if(e){this._parseNum(a,c,4,d);if(a.newIndex-d<4){a.year=a.retValue+1900;a.ambigousYear=true}else a.year=a.retValue}else this._formatNum(a,a.year,b.length<=3?2:4,true);else if(b.charAt(0)=="M")if(e)if(b.length==3){b=c.substr(d,3);b=this._indexOf(this.dateFormatSymbols.shortMonths,b);if(b!=-1){a.month=b;a.newIndex=d+3}}else if(b.length>=4){b=c.substr(d);b=this._prefixOf(this.dateFormatSymbols.months,
b);if(b!=-1){a.month=b;a.newIndex=d+this.dateFormatSymbols.months[b].length}}else{this._parseNum(a,c,2,d);a.month=a.retValue-1}else if(b.length==3)a.dateStr+=this.dateFormatSymbols.shortMonths[a.month];else if(b.length>=4)a.dateStr+=this.dateFormatSymbols.months[a.month];else this._formatNum(a,a.month+1,b.length);else if(b.charAt(0)=="d")if(e){this._parseNum(a,c,2,d);a.day=a.retValue}else this._formatNum(a,a.day,b.length);else if(b.charAt(0)=="E")if(e)if(b.length<=3){b=c.substr(d,3);b=this._indexOf(this.dateFormatSymbols.shortWeekdays,
b);if(b!=-1){a.dayOfWeek=b;a.newIndex=d+3}}else{b=c.substr(d);b=this._prefixOf(this.dateFormatSymbols.weekdays,b);if(b!=-1){a.dayOfWeek=b;a.newIndex=d+this.dateFormatSymbols.weekdays[b].length}}else a.dateStr+=b.length<=3?this.dateFormatSymbols.shortWeekdays[a.dayOfWeek]:this.dateFormatSymbols.weekdays[a.dayOfWeek];else if(b.charAt(0)=="H"||b.charAt(0)=="h")if(e){this._parseNum(a,c,2,d);a.hour=a.retValue}else this._formatNum(a,a.hour,b.length);else if(b.charAt(0)=="m")if(e){this._parseNum(a,c,2,d);
a.min=a.retValue}else this._formatNum(a,a.min,b.length);else if(b.charAt(0)=="s")if(e){this._parseNum(a,c,2,d);a.sec=a.retValue}else this._formatNum(a,a.sec,b.length);else if(b.charAt(0)=="a")if(e){this._parseString(a,c,d,this.dateFormatSymbols.ampms);a.ampm=a.retValue}else a.dateStr+=this.dateFormatSymbols.ampms[a.ampm];else if(e)a.newIndex=d+b.length;else a.dateStr+=b};
SimpleDateFormat.prototype._formatNum=function(a,b,c,d){for(b=b+"";b.length<c;)b="0"+b;if(d&&b.length>c)b=b.substr(b.length-c);a.dateStr+=b};SimpleDateFormat.prototype._indexOf=function(a,b){for(var c=0;c<a.length;++c)if(a[c]==b)return c;return-1};SimpleDateFormat.prototype._prefixOf=function(a,b){for(var c=0;c<a.length;++c)if(b.indexOf(a[c])==0)return c;return-1};
SimpleDateFormat.prototype._parseInt=function(a){for(var b=0,c=0;c<a.length;c++){var d=a.charAt(c);if(d<"0"||d>"9")return-1;b=b*10+(d-"0")}return b};SimpleDateFormat.prototype._fullYearFromDate=function(a){if((a+"").length<4)return a+1900;return a};SimpleDateFormat.prototype._adjustTwoDigitYear=function(a){if(a.ambigousYear){var b=this.dateFormatSymbols.twoDigitYearStart;if(this._createDateFromContext(a).getTime()<b.getTime())a.year+=100}};
function getDateFromFormat(a,b){return(new SimpleDateFormat(b)).parse(a)}function formatDate(a,b){return(new SimpleDateFormat(b)).format(a)}
function parseDate(a){var b=arguments.length==2?arguments[1]:false;generalFormats=["y-M-d","MMM d, y","MMM d,y","y-MMM-d","d-MMM-y","MMM d"];monthFirst=["M/d/y","M-d-y","M.d.y","MMM-d","M/d","M-d"];dateFirst=["d/M/y","d-M-y","d.M.y","d-MMM","d/M","d-M"];b=["generalFormats",b?"dateFirst":"monthFirst",b?"monthFirst":"dateFirst"];for(var c=null,d=0;d<b.length;d++)for(var e=window[b[d]],f=0;f<e.length;f++){c=(new SimpleDateFormat(e[f])).parse(a);if(c!=0)return new Date(c)}return null}
Tobago.AutocompleterAjax=function(a,b,c,d){this.id=a;this.required=b;this.requiredClass=c;this.suggestions=null;this.setup();this.options={minPrefixLength:2,eventDelay:500,createOverlay:false};this.rerequest=this.requestActive=false;this.currentTimeout=undefined;this.index=0;Tobago.extend(this.options,d);a=Tobago.element(a);a.setAttribute("autocomplete","off");this.oldValue=a.value;Tobago.addBindEventListener(a,"keyup",this,"doCheckSuggest");Tobago.addAjaxComponent(this.id,this)};
Tobago.extend(Tobago.AutocompleterAjax.prototype,Tobago.In.prototype);
Tobago.AutocompleterAjax.prototype.doCheckSuggest=function(a){var b=Tobago.element(this.id),c=a.which;if(c==0)c=a.keyCode;switch(c){case 27:this.closeSuggest(true);return false;case 40:this.registerBodyEvent();if(a=Tobago.element(this.id+"_suggestDiv")){a.style.display="block";try{a.firstChild.firstChild.firstChild.focus()}catch(d){}return false}}if(this.oldValue!=b.value){this.oldValue=b.value;if(!(b.value.length<this.options.minPrefixLength)){this.currentTimeout!==undefined&&clearTimeout(this.currentTimeout);
var e=this;this.currentTimeout=setTimeout(function(){e.fetchSuggestions(b)},this.options.eventDelay)}}};Tobago.AutocompleterAjax.prototype.fetchSuggestions=function(a){this.currentTimeout=undefined;if(this.requestActive)this.rerequest=true;else{this.requestActive=true;Tobago.Updater.update(a,a.id,a.id,this.options)}};
Tobago.AutocompleterAjax.prototype.beforeDoUpdate=function(){if(this.rerequest){this.rerequest=false;this.requestActive=true;var a=Tobago.element(this.id);Tobago.Updater.update(a,a.id,a.id,this.options);return false}else return true};Tobago.AutocompleterAjax.prototype.afterDoUpdateSuccess=function(){this.suggest();this.requestActive=false};Tobago.AutocompleterAjax.prototype.afterDoUpdateNotModified=function(){this.requestActive=false};
Tobago.AutocompleterAjax.prototype.afterDoUpdateError=function(){this.requestActive=false};
Tobago.AutocompleterAjax.prototype.suggest=function(){if(this.suggestions!=null){this.registerBodyEvent();var a=Tobago.element(this.id+"_suggestDiv");if(a)a.style.display="block";else a=this.createSuggestDiv();for(var b=document.createElement("ul"),c=0;c<this.suggestions.items.length;c++){var d=this.suggestions.items[c],e=document.createElement("li"),f=document.createElement("a");f.innerHTML=d.label;f.sugggestItem=d;if(d.nextFocusId)f.nextFocusId=d.nextFocusId;else if(this.suggestions.nextFocusId)f.nextFocusId=
this.suggestions.nextFocusId;f.href=Tobago.EMPTY_HREF;e.appendChild(f);Tobago.addBindEventListener(f,"keyup",this,"suggestKeyUp");Tobago.addBindEventListener(f,"focus",this,"suggestFocus");Tobago.addBindEventListener(f,"click",this,"selectSuggest");Tobago.addBindEventListener(e,"mouseover",this,"setFocus");Tobago.addBindEventListener(e,"click",this,"selectSuggest");b.appendChild(e)}jQuery(a).empty();a.appendChild(b);if(this.suggestions.moreElements){b="<div title='"+this.suggestions.moreElements+
"'>\u2026</div>";jQuery(a).append(b)}if(a.clientWidth<a.scrollWidth){c=Tobago.getRuntimeStyle(a);b=c.borderLeftWidth.replace(/\D/g,"")-0;c=c.borderRightWidth.replace(/\D/g,"")-0;a.style.width=a.scrollWidth+b+c+"px"}this.suggestions=null}};Tobago.AutocompleterAjax.prototype.setFocus=function(a){try{Tobago.element(a).firstChild.focus()}catch(b){}};
Tobago.AutocompleterAjax.prototype.selectSuggest=function(a){var b=Tobago.element(a);if(b.tagName=="LI"){b=b.firstChild;try{b.focus()}catch(c){}}this.closeSuggest(false);var d=b.sugggestItem,e=Tobago.element(this.id);e.value=d.value;this.oldValue=e.value;try{if(d.values)for(var f=0;f<d.values.length;f++){var g=d.values[f];Tobago.element(g.id).value=g.value}}catch(h){}d=e;if(b.nextFocusId)if(b=Tobago.element(b.nextFocusId))d=b;try{d.focus()}catch(j){}Tobago.stopEventPropagation(a);return false};
Tobago.AutocompleterAjax.prototype.suggestFocus=function(a){a=Tobago.element(a);for(var b=a.parentNode.parentNode,c=0;c<b.childNodes.length;c++)Tobago.removeCssClass(b.childNodes[c],"selected");Tobago.addCssClass(a.parentNode,"selected")};
Tobago.AutocompleterAjax.prototype.suggestKeyUp=function(a){var b=Tobago.element(a).parentNode,c=a.which;if(c==0)c=a.keyCode;a=false;switch(c){case 27:this.closeSuggest(true);a=true;break;case 38:if(b.previousSibling)try{b.previousSibling.firstChild.focus()}catch(d){}a=true;break;case 40:if(b.nextSibling)try{b.nextSibling.firstChild.focus()}catch(e){}a=true}return!a};
Tobago.AutocompleterAjax.prototype.closeSuggest=function(a){jQuery("body").unbind("click.suggest");Tobago.element(this.id+"_suggestDiv").style.display="none";if(a)try{Tobago.element(this.id).focus()}catch(b){}};
Tobago.AutocompleterAjax.prototype.createSuggestDiv=function(){var a=Tobago.element(this.id),b=document.createElement("div");b.style.top=Tobago.getAbsoluteTop(a)+Tobago.getHeight(a)+"px";b.style.left=Tobago.getAbsoluteLeft(a)+"px";b.style.width=Tobago.getWidth(a)+"px";b.className="tobago-in-suggestPopup";b.id=this.id+"_suggestDiv";Tobago.page.appendChild(b);return b};Tobago.AutocompleterAjax.prototype.registerBodyEvent=function(){var a=this;jQuery("body").one("click.suggest",function(){a.closeSuggest(false)})};
Tobago.Menu={};
Tobago.Menu.handelKey=function(a){var b=false,c=a.which;if(c==0)c=a.keyCode;switch(c){case 27:Tobago.Menu.closeAll();b=true;break;case 37:if(jQuery(this).parent().hasClass("tobago-menu-markup-top"))jQuery(this).parent().prev("li").children("a").focus();else jQuery(this).parent().parent().tobagoMenu_findParentMenu().parent().hasClass("tobago-menu-markup-top")?jQuery(this).parent().parent().tobagoMenu_findParentMenu().parent().prev("li").children("a").focus():jQuery(this).closest("ol").prev("a").focus();b=
true;break;case 38:jQuery(this).parent().hasClass("tobago-menu-markup-top")||jQuery(this).parent().prevAll("li").children("a").eq(0).focus();b=true;break;case 39:if(jQuery(this).parent().hasClass("tobago-menu-markup-top"))jQuery(this).parent().next("li").children("a").focus();else jQuery(this).next("ol").size()>0?jQuery(this).next("ol").children(":nth-child(1)").children("a").focus():jQuery(this).parents("ol:last").tobagoMenu_findParentMenu().parent().next("li").children("a").focus();b=true;break;
case 40:jQuery(this).parent().hasClass("tobago-menu-markup-top")?jQuery(this).parent().tobagoMenu_findSubMenu().children(":nth-child(1)").children("a").focus():jQuery(this).parent().nextAll("li").children("a").eq(0).focus();b=true}return!b};
Tobago.Menu.open=function(){var a=jQuery(this).parent(),b=a.tobagoMenu_findSubMenu();a.siblings().tobagoMenu_findSubMenu().find("ol").andSelf().css("visibility","hidden");b.children().find("ol").css("visibility","hidden");if(b.size()>0){var c,d;if(a.hasClass("tobago-menu-markup-top")){c=a.offset().left;d=a.offset().top+a.outerHeight();var e=jQuery(".tobago-page-content:first");c=Math.max(0,Math.min(c,e.outerWidth()-b.outerWidth()));d=Math.max(0,Math.min(d,e.outerHeight()-b.outerHeight()))}else{c=
a.position().left+a.outerWidth();d=a.position().top-1}b.css("left",c);b.css("top",d);b.css("visibility","visible");if(jQuery.browser.msie&&parseInt(jQuery.browser.version)<=6){c=b.children("iframe:first");c.css("width",b.outerWidth());c.css("height",b.outerHeight());c.css("left",-(parseInt(b.css("border-left-width"))+parseInt(b.css("padding-left"))));c.css("top",-(parseInt(b.css("border-top-width"))+parseInt(b.css("padding-top"))))}}a.siblings(".tobago-menu-markup-selected").removeClass("tobago-menu-markup-selected");
b.children(".tobago-menu-markup-selected").removeClass("tobago-menu-markup-selected");jQuery(this).parents("li").addClass("tobago-menu-markup-selected")};Tobago.Menu.closeAll=function(){jQuery(".tobago-menuBar").each(function(){Tobago.Menu.switchOff(jQuery(this))});return false};function compatibleKeyEvent(){return jQuery.browser.msie||jQuery.browser.webkit?"keydown":"keypress"}Tobago.Menu.mouseOver=function(){jQuery(this).children("a").focus();return false};
Tobago.Menu.switchOn=function(a,b){a.find("li").add(a.find("li").tobagoMenu_findSubMenu().find("li")).bind("mouseover",Tobago.Menu.mouseOver).children("a").bind("focus",Tobago.Menu.open).bind(compatibleKeyEvent(),Tobago.Menu.handelKey);b.children("a").focus();jQuery("body").bind("click",Tobago.Menu.closeAll);a.data("menu-active",true)};
Tobago.Menu.switchOff=function(a){a.find("ol").add(a.find("li").tobagoMenu_findSubMenu().find("ol").andSelf()).css("visibility","hidden");a.find("li").add(a.find("li").tobagoMenu_findSubMenu().find("li")).unbind("mouseover",Tobago.Menu.mouseOver).children("a").unbind("focus",Tobago.Menu.open).unbind(compatibleKeyEvent(),Tobago.Menu.handelKey);jQuery("body").unbind("click",Tobago.Menu.closeAll);a.find(".tobago-menu-markup-selected").removeClass("tobago-menu-markup-selected");a.data("menu-active",false)};
Tobago.Menu.init=function(a){var b=Tobago.Utils.selectWidthJQuery(a,".tobago-menu-markup-top");b.click(function(c){if(!jQuery(this).children("a").data("disabled")){var d=jQuery(this).parent();d.data("menu-active")?Tobago.Menu.switchOff(d):Tobago.Menu.switchOn(d,jQuery(this));c.stopPropagation()}});jQuery.browser.msie&&parseInt(jQuery.browser.version)<=6&&b.children("ol").prepend("<iframe class='tobago-menu-ie6bugfix' src='"+Tobago.blankPage+"'></iframe>");jQuery(".tobago-page-menuStore").append(b.children("ol"));
Tobago.Utils.selectWidthJQuery(a,".tobago-toolBar-menu .tobago-boxToolBar-menu .tobago-tabGroupToolBar-menu").click(function(c){jQuery(this).next().find("a").click();c.stopPropagation()});Tobago.Utils.selectWidthJQuery(a,".tobago-menu-contextMenu").parent().bind("contextmenu",function(c){jQuery(this).children(".tobago-menu-contextMenu").find("a").click();c.stopPropagation();return false})};jQuery.tobagoMenuParent=function(a){var b=[];b.push(a);return b};
(function(a){a.fn.extend({tobagoMenu_findSubMenu:function(){var b=a(this).children("ol");a(this).each(function(){b=b.add(Tobago.Utils.findSubComponent(a(this),"menu"))});return b}})})(jQuery);(function(a){a.fn.extend({tobagoMenu_findParentMenu:function(){var b=a(this);if(b.attr("id").lastIndexOf("::")>=0)return Tobago.Utils.findSuperComponent(b);return b}})})(jQuery);Tobago.Popup={};
Tobago.Popup.setup=function(){Tobago.Utils.keepElementInVisibleArea(jQuery(".tobago-popup"));jQuery(".tobago-popup-parent > .tobago-popup").unwrap();jQuery(".tobago-popup-shield").css({visibility:"hidden"});var a=-Infinity,b=null;jQuery(".tobago-popup-markup-modal").each(function(){var d=jQuery(this).css("z-index");if(d>=a){a=d;b=jQuery(this)}});if(b!=null&&b.size()>0){b.prepend("<div class='tobago-popup-shield' onclick='Tobago.Popup.blink(this)'/>");var c=b.children(".tobago-popup-shield");c.attr("id",
b.attr("id")+"::shield");if(jQuery.browser.msie&&parseInt(jQuery.browser.version)<=6){c.css({position:"absolute",left:-b.offset().left,top:-b.offset().top,width:jQuery(window).width(),height:jQuery(window).height(),background:"none",filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+Tobago.OVERLAY_BACKGROUND+"', sizingMethod='scale');"});b.prepend("<iframe class='tobago-popup-ie6bugfix'/>");b.children(".tobago-popup-ie6bugfix").css({position:"absolute",left:-b.offset().left,top:-b.offset().top,
width:jQuery(window).width(),height:jQuery(window).height()})}Tobago.Popup.lockBehind(b.get(0))}};
Tobago.Popup.lockBehind=function(a){var b=a.id,c=Tobago.element(b+Tobago.SUB_COMPONENT_SEP+"disabledElements");if(c==null){c=document.createElement("input");c.id=b+Tobago.SUB_COMPONENT_SEP+"disabledElements";c.type="hidden";a.appendChild(c)}c.value=",";a=null;for(var d=document.forms[0].elements,e,f=0;f<d.length;f++){e=d[f];if(e.type!="hidden"&&!e.disabled)if(e.id)if(e.id.indexOf(b+":")!=0){e.disabled=true;c.value+=e.id+","}else if(a==null&&jQuery.isFunction(e.focus))a=e}d=document.getElementsByTagName("a");
for(f=0;f<d.length;f++){e=d[f];if(!e.disabled)if(e.id)if(e.id.indexOf(b+":")!=0){e.disabled=true;c.value+=e.id+","}else if(a==null&&jQuery.isFunction(e.focus))a=e}if(a!=null)try{a.focus()}catch(g){}};Tobago.Popup.blink=function(a){a=jQuery(a).attr("id");Tobago.addCssClass(a,"tobago-popup-blink");setTimeout("Tobago.removeCssClass('"+a+"', 'tobago-popup-blink')",20)};Tobago.Popup.close=function(a){Tobago.Popup.unlockBehind();jQuery(a).parents("div.tobago-popup:first").remove();jQuery(".tobago-popup-shield").filter(":last").css({visibility:"visible"})};
Tobago.Popup.unlockBehind=function(){var a=jQuery(".tobago-popup-shield").filter(":last").parent();if(a.size()!=0){a=a.attr("id");var b=Tobago.element(a+Tobago.SUB_COMPONENT_SEP+"disabledElements");if(b!=null&&b.value!=""){for(var c=0;c<document.forms[0].elements.length;c++){a=document.forms[0].elements[c];if(b.value.indexOf(","+a.id+",")>=0)a.disabled=false}var d=document.getElementsByTagName("a");for(c=0;c<d.length;c++){a=d[c];if(b.value.indexOf(","+a.id+",")>=0)a.disabled=false}}}};
Tobago.Popup.openWithAction=function(a,b,c,d){jQuery(Tobago.Utils.escapeClientId(b)).size()==0&&jQuery("form:first").children("(.tobago-page,.tobago-popup):last").after("<div id='"+b+"' />");Tobago.reloadComponent(a,b,c,d)};Tobago.setupPopup=function(){Tobago.Popup.setup()};Tobago.lockBehindPopup=function(a){Tobago.Popup.lockBehind(a)};Tobago.popupBlink=function(a){Tobago.Popup.blink(a)};Tobago.closePopup=function(a){Tobago.Popup.close(a)};Tobago.unlockBehindPopup=function(){Tobago.Popup.unlockBehind()};
Tobago.openPopupWithAction=function(a,b,c,d){Tobago.Popup.openWithAction(a,b,c,d)};function openPopup(a,b,c,d,e,f,g){b||(b="name");c||(c=800);d||(d=600);f||parseInt((window.screen.availWidth-c)/2,10);g||parseInt((window.screen.availHeight-d)/2,10);a||(a="");c=setPopupPara(c,d,e);a=window.open(a,b,c);window.focus&&a.focus()}
function setPopupPara(a,b,c){var d="",e="",f="",g="",h="",j="",k="",l="";if(c){if(c.indexOf("p")>-1)d=",dependent";if(c.indexOf("d")>-1)e=",directories";if(c.indexOf("l")>-1)f=",location";if(c.indexOf("m")>-1)g=",menubar";if(c.indexOf("r")>-1)h=",resizable";if(c.indexOf("s")>-1)j=",scrollbars";if(c.indexOf("u")>-1)k=",status";if(c.indexOf("t")>-1)l=",toolbar"}a=",width = "+a;b=",height = "+b;return a+b+d+e+f+g+h+j+k+l}
Tobago.Sheets={sheets:{},get:function(a){return this.sheets[a]},put:function(a){this.sheets[a.id]=a}};
Tobago.Sheet=function(a,b,c,d,e,f,g,h,j,k){this.id=a;Tobago.Sheets.put(this);this.selectable=c;this.columnSelectorIndex=d;this.autoReload=e;this.clickActionId=f;this.clickReloadComponentId=g;this.dblClickActionId=h;this.dblClickReloadComponentId=j;this.renderedPartially=k;this.resizerId=undefined;this.newWidth=this.oldX=0;this.rowCount=this.firstRowIndex=undefined;this.lastClickedRowIndex=-1;this.headerDivId=this.id+Tobago.SUB_COMPONENT_SEP+"header_div";this.contentDivId=this.id+Tobago.SUB_COMPONENT_SEP+
"data_div";this.selectedId=this.id+Tobago.SUB_COMPONENT_SEP+"selected";this.headerWidthsId=this.id+Tobago.SUB_COMPONENT_SEP+"widths";this.scrollPositionId=this.id+Tobago.SUB_COMPONENT_SEP+"scrollPosition";this.mouseDownY=this.mouseDownX=undefined;Tobago.addAjaxComponent(this.id,this);this.options={createOverlay:false};this.ppPrefix=Tobago.SUB_COMPONENT_SEP+"pagingPages"+Tobago.SUB_COMPONENT_SEP;this.firstRegExp=RegExp(this.ppPrefix+"First$");this.prevRegExp=RegExp(this.ppPrefix+"Prev$");this.nextRegExp=
RegExp(this.ppPrefix+"Next$");this.lastRegExp=RegExp(this.ppPrefix+"Last$");this.firstRowRegExp=RegExp("^"+this.id+"_data_tr_\\d+$");this.setup()};Tobago.Sheet.prototype.setupSortHeaders=function(){var a=this;jQuery(Tobago.Utils.escapeClientId(a.id)).find(".tobago-sheet-header[sorterId]").each(function(){jQuery(this).click({sheet:a,sorterId:jQuery(this).attr("sorterId")},function(b){b.data.sheet.reloadWithAction(jQuery(this),b.data.sorterId);b.stopPropagation()})})};
Tobago.Sheet.prototype.setupPagingLinks=function(){idPrefix=this.id+Tobago.SUB_COMPONENT_SEP;var a=Tobago.element(idPrefix+"pagingLinks");if(a)for(i=0;i<a.childNodes.length;i++){var b=a.childNodes[i];b.nodeType==1&&b.tagName.toUpperCase()=="A"&&Tobago.addBindEventListener(b,"click",this,"doPagingDirect")}};
Tobago.Sheet.prototype.setupPagePaging=function(){if(linkBox=Tobago.element(idPrefix+"pagingPages"))for(var a=0;a<linkBox.childNodes.length;a++){var b=linkBox.childNodes[a];if(b.nodeType==1&&b.tagName.toUpperCase()=="IMG")undefined==jQuery(b).attr("data-tobago-disabled")&&Tobago.addBindEventListener(b,"click",this,"doPaging");else b.nodeType==1&&b.tagName.toUpperCase()=="SPAN"&&Tobago.addEventListener(b,"click",Tobago.bind(this,"insertTarget",this.id+Tobago.COMPONENT_SEP+"ToPage"))}};
Tobago.Sheet.prototype.setupRowPaging=function(){var a=this.id+Tobago.COMPONENT_SEP+"ToRow",b=Tobago.element(a+Tobago.SUB_COMPONENT_SEP+"text");b&&Tobago.addEventListener(b.parentNode,"click",Tobago.bind(this,"insertTarget",a))};
Tobago.Sheet.prototype.doPagingDirect=function(a){var b=Tobago.element(a),c=this.id+Tobago.COMPONENT_SEP+"ToPage",d=b.id.lastIndexOf("_");d=b.id.substring(d+1);b=document.createElement("input");b.type="hidden";b.value=d;b.name=c+Tobago.SUB_COMPONENT_SEP+"value";Tobago.element(this.id).appendChild(b);this.reloadWithAction(a.srcElement,c)};
Tobago.Sheet.prototype.doPaging=function(a){var b=Tobago.element(a),c="unset";if(b.id.match(this.firstRegExp))c=this.id+Tobago.COMPONENT_SEP+"First";else if(b.id.match(this.prevRegExp))c=this.id+Tobago.COMPONENT_SEP+"Prev";else if(b.id.match(this.nextRegExp))c=this.id+Tobago.COMPONENT_SEP+"Next";else if(b.id.match(this.lastRegExp))c=this.id+Tobago.COMPONENT_SEP+"Last";this.reloadWithAction(a.srcElement,c)};
Tobago.Sheet.prototype.reloadWithAction=function(a,b,c){var d=Tobago.extend({},this.options);d=Tobago.extend(d,c);Tobago.createOverlay(jQuery(Tobago.Utils.escapeClientId(this.id)));Tobago.Updater.update(a,b,this.renderedPartially?this.renderedPartially:this.id,d)};Tobago.Sheet.prototype.afterDoUpdateSuccess=function(){this.setup()};Tobago.Sheet.prototype.afterDoUpdateNotModified=function(){this.initReload()};Tobago.Sheet.prototype.afterDoUpdateError=function(){this.initReload()};
Tobago.Sheet.prototype.insertTarget=function(a,b){var c=Tobago.element(b+Tobago.SUB_COMPONENT_SEP+"text");if(c){var d=c.parentNode,e=b+Tobago.SUB_COMPONENT_SEP+"value";d.style.cursor="auto";var f=Tobago.element(e);if(!f){f=document.createElement("input");f.type="text";f.id=e;f.name=e;f.className="tobago-sheet-pagingInput";f.actionId=b;Tobago.addBindEventListener(f,"blur",this,"delayedHideInput");Tobago.addBindEventListener(f,"keydown",this,"doKeyEvent");f.style.display="none";d.insertBefore(f,c)}f.value=
c.innerHTML;f.style.display="";c.style.display="none";f.focus();f.select()}};Tobago.Sheet.prototype.delayedHideInput=function(a){if(a=Tobago.element(a)){this.textInput=a;setTimeout(Tobago.bind(this,"hideInput"),100)}};Tobago.Sheet.prototype.hideInput=function(){if(this.textInput){this.textInput.parentNode.style.cursor="pointer";this.textInput.style.display="none";this.textInput.nextSibling.style.display=""}};
Tobago.Sheet.prototype.doKeyEvent=function(a){var b=Tobago.element(a);if(b)if((a.which?a.which:a.keyCode)==13)if(b.value!=b.nextSibling.innerHTML){this.reloadWithAction(a.srcElement,b.actionId);Tobago.stopEventPropagation(a)}else{this.textInput=b;this.hideInput()}};
Tobago.Sheet.prototype.setupResizer=function(){var a=Tobago.element(this.headerDivId);if(a){Tobago.addBindEventListener(a,"mousemove",this,"doResize");Tobago.addBindEventListener(a,"mouseup",this,"endResize");a=a.childNodes.length;for(var b=0;b<a;b++){var c=Tobago.element(this.id+Tobago.SUB_COMPONENT_SEP+"header_spacer_"+b);if(c&&c.className.match(/tobago-sheet-headerSpacer-markup-resizable/)){Tobago.addEventListener(c,"click",Tobago.stopEventPropagation);Tobago.addBindEventListener(c,"mousedown",
this,"beginResize")}}}a=Tobago.element(this.contentDivId);Tobago.addBindEventListener(a,"scroll",this,"doScroll")};
Tobago.Sheet.prototype.setup=function(){this.setupStart=new Date;this.setupResizer();jQuery.browser.msie&&parseInt(jQuery.browser.version)<=7&&jQuery(Tobago.Utils.escapeClientId(this.id)+">div>table>colgroup>col").each(function(){Tobago.Sheet.fixIE67ColWidth(jQuery(this))});this.adjustHeaderDiv();this.adjustResizer();this.setupHeader();this.setScrollPosition();this.firstRowIndex=parseInt(this.getRows().eq(0).attr("rowIndexInModel"));this.rowCount=this.getRows().size();if(this.selectable&&(this.selectable==
"single"||this.selectable=="singleOrNone"||this.selectable=="multi"))this.addSelectionListener();this.setupSortHeaders();this.setupPagingLinks();this.setupPagePaging();this.setupRowPaging();this.initReload();this.setupEnd=new Date};
Tobago.Sheet.prototype.setScrollPosition=function(){var a=Tobago.element(this.scrollPositionId);if(a){var b=a.value.indexOf(";");if(b!=-1){var c=a.value.substr(0,b);b=a.value.substr(b+1);a=Tobago.element(this.contentDivId);a.scrollLeft=c;a.scrollTop=b;if(c=Tobago.element(this.headerDivId))c.scrollLeft=a.scrollLeft}}};
Tobago.Sheet.prototype.initReload=function(){typeof this.autoReload=="number"&&Tobago.element(this.contentDivId)&&Tobago.addReloadTimeout(this.id,Tobago.bind2(this,"reloadWithAction",null,this.id),this.autoReload)};
Tobago.Sheet.prototype.addSelectionListener=function(){var a=this;a.getRows().each(function(){Tobago.addBindEventListener(this,"mousedown",a,"doMouseDownSelect");Tobago.addBindEventListener(this,"mouseup",a,"doMouseUpSelect");Tobago.addBindEventListener(this,"click",a,"doSelection");a.dblClickActionId&&Tobago.addBindEventListener(this,"dblclick",a,"doDblClick")})};Tobago.Sheet.prototype.doMouseDownSelect=function(a){if(!a)a=window.event;this.mouseDownX=a.clientX;this.mouseDownY=a.clientY};
Tobago.Sheet.prototype.doMouseUpSelect=function(){this.mouseDownY=this.mouseDownX=undefined};
Tobago.Sheet.prototype.doSelection=function(a){if(!a)a=window.event;var b;b=a.target?a.target:a.srcElement;if(b.id.search(/_data_row_selector_/)>-1||!Tobago.isInputElement(b.tagName))if(!(this.mouseDownX!=undefined&&Math.abs(this.mouseDownX-a.clientX)+Math.abs(this.mouseDownY-a.clientY)>5)){Tobago.clearSelection();var c=jQuery(Tobago.element(a)).closest("tr"),d=this.getSelectorCheckbox(c.get(0)),e=c.index()+this.firstRowIndex,f=this.isSelected(e);if(!a.ctrlKey&&!a.metaKey&&!d||this.selectable=="single"||
this.selectable=="singleOrNone")this.deselectAll();if(a.shiftKey&&this.selectable=="multi")this.lastClickedRowIndex<=e?this.selectRange(this.lastClickedRowIndex,e+1,true,false):this.selectRange(e,this.lastClickedRowIndex+1,true,false);else if(this.selectable!="singleOrNone"||!f)this.toggleSelection(e,c.get(0),d);if(this.clickActionId){a=this.id+":"+e+":"+this.clickActionId;this.clickReloadComponentId&&this.clickReloadComponentId.length>0?Tobago.reloadComponent(b,this.clickReloadComponentId,a):Tobago.submitAction(b,
a)}}};Tobago.Sheet.prototype.doDblClick=function(a){if(!a)a=window.event;var b;b=a.target?a.target:a.srcElement;if(!Tobago.isInputElement(b.tagName)){a=jQuery(Tobago.element(a)).closest("tr").index()+this.firstRowIndex;if(this.dblClickActionId){a=this.id+":"+a+":"+this.dblClickActionId;this.dblClickReloadComponentId&&this.dblClickReloadComponentId.length>0?Tobago.reloadComponent(b,this.dblClickReloadComponentId,a):Tobago.submitAction(b,a)}}};
Tobago.Sheet.prototype.getSelectorCheckbox=function(a){return this.columnSelectorIndex>=0?a.childNodes[this.columnSelectorIndex].childNodes[0]:null};Tobago.Sheet.prototype.getSiblingRow=function(a,b){return a.parentNode.childNodes[b]};Tobago.Sheet.prototype.isEnabled=function(a){return a==null||a.attributes==null||a.attributes.disabled===undefined||a.attributes.disabled==null||a.attributes.disabled.value!="true"};
Tobago.Sheet.prototype.getRows=function(){return jQuery(Tobago.Utils.escapeClientId(this.id)+">div>table>tbody>tr")};Tobago.Sheet.prototype.isSelected=function(a){return Tobago.element(this.selectedId).value.indexOf(","+a+",")>=0};Tobago.Sheet.prototype.toggleSelection=function(a,b,c){this.lastClickedRowIndex=a;if(this.isEnabled(c)){var d=Tobago.element(this.selectedId);d.value.indexOf(","+a+",")<0?this.selectRow(d,a,b,c):this.deselectRow(d,a,b,c)}};
Tobago.Sheet.prototype.selectAll=function(){this.selectRange(this.firstRowIndex,this.firstRowIndex+this.rowCount,true,false)};Tobago.Sheet.prototype.deselectAll=function(){this.selectRange(this.firstRowIndex,this.firstRowIndex+this.rowCount,false,true)};Tobago.Sheet.prototype.toggleAll=function(){this.selectRange(this.firstRowIndex,this.firstRowIndex+this.rowCount,true,true)};
Tobago.Sheet.prototype.selectRange=function(a,b,c,d){var e=Tobago.element(this.selectedId),f=this.getRows();for(a=a;a<b;a++){var g=f.get(a-this.firstRowIndex),h=this.getSelectorCheckbox(g);if(this.isEnabled(h))if(c&&e.value.indexOf(","+a+",")<0)this.selectRow(e,a,g,h);else d&&e.value.indexOf(","+a+",")>=0&&this.deselectRow(e,a,g,h)}};Tobago.Sheet.prototype.selectRow=function(a,b,c,d){a.value=a.value+b+",";c.className+=" tobago-sheet-row-markup-selected";if(d!=null)d.checked=true};
Tobago.Sheet.prototype.deselectRow=function(a,b,c,d){a.value=a.value.replace(RegExp(","+b+","),",");a=" "+c.className+" ";a=a.replace(/ tobago-sheet-row-markup-selected /," ");c.className=a.substring(1,a.length-1);if(d!=null)d.checked=false};Tobago.Sheet.prototype.setupHeader=function(){var a=Tobago.element(this.id+Tobago.SUB_COMPONENT_SEP+"header_box_0");if(a){if(window.opera)a.style.marginLeft="0px";var b=a.style.width,c=b.replace(/px/,"");a.style.width=c-0+10+"px";a.style.width=b}};
Tobago.Sheet.prototype.adjustResizer=function(){if(window.opera)for(var a=5,b=0,c=Tobago.element(this.id+Tobago.SUB_COMPONENT_SEP+"header_spacer_"+b);c;){c.style.right=-a;c=Tobago.element(this.id+Tobago.SUB_COMPONENT_SEP+"header_box_"+b++).style.width.replace(/px/,"")-0;a+=c;c=Tobago.element(this.id+Tobago.SUB_COMPONENT_SEP+"header_spacer_"+b)}};
Tobago.Sheet.prototype.adjustHeaderDiv=function(){var a=Tobago.element(this.headerDivId);if(a){var b=Tobago.element(this.contentDivId),c=b.getElementsByTagName("table")[0];c.style.width="10px";for(var d=b.style.width.replace(/px/,"")-0,e=b.clientWidth,f=0,g=0,h=Tobago.element(this.id+Tobago.SUB_COMPONENT_SEP+"header_box_"+g++);h;){f+=h.style.width.replace(/px/,"")-0;h=Tobago.element(this.id+Tobago.SUB_COMPONENT_SEP+"header_box_"+g++)}if(e==0)e=Math.min(d,f);d=d-Tobago.Config.get("Tobago","verticalScrollbarWeight")-
Tobago.Config.get("Sheet","contentBorderWidth");d=Math.max(d,0);a.style.width=Math.max(e,d);Tobago.element(this.id+Tobago.SUB_COMPONENT_SEP+"header_box_filler").style.width=Math.max(a.style.width.replace(/px/,"")-f,0);f=b.clientWidth;if(e>f)a.style.width=Math.max(f,d);c.style.width=b.clientWidth+"px"}};
Tobago.Sheet.prototype.beginResize=function(a){if(!a)a=window.event;if(this.resizerId=Tobago.element(a).id){this.oldX=a.clientX;a=this.getHeaderBox().style.width;this.newWidth=a.substring(0,a.length-2)}};Tobago.Sheet.prototype.getHeaderBox=function(){var a=this.resizerId.replace(/header_spacer_/,"header_box_");return Tobago.element(a)};
Tobago.Sheet.prototype.doResize=function(a){if(!a)a=window.event;if(this.resizerId){var b=jQuery(this.getHeaderBox()),c=b.outerWidth()-b.width();this.newWidth=b.outerWidth()+(a.clientX-this.oldX);if(this.newWidth<10)this.newWidth=10;else this.oldX=a.clientX;b.width(this.newWidth-c)}};
Tobago.Sheet.prototype.endResize=function(){if(this.resizerId){var a=this.newWidth,b=this.resizerId.substring(this.resizerId.lastIndexOf("_")+1,this.resizerId.length),c=jQuery(Tobago.Utils.escapeClientId(this.id)+">div>table"),d=jQuery("colgroup>col",c).eq(b);d.attr("width",a);jQuery.browser.msie&&parseInt(jQuery.browser.version)<=7&&Tobago.Sheet.fixIE67ColWidth(d);b=parseInt(b)+1;c=jQuery("td:nth-child("+b+")",c);b=0;b=a;if(c.size()>0){b=c.eq(0).outerWidth()-c.eq(0).width();b=a-b}c.children().borderBoxWidth(b);
this.adjustHeaderDiv();this.adjustResizer();this.storeSizes();delete this.resizerId}};Tobago.Sheet.fixIE67ColWidth=function(a){var b=a.closest("table").children("tbody").children("tr:first").children("td").eq(a.index());b=b.outerWidth()-b.width();a.attr("width",a.attr("width")-b)};
Tobago.Sheet.prototype.storeSizes=function(){var a=jQuery(Tobago.Utils.escapeClientId(this.id+Tobago.SUB_COMPONENT_SEP+"header_div")),b="";jQuery(a).children().each(function(){if(!this.id||this.id===undefined||this.id.indexOf("header_box_filler")!=-1)return true;b=b+","+jQuery(this).outerWidth()});Tobago.element(this.headerWidthsId).value=b};
Tobago.Sheet.prototype.doScroll=function(){var a=Tobago.element(this.headerDivId),b=Tobago.element(this.contentDivId);if(a)a.scrollLeft=b.scrollLeft;if(a=Tobago.element(this.scrollPositionId))a.value=b.scrollLeft+";"+b.scrollTop};(function(a){a.fn.borderBoxWidth=function(b){return this.each(function(){obj=a(this);var c=obj.outerWidth()-obj.width();obj.width(b-c)})}})(jQuery);Tobago.Tree={};
Tobago.Tree.toggleNode=function(a){var b;a=a.closest(".tobago-treeNode, .tobago-treeMenuNode");var c=a.find(".tobago-treeMenuNode-expanded, .tobago-treeNode-expanded"),d=a.find(".tobago-treeMenuNode-toggle, .tobago-treeNode-toggle");if("true"==c.attr("value")){Tobago.Tree.hideChildren(a);d.each(function(){b=jQuery(this).data("tobago-srcclose");if(b==null)b=jQuery(this).data("tobago-srcopen");jQuery(this).attr("src",b);Tobago.fixPngAlpha(this)});c.attr("value","false");a.filter(".tobago-treeNode").removeClass("tobago-treeNode-markup-expanded");
a.filter(".tobago-treeMenuNode").removeClass("tobago-treeMenuNode-markup-expanded")}else{Tobago.Tree.showChildren(a);d.each(function(){b=jQuery(this).data("tobago-srcopen");if(b==null)b=jQuery(this).data("tobago-srcclose");jQuery(this).attr("src",b);Tobago.fixPngAlpha(this)});c.attr("value","true");a.filter(".tobago-treeNode").addClass("tobago-treeNode-markup-expanded");a.filter(".tobago-treeMenuNode").addClass("tobago-treeMenuNode-markup-expanded")}};
Tobago.Tree.hideChildren=function(a){a.nextAll("[data-tobago-treeparent='"+a.attr("id")+"']").hide().each(function(){Tobago.Tree.hideChildren(jQuery(this))})};Tobago.Tree.showChildren=function(a){a.nextAll("[data-tobago-treeparent='"+a.attr("id")+"']").show().each(function(){var b=jQuery(this);"true"==b.find(".tobago-treeMenuNode-expanded, .tobago-treeNode-expanded").attr("value")&&Tobago.Tree.showChildren(b)})};
Tobago.Tree.init=function(a){var b=Tobago.Utils.selectWidthJQuery(a,".tobago-treeListbox").find("select");b.children("option").each(function(){var c=jQuery(this),d=c.attr("id")+"::select";d=jQuery(Tobago.Utils.escapeClientId(d));if(d.length==1)c.data("select",d);else{d=c.parent().parent().next().children(":first");c.data("select",d)}});b.each(function(){jQuery(this).change(function(){jQuery(this).children("option:not(:selected)").each(function(){jQuery(this).data("select").hide()});jQuery(this).children("option:selected").data("select").show();
jQuery(this).parent().nextAll(":not(:first)").children(":not(:first)").hide();jQuery(this).parent().nextAll(":not(:first)").children(":first").show()});jQuery(this).focus(function(){jQuery(this).change()})});Tobago.Utils.selectWidthJQuery(a,".tobago-treeNode-markup-folder .tobago-treeNode-toggle").click(function(){Tobago.Tree.toggleNode(jQuery(this))});Tobago.Utils.selectWidthJQuery(a,".tobago-treeMenuNode-markup-folder .tobago-treeMenuNode-toggle").parent().each(function(){(jQuery(this).children(".tobago-treeMenuCommand").size()==
0?jQuery(this):jQuery(this).find(".tobago-treeMenuNode-toggle")).click(function(){Tobago.Tree.toggleNode(jQuery(this))})});Tobago.Utils.selectWidthJQuery(a,".tobago-treeMenuNode").hover(function(){jQuery(this).toggleClass("tobago-treeMenuNode-markup-hover")});Tobago.Utils.selectWidthJQuery(a,".tobago-treeCommand").focus(function(){var c=jQuery(this).parent(".tobago-treeNode"),d=c.closest(".tobago-tree");d.children(".tobago-tree-marked").attr("value",c.attr("id"));d.find(".tobago-treeNode").removeClass("tobago-treeNode-markup-marked");
c.addClass("tobago-treeNode-markup-marked")});Tobago.Utils.selectWidthJQuery(a,".tobago-treeMenuCommand").focus(function(){var c=jQuery(this).parent(".tobago-treeMenuNode"),d=c.closest(".tobago-treeMenu");d.children(".tobago-treeMenu-marked").attr("value",c.attr("id"));d.find(".tobago-treeMenuNode").removeClass("tobago-treeMenuNode-markup-marked");c.addClass("tobago-treeMenuNode-markup-marked")})};Tobago.Utils={};Tobago.Utils.escapeClientId=function(a){return"#"+a.replace(/:/g,"\\:")};
Tobago.Utils.selectWidthJQuery=function(a,b){return a==null?jQuery(b):a.find(b).add(a.filter(b))};Tobago.Utils.findSubComponent=function(a,b){return jQuery(Tobago.Utils.getSubComponentId(a.attr("id"),b))};Tobago.Utils.getSubComponentId=function(a,b){return a!=null?"#"+a.replace(/:/g,"\\:")+"\\:\\:"+b:null};Tobago.Utils.findSuperComponent=function(a){return jQuery(Tobago.Utils.getSuperComponentId(a.attr("id")))};
Tobago.Utils.getSuperComponentId=function(a){return"#"+a.substring(0,a.lastIndexOf("::")).replace(/:/g,"\\:")};Tobago.Utils.keepElementInVisibleArea=function(a){a.each(function(){var b=jQuery(this),c=jQuery(".tobago-page-content:first"),d=b.offset().left,e=b.offset().top;d=Math.max(0,Math.min(d,c.outerWidth()-b.outerWidth()));e=Math.max(0,Math.min(e,c.outerHeight()-b.outerHeight()));b.css("left",d);b.css("top",e)})};
Tobago.Utils.acceleratorKeyEvent=function(){return jQuery.browser.webkit||jQuery.browser.mozilla?"keydown":"keypress"};

