/*----------------------------------------------------------------------------\
|                               Tab Pane 1.02                                 |
|-----------------------------------------------------------------------------|
|                         Created by Erik Arvidsson                           |
|                  (http://webfx.eae.net/contact.html#erik)                   |
|                      For WebFX (http://webfx.eae.net/)                      |
|-----------------------------------------------------------------------------|
|                Copyright (c) 2002, 2003, 2006 Erik Arvidsson                |
|-----------------------------------------------------------------------------|
| Licensed under the Apache License, Version 2.0 (the "License"); you may not |
| use this file except in compliance with the License.  You may obtain a copy |
| of the License at http://www.apache.org/licenses/LICENSE-2.0                |
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| Unless  required  by  applicable law or  agreed  to  in  writing,  software |
| distributed under the License is distributed on an  "AS IS" BASIS,  WITHOUT |
| WARRANTIES OR  CONDITIONS OF ANY KIND,  either express or implied.  See the |
| License  for the  specific language  governing permissions  and limitations |
| under the License.                                                          |
|-----------------------------------------------------------------------------|
| 2002-01-?? | First working version                                          |
| 2002-02-17 | Cleaned up for 1.0 public version                              |
| 2003-02-18 | Changed from javascript uri for anchors to return false        |
| 2003-03-03 | Added dispose methods to release IE memory                     |
| 2006-05-28 | Changed license to Apache Software License 2.0.                |
|-----------------------------------------------------------------------------|
| Dependencies: *.css           a css file to define the layout               |
|-----------------------------------------------------------------------------|
| Created 2002-01-?? | All changes are in the log above. | Updated 2006-05-28 |
\----------------------------------------------------------------------------*/function disposeAllTabs(){if(hasSupport()){var a=document.getElementsByTagName("*"),b=a.length,c=/tab\-pane/,d,e,f=[];for(var g=0;g<b;g++){e=a[g],d=e.className;if(d=="")continue;c.test(d)&&e.tabPane&&(f[f.length]=e.tabPane)}for(var g=f.length-1;g>=0;g--)f[g].dispose(),f[g]=null}}function setupAllTabs(){if(hasSupport()){var a=document.getElementsByTagName("*"),b=a.length,c=/tab\-pane/,d=/tab\-page/,e,f,g;for(var h=0;h<b;h++){f=a[h],e=f.className;if(e=="")continue;c.test(e)&&!f.tabPane?new WebFXTabPane(f):d.test(e)&&!f.tabPage&&c.test(f.parentNode.className)&&f.parentNode.tabPane.addTabPage(f)}}}function WebFXTabPage(a,b,c){if(hasSupport()&&a!=null){this.element=a,this.element.tabPage=this,this.index=c;var d=a.childNodes;for(var e=0;e<d.length;e++)if(d[e].nodeType==1&&d[e].className=="tab"){this.tab=d[e];break}var f=document.createElement("A");this.aElement=f,f.href="#",f.onclick=function(){return!1};while(this.tab.hasChildNodes())f.appendChild(this.tab.firstChild);this.tab.appendChild(f);var g=this;this.tab.onclick=function(){g.select();return!1},this.tab.onmouseover=function(){WebFXTabPage.tabOver(g)},this.tab.onmouseout=function(){WebFXTabPage.tabOut(g)}}}function WebFXTabPane(a,b){if(hasSupport()&&a!=null){this.element=a,this.element.tabPane=this,this.pages=[],this.selectedIndex=null,this.useCookie=b!==null?b:!0,this.element.className=this.classNameTag+" "+this.element.className,this.tabRow=document.createElement("div"),this.tabRow.className="tab-row",a.insertBefore(this.tabRow,a.firstChild);var c=0;this.useCookie&&(c=Number(WebFXTabPane.getCookie("webfxtab_"+this.element.id)),isNaN(c)&&(c=0)),this.selectedIndex=c;var d=a.childNodes,e;for(var f=0;f<d.length;f++)d[f].nodeType==1&&d[f].className=="tab-page"&&this.addTabPage(d[f])}}function hasSupport(){if(typeof hasSupport.support!="undefined")return hasSupport.support;var a=/msie 5\.[56789]/i.test(navigator.userAgent);hasSupport.support=typeof document.implementation!="undefined"&&document.implementation.hasFeature("html","1.0")||a,a&&(document._getElementsByTagName=document.getElementsByTagName,document.getElementsByTagName=function(a){return a=="*"?document.all:document._getElementsByTagName(a)});return hasSupport.support}WebFXTabPane.prototype.classNameTag="dynamic-tab-pane-control",WebFXTabPane.prototype.setSelectedIndex=function(a){this.selectedIndex!=a&&(this.selectedIndex!=null&&this.pages[this.selectedIndex]!=null&&this.pages[this.selectedIndex].hide(),this.selectedIndex=a,this.pages[this.selectedIndex].show(),this.useCookie&&WebFXTabPane.setCookie("webfxtab_"+this.element.id,a))},WebFXTabPane.prototype.getSelectedIndex=function(){return this.selectedIndex},WebFXTabPane.prototype.addTabPage=function(a){if(hasSupport()){if(a.tabPage==this)return a.tabPage;var b=this.pages.length,c=this.pages[b]=new WebFXTabPage(a,this,b);c.tabPane=this,this.tabRow.appendChild(c.tab),b==this.selectedIndex?c.show():c.hide();return c}},WebFXTabPane.prototype.dispose=function(){this.element.tabPane=null,this.element=null,this.tabRow=null;for(var a=0;a<this.pages.length;a++)this.pages[a].dispose(),this.pages[a]=null;this.pages=null},WebFXTabPane.setCookie=function(a,b,c){var d="";if(c){var e=new Date;e.setTime(e.getTime()+c*24*60*60*1e3),d="; expires="+e.toGMTString()}document.cookie=a+"="+b+d+"; path=/"},WebFXTabPane.getCookie=function(a){var b=new RegExp("(;|^)[^;]*("+a+")=([^;]*)(;|$)"),c=b.exec(document.cookie);return c!=null?c[3]:null},WebFXTabPane.removeCookie=function(a){setCookie(a,"",-1)},WebFXTabPage.prototype.show=function(){var a=this.tab,b=a.className+" selected";b=b.replace(/ +/g," "),a.className=b,this.element.style.display="block"},WebFXTabPage.prototype.hide=function(){var a=this.tab,b=a.className;b=b.replace(/ selected/g,""),a.className=b,this.element.style.display="none"},WebFXTabPage.prototype.select=function(){this.tabPane.setSelectedIndex(this.index)},WebFXTabPage.prototype.dispose=function(){this.aElement.onclick=null,this.aElement=null,this.element.tabPage=null,this.tab.onclick=null,this.tab.onmouseover=null,this.tab.onmouseout=null,this.tab=null,this.tabPane=null,this.element=null},WebFXTabPage.tabOver=function(a){var b=a.tab,c=b.className+" hover";c=c.replace(/ +/g," "),b.className=c},WebFXTabPage.tabOut=function(a){var b=a.tab,c=b.className;c=c.replace(/ hover/g,""),b.className=c};if(typeof window.addEventListener!="undefined")window.addEventListener("load",setupAllTabs,!1);else if(typeof window.attachEvent!="undefined")window.attachEvent("onload",setupAllTabs),window.attachEvent("onunload",disposeAllTabs);else if(window.onload!=null){var oldOnload=window.onload;window.onload=function(a){oldOnload(a),setupAllTabs()}}else window.onload=setupAllTabs
