﻿
if (document.domain.indexOf("gastro.rosenheim24.de") > 0) document.domain = "gastro.rosenheim24.de";
//prototype object:Tab
function Tab(strTabID, strTabName, nodeContent) {
	//properties & defaults
	this.strTabName 			= "New Tab";
	this.nodeContent			= null;
	this.strTabID				= null;

	
	//set properties
	if (nodeContent)
		this.nodeContent 	= nodeContent;
	if (strTabName)
		this.strTabName 	= strTabName;
	if (strTabID)
		this.strTabID 		= strTabID;
}


//prototype object: TabBox
function PortalTabBox(strContainerNodeID, iBoxHeight, boolCycle, iCyclePeriod) {
	
	//properties & defaults
	this.nodeContainer 		= null;
	this.nodeContent		= document.createElement("div");
	this.strID				= "TabBox";
	this.arrTabs			= new Array();
	this.strActiveTabID		= null;
	this.iBoxHeight			= 200;
	this.boolCycle			= false;
	this.iCyclePeriod		= 5000;
	this.strHeadlineMarkup	= null;
	this.boolAdminMode      = false;
	
	//set properties
	this.iBoxHeight			= iBoxHeight;
	this.boolCycle			= boolCycle;
	this.iCyclePeriod		= iCyclePeriod;
	if (document.getElementById(strContainerNodeID))
		this.nodeContainer = document.getElementById(strContainerNodeID);
	
}

	//method for TabBox: add a tab
	PortalTabBox.prototype.AddTab = function(strTabID, strTabName, ContentNode) {
		//alert(ContentNode.innerHTML);
		var newtab = new Tab (strTabID, strTabName, ContentNode);
		this.arrTabs.push(newtab); 
	};
	
	//method for TabBox: set the active tab
	PortalTabBox.prototype.SetActiveTab = function(strTabID) {
		//alert(strTabID);
		this.strActiveTabID = strTabID;
	};
	
	//method for TabBox: change active tab
	PortalTabBox.prototype.ChangeTab = function(strTabID) {
		//alert (strTabID);
		this.SetActiveTab(strTabID);
		this.Render();
		return false;
	};
	
	//method for TabBox: toggle cycling through active tabs
	PortalTabBox.prototype.ToggleCycleTabs = function (boolActive) {
		this.boolCycle = boolActive;
	};
	
	//method for TabBox: go to next Tab 
	PortalTabBox.prototype.GoToNextTab = function () {
		if (this.boolCycle) {
			//find next tab
			var strNextTabID;
			for (var t=0; t<this.arrTabs.length; t++) {
				if (this.arrTabs[t].strTabID == this.strActiveTabID) {
					if (t==(this.arrTabs.length-1)) {
						strNextTabID = this.arrTabs[0].strTabID;
						break;
					}
					if (t<(this.arrTabs.length-1)) {
						strNextTabID = this.arrTabs[t+1].strTabID;
					}
				}   
			}
			this.ChangeTab(strNextTabID);
		}
	};
	
	//method for getting all tabs
	PortalTabBox.prototype.GetContent	= function() {
		if (this.nodeContainer) {
		    	        	   
		    if (this.nodeContainer.innerHTML.match(/portlet/)) this.boolAdminMode = true;
			
			if (!this.boolAdminMode) {	
				
		        //fetch the title of the box, if there is one
		        // - get the first occurence of a h2 node in all child nodes
        		
		        var nodeTitle =  this.FindFirstChild(this.nodeContainer, "H2", "DIV");
		        if (nodeTitle) {
			        this.AddHeadline(nodeTitle.innerHTML);
			        //alert(nodeTitle.innerHTML);
		        }
		        var nodeContentContainer = this.FindFirstChild(this.nodeContainer, "DIV");
        		
        		
		        if (nodeContentContainer && nodeContentContainer.hasChildNodes() ) {
			        //get each h3 - div pair inside... (hui...)
			        var nodeChild = nodeContentContainer.firstChild;
			        var iTabNum = 0;
			        do {
				        var nodeTabTitle = this.FindFirstSilbling(nodeChild, "H3", "DIV");
				        if (nodeTabTitle) {
					        //alert(nodeTabTitle.innerHTML);
					        nodeChild = nodeTabTitle.nextSibling;
					        var nodeTabContent = this.FindFirstSilbling(nodeChild, "DIV", "H3");
					        if (nodeTabContent) {
						        //strTabID, strTabName, strContentProviderNode
						        this.AddTab("Tab" + iTabNum, nodeTabTitle.innerHTML, nodeTabContent.cloneNode(true));
						        //alert(nodeTabContent.innerHTML);
						        iTabNum++;
						        nodeChild = nodeTabContent.nextSibling;
					        }
				        }
				        else {				
					        nodeChild = nodeChild.nextSibling;
				        }
			        }
			        while (nodeChild);
		        }
		    }
	    }	
	}
	
	//method for adding additional, external tabcontent _without_ rendering the result
	PortalTabBox.prototype.AddExternalTabDelayed = function (strProviderNodeId) {
       var nodeProviderNode = document.getElementById(strProviderNodeId);
       if (nodeProviderNode && nodeProviderNode.hasChildNodes() ) {
            //get each h3 - div pair inside... (hui...)
            var nodeChild = nodeProviderNode.firstChild;
            do {
                var nodeTabTitle = this.FindFirstSilbling(nodeChild, "H3", "DIV");
                if (nodeTabTitle) {
                   //alert(nodeTabTitle.innerHTML);
                   nodeChild = nodeTabTitle.nextSibling;
                   var nodeTabContent = this.FindFirstSilbling(nodeChild, "DIV", "H3");
                   if (nodeTabContent) {
	                   //strTabID, strTabName, strContentProviderNode
	                   this.AddTab(strProviderNodeId, nodeTabTitle.innerHTML, nodeTabContent.cloneNode(true));
	                   //alert(nodeTabContent.innerHTML);
	                   nodeChild = nodeTabContent.nextSibling;
                   }
                }
                else {				
                   nodeChild = nodeChild.nextSibling;
                }
            }
            while (nodeChild);
            
            //clean up and remove all childs in nodeProviderNode
		    while (nodeProviderNode.firstChild)
			    nodeProviderNode.removeChild(nodeProviderNode.firstChild)
       }    
	}
	
	//method for adding additional, external tabcontent and rendering the result
	PortalTabBox.prototype.AddExternalTab = function (strProviderNodeId) {
	    this.AddExternalTabDelayed(strProviderNodeId);
	    this.Render();
	}
	
	
	
	
	//method for finding the first child node with a certain node name while not passing a node which is not allowed
	PortalTabBox.prototype.FindFirstChild = function (nodeParent, strNodeName, strNodeNameNotAllowed) {
		var nodeChild = nodeParent.firstChild;
		do {
			//passing a node which is not allowed?
			if (strNodeNameNotAllowed)
				if (nodeChild && nodeChild.nodeName == strNodeNameNotAllowed) return null;
			if (nodeChild && nodeChild.nodeName == strNodeName) return nodeChild;
			nodeChild = nodeChild.nextSibling;
		}
		while (nodeChild);
		return null;
	}
	
	//method for finding the first silbling node with a certain node name while not passing a node which is not allowed
	PortalTabBox.prototype.FindFirstSilbling = function (nodeSilbling, strNodeName, strNodeNameNotAllowed) {
		var nodeSilbling = nodeSilbling;
		do {
			if (strNodeNameNotAllowed)
				if (nodeSilbling && nodeSilbling.nodeName == strNodeNameNotAllowed) return null;
			if (nodeSilbling && nodeSilbling.nodeName == strNodeName) return nodeSilbling;
			nodeSilbling = nodeSilbling.nextSibling;
		}
		while (nodeSilbling);
		return null;
	}
	
	
	//method for drawing the content
	PortalTabBox.prototype.DrawContent = function(nodeContentTarget, nodeContentProvider) {
		//alert(this.nodeContentProvider.innerHTML);
		//clean up first...
		while (nodeContentTarget.firstChild)
			nodeContentTarget.removeChild(nodeContentTarget.firstChild)
		//append the contentprovider node to the content node
		if (nodeContentProvider) {
			//alert(nodeContentProvider.innerHTML);
			var newContent = nodeContentProvider.cloneNode(true);
			newContent.removeAttribute("style");
			newContent.visibility = "visible";
			nodeContentTarget.appendChild(newContent);
		}
	}
	
	
	//method for adding a headline to the box (markup allowed)
	PortalTabBox.prototype.AddHeadline = function (strHeadlineMarkup) {
		if (strHeadlineMarkup) this.strHeadlineMarkup = strHeadlineMarkup;
	};
	
	
	
	
	
	
	
	//method for TabBox: render the box
	PortalTabBox.prototype.Render = function(boolUpdate) {
		//override in subclasses
	};
	
	

/////////1 COLUMN 115px//////////////////
//inherits TabBox	
function TabBox1Col115(strContainerNodeID, iContentHeight, boolCycle, iCyclePeriod) {
	//pass the parameters to the ancestors constructor
	this.constructor(strContainerNodeID, iContentHeight, boolCycle, iCyclePeriod);
	//fetch the content
	this.GetContent();
}	
//do the inheritance
TabBox1Col115.prototype = new PortalTabBox();

    
    //method for TabBox1Col: render the box
	TabBox1Col115.prototype.Render = function() {
		if (this.nodeContainer && !this.boolAdminMode) {
		    //create main elements
		    var TabBox 			= this;
		    var Box1Col 		= document.createElement("div");
		    var PaneTop			= document.createElement("div");
		    var PaneBottom		= document.createElement("div");
    		
		    //assign css classes;
		    Box1Col.className 			= "R1024VOL_TabBox1Col115";
		    PaneTop.className 			= "PaneTop";
		    PaneBottom.className 		= "PaneBottom";
    		
		    //clean up and remove all childs in container
		    while (this.nodeContainer.firstChild)
			    this.nodeContainer.removeChild(this.nodeContainer.firstChild)
    			
		    //iterate over tabs...
		    if (this.arrTabs.length > 0) {
    			
    			if (this.strActiveTabID	== null) this.strActiveTabID = this.arrTabs[0].strTabID;
    			
			    var boolActiverow				= false;
			    var Headline					= document.createElement("h4");
				    Headline.className			= "R1024VOL_TabBox";
			    var ULTop 						= document.createElement("ul");
				    ULTop.className				= "R1024VOL_TabBox R1024VOL_TabBox1Col115TopLinks";
			    var ULBottom					= document.createElement("ul");
				    ULBottom.className			= "R1024VOL_TabBox R1024VOL_TabBox1Col115BottomLinks";
			    var nodeContentProvider;
			    this.nodeContent.className		= "R1024VOL_TabBox1Col115Content";
    			
			    var iNextElement				= 0;
			    var iContentHeight				= this.iBoxHeight
    			
			    //calculate content height //36
			    iContentHeight	= this.iBoxHeight - ( (this.arrTabs.length * 30) + 17 );
    					
			    //headline, if set...
			    if (this.strHeadlineMarkup && this.strHeadlineMarkup != "") {
				    iContentHeight	-= 19;
				    Headline.innerHTML = this.strHeadlineMarkup;
				    PaneBottom.appendChild(Headline);
			    }
			    if (iContentHeight>0) this.nodeContent.style.height	= iContentHeight + "px";
			    PaneBottom.style.height = (this.iBoxHeight - 4) + "px";
    			
			    //top tabs
			    for(var t = 0; t< this.arrTabs.length; t++) {
				    var li				= document.createElement("li");
				    var a				= document.createElement("a");
				    var strTabName 		= TabBox.arrTabs[t].strTabName;
				    var strTabID		= TabBox.arrTabs[t].strTabID;
				    var OnClickEvent	= function () { TabBox.ToggleCycleTabs(false);  TabBox.ChangeTab(this.id); return false; };
    				
				    if (strTabID == this.strActiveTabID) {
					    boolActiverow		= true;
					    nodeContentProvider = this.arrTabs[t].nodeContent;
					    li.className += " Active";
				    }
				    a.href 		= "#";
				    a.id 		= strTabID;
				    a.onclick 	= OnClickEvent;
				    a.appendChild(document.createTextNode(strTabName));
				    li.appendChild(a);
				    ULTop.appendChild(li);
    				
				    //leave iteration if active tab is in this row
				    if (boolActiverow) {
					    iNextElement = t + 1;
					    break;
				    }
			    }
    			
			    PaneBottom.appendChild(ULTop);
    			
			    //do only if there is a active tab
			    if (boolActiverow) {
    				
				    this.DrawContent(this.nodeContent, nodeContentProvider);
				    PaneBottom.appendChild(this.nodeContent);
    				
				    if (iNextElement<this.arrTabs.length) {
						    PaneBottom.appendChild(ULBottom);
				    }
    				
				    //bottom tabs
				    for (t = iNextElement; t< this.arrTabs.length; t++) {
					    var li				= document.createElement("li");
					    var a 				= document.createElement("a");
					    var strTabName  	= TabBox.arrTabs[t].strTabName;
					    var strTabID		= TabBox.arrTabs[t].strTabID;
					    var OnClickEvent	= function () { TabBox.ToggleCycleTabs(false); TabBox.ChangeTab(this.id); return false; };
    					
					    a.href 		= "#";
					    a.id 		= strTabID;
					    a.onclick 	= OnClickEvent;
					    a.appendChild(document.createTextNode(strTabName));
					    li.appendChild(a);
					    ULBottom.appendChild(li);
				    }
    				
			    }
		    }
		    //append pane to box node
		    Box1Col.appendChild(PaneTop);
		    Box1Col.appendChild(PaneBottom);
    		
		    //put everything in the container node
		    this.nodeContainer.appendChild(Box1Col);
		    //set timeout for cycling through tabs
		    if (this.boolCycle && this.arrTabs.length>0) window.setTimeout(function () {TabBox.GoToNextTab() }, TabBox.iCyclePeriod);
		}
	}	
    

/////////1 COLUMN 150px//////////////////
//inherits TabBox	
function TabBox1Col150(strContainerNodeID, iContentHeight, boolCycle, iCyclePeriod) {
	//pass the parameters to the ancestors constructor
	this.constructor(strContainerNodeID, iContentHeight, boolCycle, iCyclePeriod);
	//fetch the content
	this.GetContent();
}	
//do the inheritance
TabBox1Col150.prototype = new PortalTabBox();

    
    //method for TabBox1Col: render the box
	TabBox1Col150.prototype.Render = function() {
		if (this.nodeContainer && !this.boolAdminMode) {
		    //create main elements
		    var TabBox 			= this;
		    var Box1Col 		= document.createElement("div");
		    var PaneTop			= document.createElement("div");
		    var PaneBottom		= document.createElement("div");
    		
		    //assign css classes;
		    Box1Col.className 			= "R1024VOL_TabBox1Col150";
		    PaneTop.className 			= "PaneTop";
		    PaneBottom.className 		= "PaneBottom";
    		
		    //clean up and remove all childs in container
		    while (this.nodeContainer.firstChild)
			    this.nodeContainer.removeChild(this.nodeContainer.firstChild)
    			
		    //iterate over tabs...
		    if (this.arrTabs.length > 0) {
    			
    			if (this.strActiveTabID	== null) this.strActiveTabID = this.arrTabs[0].strTabID;
    			
			    var boolActiverow				= false;
			    var Headline					= document.createElement("h4");
				    Headline.className			= "R1024VOL_TabBox";
			    var ULTop 						= document.createElement("ul");
				    ULTop.className				= "R1024VOL_TabBox R1024VOL_TabBox1Col150TopLinks";
			    var ULBottom					= document.createElement("ul");
				    ULBottom.className			= "R1024VOL_TabBox R1024VOL_TabBox1Col150BottomLinks";
			    var nodeContentProvider;
			    this.nodeContent.className		= "R1024VOL_TabBox1Col150Content";
    			
			    var iNextElement				= 0;
			    var iContentHeight				= this.iBoxHeight
    			
			    //calculate content height //36
			    iContentHeight	= this.iBoxHeight - ( (this.arrTabs.length * 30) + 17 );
    					
			    //headline, if set...
			    if (this.strHeadlineMarkup && this.strHeadlineMarkup != "") {
				    iContentHeight	-= 19;
				    Headline.innerHTML = this.strHeadlineMarkup;
				    PaneBottom.appendChild(Headline);
			    }
			    if (iContentHeight>0) this.nodeContent.style.height	= iContentHeight + "px";
			    PaneBottom.style.height = (this.iBoxHeight - 4) + "px";
    			
			    //top tabs
			    for(var t = 0; t< this.arrTabs.length; t++) {
				    var li				= document.createElement("li");
				    var a				= document.createElement("a");
				    var strTabName 		= TabBox.arrTabs[t].strTabName;
				    var strTabID		= TabBox.arrTabs[t].strTabID;
				    var OnClickEvent	= function () { TabBox.ToggleCycleTabs(false);  TabBox.ChangeTab(this.id); return false; };
    				
				    if (strTabID == this.strActiveTabID) {
					    boolActiverow		= true;
					    nodeContentProvider = this.arrTabs[t].nodeContent;
					    li.className += " Active";
				    }
				    a.href 		= "#";
				    a.id 		= strTabID;
				    a.onclick 	= OnClickEvent;
				    a.appendChild(document.createTextNode(strTabName));
				    li.appendChild(a);
				    ULTop.appendChild(li);
    				
				    //leave iteration if active tab is in this row
				    if (boolActiverow) {
					    iNextElement = t + 1;
					    break;
				    }
			    }
    			
			    PaneBottom.appendChild(ULTop);
    			
			    //do only if there is a active tab
			    if (boolActiverow) {
    				
				    this.DrawContent(this.nodeContent, nodeContentProvider);
				    PaneBottom.appendChild(this.nodeContent);
    				
				    if (iNextElement<this.arrTabs.length) {
						    PaneBottom.appendChild(ULBottom);
				    }
    				
				    //bottom tabs
				    for (t = iNextElement; t< this.arrTabs.length; t++) {
					    var li				= document.createElement("li");
					    var a 				= document.createElement("a");
					    var strTabName  	= TabBox.arrTabs[t].strTabName;
					    var strTabID		= TabBox.arrTabs[t].strTabID;
					    var OnClickEvent	= function () { TabBox.ToggleCycleTabs(false); TabBox.ChangeTab(this.id); return false; };
    					
					    a.href 		= "#";
					    a.id 		= strTabID;
					    a.onclick 	= OnClickEvent;
					    a.appendChild(document.createTextNode(strTabName));
					    li.appendChild(a);
					    ULBottom.appendChild(li);
				    }
    				
			    }
		    }
		    //append pane to box node
		    Box1Col.appendChild(PaneTop);
		    Box1Col.appendChild(PaneBottom);
    		
		    //put everything in the container node
		    this.nodeContainer.appendChild(Box1Col);
		    //set timeout for cycling through tabs
		    if (this.boolCycle && this.arrTabs.length>0) window.setTimeout(function () {TabBox.GoToNextTab() }, TabBox.iCyclePeriod);
		}
	}	
    

	
/////////1 COLUMN//////////////////
//inherits TabBox	
function TabBox1Col(strContainerNodeID, iContentHeight, boolCycle, iCyclePeriod) {
	//pass the parameters to the ancestors constructor
	this.constructor(strContainerNodeID, iContentHeight, boolCycle, iCyclePeriod);
	//fetch the content
	this.GetContent();
}	
//do the inheritance
TabBox1Col.prototype = new PortalTabBox();

	//method for TabBox1Col: render the box
	TabBox1Col.prototype.Render = function() {
		if (this.nodeContainer && !this.boolAdminMode) {
		    //create main elements
		    var TabBox 			= this;
		    var Box1Col 		= document.createElement("div");
		    var PaneTop			= document.createElement("div");
		    var PaneBottom		= document.createElement("div");
    		
		    //assign css classes;
		    Box1Col.className 			= "R1024VOL_TabBox1Col";
		    PaneTop.className 			= "PaneTop";
		    PaneBottom.className 		= "PaneBottom";
    		
		    //clean up and remove all childs in container
		    while (this.nodeContainer.firstChild)
			    this.nodeContainer.removeChild(this.nodeContainer.firstChild)
    			
		    //iterate over tabs...
		    if (this.arrTabs.length > 0) {
    			
    			if (this.strActiveTabID	== null) this.strActiveTabID = this.arrTabs[0].strTabID;
    			
			    var boolActiverow				= false;
			    var Headline					= document.createElement("h4");
				    Headline.className			= "R1024VOL_TabBox";
			    var ULTop 						= document.createElement("ul");
				    ULTop.className				= "R1024VOL_TabBox R1024VOL_TabBox1ColTopLinks";
			    var ULBottom					= document.createElement("ul");
				    ULBottom.className			= "R1024VOL_TabBox R1024VOL_TabBox1ColBottomLinks";
			    var nodeContentProvider;
			    this.nodeContent.className		= "R1024VOL_TabBox1ColContent";
    			
			    var iNextElement				= 0;
			    var iContentHeight				= this.iBoxHeight
    			
			    //calculate content height //36
			    iContentHeight	= this.iBoxHeight - ( (this.arrTabs.length * 30) + 17 );
    					
			    //headline, if set...
			    if (this.strHeadlineMarkup && this.strHeadlineMarkup != "") {
				    iContentHeight	-= 19;
				    Headline.innerHTML = this.strHeadlineMarkup;
				    PaneBottom.appendChild(Headline);
			    }
			    if (iContentHeight>0) this.nodeContent.style.height	= iContentHeight + "px";
			    PaneBottom.style.height = (this.iBoxHeight - 4) + "px";
    			
			    //top tabs
			    for(var t = 0; t< this.arrTabs.length; t++) {
				    var li				= document.createElement("li");
				    var a				= document.createElement("a");
				    var strTabName 		= TabBox.arrTabs[t].strTabName;
				    var strTabID		= TabBox.arrTabs[t].strTabID;
				    var OnClickEvent	= function () { TabBox.ToggleCycleTabs(false);  TabBox.ChangeTab(this.id); return false; };
    				
				    if (strTabID == this.strActiveTabID) {
					    boolActiverow		= true;
					    nodeContentProvider = this.arrTabs[t].nodeContent;
					    li.className += " Active";
				    }
				    a.href 		= "#";
				    a.id 		= strTabID;
				    a.onclick 	= OnClickEvent;
				    a.appendChild(document.createTextNode(strTabName));
				    li.appendChild(a);
				    ULTop.appendChild(li);
    				
				    //leave iteration if active tab is in this row
				    if (boolActiverow) {
					    iNextElement = t + 1;
					    break;
				    }
			    }
    			
			    PaneBottom.appendChild(ULTop);
    			
			    //do only if there is a active tab
			    if (boolActiverow) {
    				
				    this.DrawContent(this.nodeContent, nodeContentProvider);
				    PaneBottom.appendChild(this.nodeContent);
    				
				    if (iNextElement<this.arrTabs.length) {
						    PaneBottom.appendChild(ULBottom);
				    }
    				
				    //bottom tabs
				    for (t = iNextElement; t< this.arrTabs.length; t++) {
					    var li				= document.createElement("li");
					    var a 				= document.createElement("a");
					    var strTabName  	= TabBox.arrTabs[t].strTabName;
					    var strTabID		= TabBox.arrTabs[t].strTabID;
					    var OnClickEvent	= function () { TabBox.ToggleCycleTabs(false); TabBox.ChangeTab(this.id); return false; };
    					
					    a.href 		= "#";
					    a.id 		= strTabID;
					    a.onclick 	= OnClickEvent;
					    a.appendChild(document.createTextNode(strTabName));
					    li.appendChild(a);
					    ULBottom.appendChild(li);
				    }
    				
			    }
		    }
		    //append pane to box node
		    Box1Col.appendChild(PaneTop);
		    Box1Col.appendChild(PaneBottom);
    		
		    //put everything in the container node
		    this.nodeContainer.appendChild(Box1Col);
		    //set timeout for cycling through tabs
		    if (this.boolCycle && this.arrTabs.length>0) window.setTimeout(function () {TabBox.GoToNextTab() }, TabBox.iCyclePeriod);
		}
	}	


	
	
/////////2 COLUMNS//////////////////	
//inherits TabBox	
function TabBox2Col(strContainerNodeID, iContentHeight, boolCycle, iCyclePeriod) {
	//pass the parameters to the ancestors constructor
	this.constructor(strContainerNodeID, iContentHeight, boolCycle, iCyclePeriod);
	//fetch the content
	this.GetContent();
}
//do the inheritance
TabBox2Col.prototype = new PortalTabBox();
	
	//method for TabBox2Col: render the box
	TabBox2Col.prototype.Render = function() {
	    
	    if (this.nodeContainer && !this.boolAdminMode) {
	    
		    //create main elements
		    var Box2Col 		= document.createElement("div");
		    var PaneTop			= document.createElement("div");
		    var PaneBottom		= document.createElement("div");
		    var ClearFloat		= document.createElement("br");
    		
		    //assign css classes
		    Box2Col.className 			= "R1024VOL_TabBox2Col";
		    PaneTop.className 			= "PaneTop";
		    PaneBottom.className 		= "PaneBottom";
		    ClearFloat.className		= "Clear";
    		
		    //clean up and remove all childs in container
		    while (this.nodeContainer.firstChild)
			    this.nodeContainer.removeChild(this.nodeContainer.firstChild)
    		
		    //iterate over tabs...
		    if (this.arrTabs.length > 0) {
		    
		        if (this.strActiveTabID	== null) this.strActiveTabID = this.arrTabs[0].strTabID;
		    
			    var TabBox 						= this;
			    var col 						= 0;
			    var boolActiverow				= false;
			    var Headline					= document.createElement("h4");
				    Headline.className			= "R1024VOL_TabBox";
			    var ULTop 						= document.createElement("ul");
				    ULTop.className				= "R1024VOL_TabBox R1024VOL_TabBox2ColTopLinks";
			    var ULBottom					= document.createElement("ul");
				    ULBottom.className			= "R1024VOL_TabBox R1024VOL_TabBox2ColBottomLinks";
			    var nodeContentProvider;
			    var ClearFloatTop				= ClearFloat.cloneNode(false);
			    var ClearFloatBottom			= ClearFloat.cloneNode(false);
			    this.nodeContent.className		= "R1024VOL_TabBox2ColContent";
			    var nodeContentFooter			= document.createElement("div");	
				    nodeContentFooter.className = "R1024VOL_TabBox2ColContentFooter";
			    var iNextElement				= 0;
			    var iContentHeight				= this.iBoxHeight
    						
			    //calculate content height //
			    iContentHeight	= this.iBoxHeight - ( (Math.ceil(this.arrTabs.length/2) * 30) + 20 );
    					
			    //headline, if set...
			    if (this.strHeadlineMarkup && this.strHeadlineMarkup != "") {
				    iContentHeight	-= 19;
				    Headline.innerHTML = this.strHeadlineMarkup;
				    PaneBottom.appendChild(Headline);
			    }
			    if (iContentHeight>0) this.nodeContent.style.height	= iContentHeight + "px";
			    PaneBottom.style.height = (this.iBoxHeight - 4) + "px";
    			
			    //top tabs
			    for(var t = 0; t< this.arrTabs.length; t++) {
				    var li				= document.createElement("li");
				    var a				= document.createElement("a");
				    var strTabName 		= TabBox.arrTabs[t].strTabName;
				    var strTabID		= TabBox.arrTabs[t].strTabID;
				    var OnClickEvent	= function () { TabBox.ToggleCycleTabs(false);  TabBox.ChangeTab(this.id); return false; };
    				
    				
				    if (col == 1) li.className = "Right";
				    if (strTabID == this.strActiveTabID) {
					    boolActiverow		= true;
					    nodeContentProvider = this.arrTabs[t].nodeContent;
					    li.className += " Active";
					    if (col == 0) this.nodeContent.className += " LeftTab";
					    else this.nodeContent.className += " RightTab";
				    }
				    a.href 		= "#";
				    a.id 		= strTabID;
				    a.onclick 	= OnClickEvent;
				    a.appendChild(document.createTextNode(strTabName));
				    li.appendChild(a);
				    ULTop.appendChild(li);
    				
				    //leave iteration if active tab is in this row
				    if ((col==1 && boolActiverow) || (t==(this.arrTabs.length-1) && boolActiverow)) {
					    iNextElement = t + 1;
					    break;
				    }
				    col = col + 1; if (col>1) col = 0;
			    }
    			
			    PaneBottom.appendChild(ULTop);
			    PaneBottom.appendChild(ClearFloatTop);
    			
			    //do only if there is a active tab
			    if (boolActiverow) {
    				
				    this.DrawContent(this.nodeContent, nodeContentProvider);
				    PaneBottom.appendChild(this.nodeContent);
				    PaneBottom.appendChild(nodeContentFooter);
    				
				    //bottom tabs
				    col = 0;
				    for (t = iNextElement; t< this.arrTabs.length; t++) {
					    var li				= document.createElement("li");
					    var a 				= document.createElement("a");
					    var strTabName  	= TabBox.arrTabs[t].strTabName;
					    var strTabID		= TabBox.arrTabs[t].strTabID;
					    var OnClickEvent	= function () { TabBox.ToggleCycleTabs(false); TabBox.ChangeTab(this.id); return false; };
    					
					    if (col == 1) li.className = "Right";
					    a.href 		= "#";
					    a.id 		= strTabID;
					    a.onclick 	= OnClickEvent;
					    a.appendChild(document.createTextNode(strTabName));
					    li.appendChild(a);
					    ULBottom.appendChild(li);
					    col = col + 1; if (col>1) col = 0;
				    }
				    if (iNextElement<this.arrTabs.length) {
					    PaneBottom.appendChild(ULBottom);
					    PaneBottom.appendChild(ClearFloatBottom);
				    }
			    }
		    }
    		
		    Box2Col.appendChild(PaneTop);
		    Box2Col.appendChild(PaneBottom);
    		
    		
		    //put everything in the container node
		    this.nodeContainer.appendChild(Box2Col);
		    //set timeout for cycling through tabs
		    if (this.boolCycle && this.arrTabs.length>0) window.setTimeout(function () {TabBox.GoToNextTab() }, TabBox.iCyclePeriod);
		}
	}		
	
		

/////////3 COLUMNS//////////////////
//inherits TabBox	
function TabBox3Col(strContainerNodeID, iContentHeight, boolCycle, iCyclePeriod) {
	//pass the parameters to the ancestors constructor
	this.constructor(strContainerNodeID, iContentHeight, boolCycle, iCyclePeriod);
	//fetch the content
	this.GetContent();
}	
//do the inheritance
TabBox3Col.prototype = new PortalTabBox();	


	//method for TabBox3Col: render the box
	TabBox3Col.prototype.Render = function() {
	    
	    if (this.nodeContainer && !this.boolAdminMode) {
	
		    //create main elements
		    var Box3Col 		= document.createElement("div");
		    var PaneTop			= document.createElement("div");
		    var PaneBottom		= document.createElement("div");
		    var ClearFloat		= document.createElement("br");
    		
		    //assign css classes;
		    Box3Col.className 			= "R1024VOL_TabBox3Col";
		    PaneTop.className 			= "PaneTop";
		    PaneBottom.className 		= "PaneBottom";
		    ClearFloat.className		= "Clear";
    		
		    //clean up and remove all childs in container
		    while (this.nodeContainer.firstChild)
			    this.nodeContainer.removeChild(this.nodeContainer.firstChild)
    		
		    //iterate over tabs...
		    if (this.arrTabs.length > 0) {
		        
		        if (this.strActiveTabID	== null) this.strActiveTabID = this.arrTabs[0].strTabID;
		    
			    var TabBox 						= this;
			    var col 						= 0;
			    var boolActiverow				= false;
			    var Headline					= document.createElement("h4");
				    Headline.className			= "R1024VOL_TabBox";
			    var ULTop 						= document.createElement("ul");
				    ULTop.className				= "R1024VOL_TabBox R1024VOL_TabBox3ColTopLinks";
			    var ULBottom					= document.createElement("ul");
				    ULBottom.className			= "R1024VOL_TabBox R1024VOL_TabBox3ColBottomLinks";
			    var nodeContentProvider;
			    var ClearFloatTop				= ClearFloat.cloneNode(false);
			    var ClearFloatBottom			= ClearFloat.cloneNode(false);
			    this.nodeContent.className		= "R1024VOL_TabBox3ColContent";
			    var nodeContentHeader			= document.createElement("div");	
			    nodeContentHeader.className 	= "R1024VOL_TabBox3ColContentTop";
			    var nodeContentFooter			= document.createElement("div");	
				    nodeContentFooter.className = "R1024VOL_TabBox3ColContentBot";
			    var iContentHeight				= this.iBoxHeight
    				
			    //calculate content height //36
			    var rows; if (this.arrTabs.length>3) rows = 2; else rows = 1;
			    iContentHeight	= this.iBoxHeight - ( (rows * 30) + 20 );
    					
			    //headline, if set...
			    if (this.strHeadlineMarkup && this.strHeadlineMarkup != "") {
				    iContentHeight	-= 19;
				    Headline.innerHTML = this.strHeadlineMarkup;
				    PaneBottom.appendChild(Headline);
			    }
			    if (iContentHeight>0) this.nodeContent.style.height	= iContentHeight + "px";
			    //PaneBottom.style.height = (this.iBoxHeight - 4) + "px";
    			
    				
			    //top tabs
			    for(var t = 0; (t< this.arrTabs.length && t<3); t++) {
				    var li				= document.createElement("li");
				    var a				= document.createElement("a");
				    var strTabName 		= TabBox.arrTabs[t].strTabName;
				    var strTabID		= TabBox.arrTabs[t].strTabID;
				    var OnClickEvent	= function () { TabBox.ToggleCycleTabs(false); TabBox.ChangeTab(this.id); return false; };
    				
				    if (col == 2) li.className += " Right";
				    if (strTabID == this.strActiveTabID) {
					    boolActiverow		= true;
					    nodeContentProvider = this.arrTabs[t].nodeContent;
					    li.className += " Active";
					    if (col == 0) nodeContentHeader.className += "Left";
					    if (col == 1) nodeContentHeader.className += "Mid";
					    if (col == 2) nodeContentHeader.className += "Right";
				    }
    				
				    a.href 		= "#";
				    a.id 		= strTabID;
				    a.onclick 	= OnClickEvent;
				    a.appendChild(document.createTextNode(strTabName));
				    li.appendChild(a);
				    ULTop.appendChild(li);
    				
				    col = col + 1; if (col>2) col = 0;
			    }
    			
			    PaneBottom.appendChild(ULTop);
			    PaneBottom.appendChild(ClearFloatTop);
    			
    			
			    PaneBottom.appendChild(nodeContentHeader);
			    PaneBottom.appendChild(this.nodeContent);
			    PaneBottom.appendChild(nodeContentFooter);
    			
    			
			    //bottom tabs
			    col = 0;
			    for(var t = 3; (t< this.arrTabs.length && t<6); t++) {
				    var li				= document.createElement("li");
				    var a				= document.createElement("a");
				    var strTabName 		= TabBox.arrTabs[t].strTabName;
				    var strTabID		= TabBox.arrTabs[t].strTabID;
				    var OnClickEvent	= function () { TabBox.ToggleCycleTabs(false); TabBox.ChangeTab(this.id); return false; };
    				
				    if (col == 2) li.className += " Right";
				    if (strTabID == this.strActiveTabID) {
					    boolActiverow		= true;
					    nodeContentProvider = this.arrTabs[t].nodeContent;
					    li.className += " Active";
					    if (col == 0) nodeContentFooter.className += "Left";
					    if (col == 1) nodeContentFooter.className += "Mid";
					    if (col == 2) nodeContentFooter.className += "Right";
				    }
    	
				    a.href 		= "#";
				    a.id 		= strTabID;
				    a.onclick 	= OnClickEvent;
				    a.appendChild(document.createTextNode(strTabName));
				    li.appendChild(a);
				    ULBottom.appendChild(li);
    				
				    col = col + 1; if (col>2) col = 0;
			    }
    			
			    if (boolActiverow)
				    this.DrawContent(this.nodeContent, nodeContentProvider);
    						
			    if (this.arrTabs.length > 3) {
				    PaneBottom.appendChild(ULBottom);
				    PaneBottom.appendChild(ClearFloatBottom);			
			    }
    			
		    }
    		
		    //append pane to box node
		    Box3Col.appendChild(PaneTop);
		    Box3Col.appendChild(PaneBottom);
    		
		    //put everything in the container node
		    this.nodeContainer.appendChild(Box3Col);
		    //set timeout for cycling through tabs
		    if (this.boolCycle && this.arrTabs.length>0) window.setTimeout(function () {TabBox.GoToNextTab() }, TabBox.iCyclePeriod);
		}
	}
