/* SkinGzip V 1.0.3770.17931, PackageDate: 06.09.2010 10:54:54 */



if (document.domain.indexOf("medienhaus.at") > 0) document.domain = "medienhaus.at";
//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 			= "Dotcom_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			= "Dotcom_TabBox";
			    var ULTop 						= document.createElement("ul");
				    ULTop.className				= "Dotcom_TabBox Dotcom_TabBox1Col115TopLinks";
			    var ULBottom					= document.createElement("ul");
				    ULBottom.className			= "Dotcom_TabBox Dotcom_TabBox1Col115BottomLinks";
			    var nodeContentProvider;
			    this.nodeContent.className		= "Dotcom_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 			= "Dotcom_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			= "Dotcom_TabBox";
			    var ULTop 						= document.createElement("ul");
				    ULTop.className				= "Dotcom_TabBox Dotcom_TabBox1Col150TopLinks";
			    var ULBottom					= document.createElement("ul");
				    ULBottom.className			= "Dotcom_TabBox Dotcom_TabBox1Col150BottomLinks";
			    var nodeContentProvider;
			    this.nodeContent.className		= "Dotcom_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 			= "Dotcom_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			= "Dotcom_TabBox";
			    var ULTop 						= document.createElement("ul");
				    ULTop.className				= "Dotcom_TabBox Dotcom_TabBox1ColTopLinks";
			    var ULBottom					= document.createElement("ul");
				    ULBottom.className			= "Dotcom_TabBox Dotcom_TabBox1ColBottomLinks";
			    var nodeContentProvider;
			    this.nodeContent.className		= "Dotcom_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 			= "Dotcom_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			= "Dotcom_TabBox";
			    var ULTop 						= document.createElement("ul");
				    ULTop.className				= "Dotcom_TabBox Dotcom_TabBox2ColTopLinks";
			    var ULBottom					= document.createElement("ul");
				    ULBottom.className			= "Dotcom_TabBox Dotcom_TabBox2ColBottomLinks";
			    var nodeContentProvider;
			    var ClearFloatTop				= ClearFloat.cloneNode(false);
			    var ClearFloatBottom			= ClearFloat.cloneNode(false);
			    this.nodeContent.className		= "Dotcom_TabBox2ColContent";
			    var nodeContentFooter			= document.createElement("div");	
				    nodeContentFooter.className = "Dotcom_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 			= "Dotcom_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			= "Dotcom_TabBox";
			    var ULTop 						= document.createElement("ul");
				    ULTop.className				= "Dotcom_TabBox Dotcom_TabBox3ColTopLinks";
			    var ULBottom					= document.createElement("ul");
				    ULBottom.className			= "Dotcom_TabBox Dotcom_TabBox3ColBottomLinks";
			    var nodeContentProvider;
			    var ClearFloatTop				= ClearFloat.cloneNode(false);
			    var ClearFloatBottom			= ClearFloat.cloneNode(false);
			    this.nodeContent.className		= "Dotcom_TabBox3ColContent";
			    var nodeContentHeader			= document.createElement("div");	
			    nodeContentHeader.className 	= "Dotcom_TabBox3ColContentTop";
			    var nodeContentFooter			= document.createElement("div");	
				    nodeContentFooter.className = "Dotcom_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);
		}
	}

/*****************************************************************************\

 Javascript "SOAP Client" library

 @version: 1.4 - 2005.12.10
 @author: Matteo Casati, Ihar Voitka - http://www.guru4.net/
 @description: (1) SOAPClientParameters.add() method returns 'this' pointer.
               (2) "_getElementsByTagName" method added for xpath queries.
               (3) "_getXmlHttpPrefix" refactored to "_getXmlHttpProgID" (full 
                   ActiveX ProgID).
               
 @version: 1.3 - 2005.12.06
 @author: Matteo Casati - http://www.guru4.net/
 @description: callback function now receives (as second - optional - parameter) 
               the SOAP response too. Thanks to Ihar Voitka.
               
 @version: 1.2 - 2005.12.02
 @author: Matteo Casati - http://www.guru4.net/
 @description: (1) fixed update in v. 1.1 for no string params.
               (2) the "_loadWsdl" method has been updated to fix a bug when 
               the wsdl is cached and the call is sync. Thanks to Linh Hoang.
               
 @version: 1.1 - 2005.11.11
 @author: Matteo Casati - http://www.guru4.net/
 @description: the SOAPClientParameters.toXML method has been updated to allow
               special characters ("<", ">" and "&"). Thanks to Linh Hoang.

 @version: 1.0 - 2005.09.08
 @author: Matteo Casati - http://www.guru4.net/
 @notes: first release.

\*****************************************************************************/
if (document.domain.indexOf("medienhaus.at") > 0) document.domain = "medienhaus.at";

function SOAPClientParameters()
{
	var _pl = new Array();
	this.add = function(name, value) 
	{
		_pl[name] = value; 
		return this; 
	}
	this.toXml = function()
	{
		var xml = "";
		for(var p in _pl)
		{
			if(typeof(_pl[p]) != "function")
				xml += "<" + p + ">" + _pl[p].toString().replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;") + "</" + p + ">";
		}
		return xml;	
	}
	this.toQueryString = function()
	{
	    var querystring = "";
	    var c = 0;
	    var s = 0;
	    for(var p in _pl)
	    {
	        if(typeof(_pl[p]) != "function") {
	            if (s==0) querystring += "?" + p.toString() + "=" + escape(_pl[p].toString());
	            else  querystring += "&" + p.toString() + "=" + escape(_pl[p].toString());
	            s++;
	        }
	        c++;
	    }
	    return querystring;
	}
}

function SOAPClient() {}

SOAPClient.invoke = function(soap, url, method, parameters, async, callback)
{
    if (soap) {
	    if(async)
		    SOAPClient._loadWsdl(url, method, parameters, async, callback);
	    else
		    return SOAPClient._loadWsdl(url, method, parameters, async, callback);
	}
	else {
	    if(async)
		    SOAPClient._sendGetRequest(url, method, parameters, async, callback);
	    else
		    return SOAPClient._sendGetRequest(url, method, parameters, async, callback);
	}
}

// private: wsdl cache
SOAPClient_cacheWsdl = new Array();

// private: invoke async
SOAPClient._loadWsdl = function(url, method, parameters, async, callback)
{
	// load from cache?
	var wsdl = SOAPClient_cacheWsdl[url];
	if(wsdl + "" != "" && wsdl + "" != "undefined")
		return SOAPClient._sendSoapRequest(url, method, parameters, async, callback, wsdl);
	// get wsdl
	var xmlHttp = SOAPClient._getXmlHttp();
	xmlHttp.open("GET", url + "?wsdl", async);
	if(async) 
	{
		xmlHttp.onreadystatechange = function() 
		{
			if(xmlHttp.readyState == 4)
				SOAPClient._onLoadWsdl(url, method, parameters, async, callback, xmlHttp);
		}
	}
	xmlHttp.send(null);
	if (!async)
		return SOAPClient._onLoadWsdl(url, method, parameters, async, callback, xmlHttp);
}
SOAPClient._onLoadWsdl = function(url, method, parameters, async, callback, req)
{
	var wsdl = req.responseXML;
	SOAPClient_cacheWsdl[url] = wsdl;	// save a copy in cache
	return SOAPClient._sendSoapRequest(url, method, parameters, async, callback, wsdl);
}

SOAPClient._sendGetRequest = function(url, method, parameters, async, callback)
{
    var xmlHttp = SOAPClient._getXmlHttp();
    xmlHttp.open("GET", url + "/" + method + parameters.toQueryString(), async);
    xmlHttp.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
    if(async) 
	{
	    xmlHttp.onreadystatechange = function() 
		{
			if(xmlHttp.readyState == 4)
				SOAPClient._onSendGetRequest(method, async, callback, xmlHttp);
		}
	}
	xmlHttp.send(null);
	if (!async)
		return SOAPClient._onSendGetRequest(method, async, callback, xmlHttp);
}

SOAPClient._onSendGetRequest = function(method, async, callback, req)
{
    var returnXml;
    var doc = document.createElement("div");
    
    try {
        
        doc.innerHTML = req.responseText;
        returnXml  = doc;
    }
    catch(e) {
        //alert("Fehler Fox-Zweig: " + e.description);
    }
    
    try {
    
        if (typeof(req.responseXML.firstChild) != "undefined")
            returnXml = req.responseXML;
    }
    catch(e) {
        //alert("Fehler IE-Zweig: " + e.description);
    }

	if (callback)
	    callback(returnXml);
	
	if (!async)
	    return returnXml;

}


SOAPClient._sendSoapRequest = function(url, method, parameters, async, callback, wsdl)
{
	// get namespace
	var ns = (wsdl.documentElement.attributes["targetNamespace"] + "" == "undefined") ? wsdl.documentElement.attributes.getNamedItem("targetNamespace").nodeValue : wsdl.documentElement.attributes["targetNamespace"].value;
	// build SOAP request
	var sr = 
				"<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
				"<soap:Envelope " +
				"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " +
				"xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" " +
				"xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
				"<soap:Body>" +
				"<" + method + " xmlns=\"" + ns + "\">" +
				parameters.toXml() +
				"</" + method + "></soap:Body></soap:Envelope>";
	// send request
	var xmlHttp = SOAPClient._getXmlHttp();
	xmlHttp.open("POST", url, async);
	var soapaction = ((ns.lastIndexOf("/") != ns.length - 1) ? ns + "/" : ns) + method;
	xmlHttp.setRequestHeader("SOAPAction", soapaction);
	xmlHttp.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
	if(async) 
	{
		xmlHttp.onreadystatechange = function() 
		{
			if(xmlHttp.readyState == 4)
				SOAPClient._onSendSoapRequest(method, async, callback, wsdl, xmlHttp);
		}
	}
	xmlHttp.send(sr);
	if (!async)
		return SOAPClient._onSendSoapRequest(method, async, callback, wsdl, xmlHttp);
}
SOAPClient._onSendSoapRequest = function(method, async, callback, wsdl, req)
{
	var o = null;
	var nd = SOAPClient._getElementsByTagName(req.responseXML, method + "Result");
	if(nd.length == 0)
	{
		if(req.responseXML.getElementsByTagName("faultcode").length > 0)
			throw new Error(500, req.responseXML.getElementsByTagName("faultstring")[0].childNodes[0].nodeValue);
	}
	else
		o = SOAPClient._soapresult2object(nd[0], wsdl);
	if(callback)
		callback(o, req.responseXML);
	if(!async)
		return o;		
}

// private: utils
SOAPClient._getElementsByTagName = function(document, tagName)
{
	try
	{
		// trying to get node omitting any namespaces (latest versions of MSXML.XMLDocument)
		return document.selectNodes(".//*[local-name()=\""+ tagName +"\"]");
	}
	catch (ex) {}
	// old XML parser support
	return document.getElementsByTagName(tagName);
}

SOAPClient._soapresult2object = function(node, wsdl)
{
	return SOAPClient._node2object(node, wsdl);
}
SOAPClient._node2object = function(node, wsdl)
{
	// null node
	if(node == null)
		return null;
	// text node
	if(node.nodeType == 3 || node.nodeType == 4)
		return SOAPClient._extractValue(node, wsdl);
	// leaf node
	if (node.childNodes.length == 1 && (node.childNodes[0].nodeType == 3 || node.childNodes[0].nodeType == 4))
		return SOAPClient._node2object(node.childNodes[0], wsdl);
	var isarray = SOAPClient._getTypeFromWsdl(node.nodeName, wsdl).toLowerCase().indexOf("arrayof") != -1;
	// object node
	if(!isarray)
	{
		var obj = null;
		if(node.hasChildNodes())
			obj = new Object();
		for(var i = 0; i < node.childNodes.length; i++)
		{
			var p = SOAPClient._node2object(node.childNodes[i], wsdl);
			obj[node.childNodes[i].nodeName] = p;
		}
		return obj;
	}
	// list node
	else
	{
		// create node ref
		var l = new Array();
		for(var i = 0; i < node.childNodes.length; i++)
			l[l.length] = SOAPClient._node2object(node.childNodes[i], wsdl);
		return l;
	}
	return null;
}
SOAPClient._extractValue = function(node, wsdl)
{
	var value = node.nodeValue;
	switch(SOAPClient._getTypeFromWsdl(node.parentNode.nodeName, wsdl).toLowerCase())
	{
		default:
		case "s:string":			
			return (value != null) ? value + "" : "";
		case "s:boolean":
			return value+"" == "true";
		case "s:int":
		case "s:long":
			return (value != null) ? parseInt(value + "", 10) : 0;
		case "s:double":
			return (value != null) ? parseFloat(value + "") : 0;
		case "s:datetime":
			if(value == null)
				return null;
			else
			{
				value = value + "";
				value = value.substring(0, value.lastIndexOf("."));
				value = value.replace(/T/gi," ");
				value = value.replace(/-/gi,"/");
				var d = new Date();
				d.setTime(Date.parse(value));										
				return d;				
			}
	}
}
SOAPClient._getTypeFromWsdl = function(elementname, wsdl)
{
	var ell = wsdl.getElementsByTagName("s:element");	// IE
	if(ell.length == 0)
		ell = wsdl.getElementsByTagName("element");	// MOZ
	for(var i = 0; i < ell.length; i++)
	{
		if(ell[i].attributes["name"] + "" == "undefined")	// IE
		{
			if(ell[i].attributes.getNamedItem("name") != null && ell[i].attributes.getNamedItem("name").nodeValue == elementname && ell[i].attributes.getNamedItem("type") != null) 
				return ell[i].attributes.getNamedItem("type").nodeValue;
		}	
		else // MOZ
		{
			if(ell[i].attributes["name"] != null && ell[i].attributes["name"].value == elementname && ell[i].attributes["type"] != null)
				return ell[i].attributes["type"].value;
		}
	}
	return "";
}
// private: xmlhttp factory
SOAPClient._getXmlHttp = function() 
{
	try
	{
		if(window.XMLHttpRequest) 
		{
			var req = new XMLHttpRequest();
			// some versions of Moz do not support the readyState property and the onreadystate event so we patch it!
			if(req.readyState == null) 
			{
				req.readyState = 1;
				req.addEventListener("load", 
									function() 
									{
										req.readyState = 4;
										if(typeof req.onreadystatechange == "function")
											req.onreadystatechange();
									},
									false);
			}
			return req;
		}
		if(window.ActiveXObject) 
			return new ActiveXObject(SOAPClient._getXmlHttpProgID());
	}
	catch (ex) {}
	throw new Error("Your browser does not support XmlHttp objects");
}
SOAPClient._getXmlHttpProgID = function()
{
	if(SOAPClient._getXmlHttpProgID.progid)
		return SOAPClient._getXmlHttpProgID.progid;
	var progids = ["Msxml2.XMLHTTP.5.0", "Msxml2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"];
	var o;
	for(var i = 0; i < progids.length; i++)
	{
		try
		{
			o = new ActiveXObject(progids[i]);
			return SOAPClient._getXmlHttpProgID.progid = progids[i];
		}
		catch (ex) {};
	}
	throw new Error("Could not find an installed XML parser");
}

if (document.domain.indexOf("medienhaus.at") > 0) document.domain = "medienhaus.at";

MainNavigationCommon = new Object();
MainNavigationCommon.strSSOErrorMessage 			= "Fehler: Benutzername oder Passwort falsch";
MainNavigationCommon.strAsHomepage1 				= "VOL als";
MainNavigationCommon.strAsHomepage2 				= "Startseite";
MainNavigationCommon.strLogin						= "Anmelden";
MainNavigationCommon.strLogout						= "Abmelden";
MainNavigationCommon.strRegister					= "Registrieren";
MainNavigationCommon.strOr							= "";

MainNavigationCommon.strRegisterUrl					= "http://freunde.vol.at/register.html";
MainNavigationCommon.strLoginUrl					= "http://vol.at/engine.aspx?page=login";
MainNavigationCommon.strUNameFieldName				= "SSOUserName";
MainNavigationCommon.strPWFieldName					= "SSOPassword";
MainNavigationCommon.strUNameValue					= "Benutzername";
MainNavigationCommon.strPWValue						= "Passwort";
MainNavigationCommon.strProfileUrl					= "http://freunde.vol.at/###username###/";
MainNavigationCommon.strSSOWebServiceUrl			= "/snpeservice.asmx";
MainNavigationCommon.strSSOWebServiceAuthMethod		= "AuthenticateAsObjectAndLogin";
MainNavigationCommon.strSSOWebServiceLogoutMethod	= "Logout";				

function PortalUser(strUserName, strPasswordHash) {
	//properties
	this.strUserName 		= null;
	this.strPasswordHash 	= null;
		
	//set given values
	if (strUserName 	&& strUserName != "") 		this.strUserName 		= strUserName;
	if (strPasswordHash && strPasswordHash != "") 	this.strPasswordHash 	= strPasswordHash;
	
}

function MainNavigationBar () {
	//properties
	this.ULNavigation 				= null;
	this.strActiveNodeID1			= null;
	this.nodeActive                 = null;
	this.nodeHover                  = null;
	this.Switch                     = null;
	this.strActiveNodeID2			= null;
	this.User						= null;
		
	this.strRegisterUrl				= MainNavigationCommon.strRegisterUrl;
	this.strLoginUrl				= MainNavigationCommon.strLoginUrl;
	this.strLogoutUrl				= null;
	this.strOverrideLoginUrl		= null; //this is an extra property so we can see if there is an override
		
	this.strFormAction				= null;
	this.strUNameFieldName			= MainNavigationCommon.strUNameFieldName;
	this.strPWFieldName				= MainNavigationCommon.strPWFieldName;
	this.strProfileUrl				= MainNavigationCommon.strProfileUrl;
	this.boolShowLogin              = true; //sets wether the login-stuff is visible or not
	
	//try to fetch user info
	this.User =  this._ReadUserCookie();
}

	//"Private" methods

	//internal method for deactivating all top navigation elements
	MainNavigationBar.prototype._DeactivateTrees = function() {
		
		if (this.nodeActive != null) {
		    if (this.nodeActive.className.match(/Double/)) this.nodeActive.className = "Double";
            else this.nodeActive.className = "";
		}
	};
	
	//internal method for reading cookie 
	MainNavigationBar.prototype._GetCookie = function (name){
	   var i=0;  //Suchposition im Cookie
	   var suche = name+"=";
	   var cook = null;
	   while (i<document.cookie.length){
	      if (document.cookie.substring(i, i+suche.length)==suche){
	         var ende = document.cookie.indexOf(";", i+suche.length);
	         ende = (ende>-1) ? ende : document.cookie.length;
	         cook = unescape(document.cookie.substring(i+suche.length, ende));
	      }
	      i++;
	   }
	  
    return cook;
	};
	
	
	MainNavigationBar.prototype._OpenTree = function(LIActive, thisNavigationBar) {
	    if (LIActive == thisNavigationBar.nodeHover) {
	    
	        //set all other elements passive
		    thisNavigationBar._DeactivateTrees();
		
		    LIActive.className += " Active";
		    thisNavigationBar.nodeActive  = LIActive;
	    }
	}
	
	
	//internal method: mouseoverevent for the list elements
	MainNavigationBar.prototype._Hover = function(LIActive) {
	    var thisNavigationBar   = this;
	    
	    window.clearTimeout(thisNavigationBar.Switch);
		thisNavigationBar.nodeHover = LIActive;
		thisNavigationBar.Switch = window.setTimeout(function () {MainNavigationBar.prototype._OpenTree(LIActive, thisNavigationBar); }, 250);
	};
	
	//internal method: mouseoutevent for the list elements
	MainNavigationBar.prototype._HoverOut = function() {
	    var thisNavigationBar   = this;
	    window.clearTimeout(thisNavigationBar.Switch);
	};
	
	//internal method: find active list nodes for a given navigation level
	MainNavigationBar.prototype._FindActiveListNode = function (nodeParent, iLevel, strActiveNodeID, boolStandard) {
		var thisNavigationBar = this;
		var LI = nodeParent.firstChild;
		var nodeFound = null;
		var iNum = 0;
		
		do {
			if (LI && LI.nodeName == "LI") {
				//things todo on first level nav...
				if (iLevel == 0) {
					LI.onmouseover = function () { thisNavigationBar._Hover(this); };
					LI.onmouseout = function () { thisNavigationBar._HoverOut(); };
					//set this treenode active (if set)
					if (boolStandard) {
						if (iNum == 0) {
							this._Hover(LI);
							nodeFound = LI;	
						}				
					}
					else {
						if (LI.id == strActiveNodeID) {
							this._Hover(LI);
							nodeFound = LI;
						}
					}
				}
				//things todo on second level nav...
				else {
					if (boolStandard) {
						if (iNum == 0) {
							if (LI.className.match(/Last/)) LI.className = "Last Active";
							else LI.className = "Active";
							nodeFound = LI;
						}
						else {
							if (LI.className.match(/Last/)) LI.className = "Last";
							else LI.className = "";
						}
					}
					else {
						if (LI.id == strActiveNodeID) {
							if (LI.className.match(/Last/)) LI.className = "Last Active";
							else LI.className = "Active";
							nodeFound = LI;
						}
						else {
							if (LI.className.match(/Last/)) LI.className = "Last";
							else LI.className = "";
						}
					}				
				}
				iNum++;
			}
			LI = LI.nextSibling;
		}
		while (LI);
		return nodeFound;
	}
	
	//opens the login form overlay
	MainNavigationBar.prototype._OpenLoginForm = function () {
		//clean up a bit...
		var nodeSSOMessages 	=	document.getElementById("SSOMessages");
		while (nodeSSOMessages.firstChild)
			nodeSSOMessages.removeChild(nodeSSOMessages.firstChild);	
		var formLogin		= document.forms["SSOLoginForm"];
		var inputUserName	= formLogin["SSOUser"];
		var inputPassword	= formLogin["SSOPassword"];
		inputUserName.value = MainNavigationCommon.strUNameValue;	
		inputPassword.value = MainNavigationCommon.strPWValue;	
			
		var nodeLoginForm = document.getElementById("SSOLogin");
		nodeLoginForm.style.visibility = "visible";
	};
	
	//closes the login form overlay
	MainNavigationBar.prototype._CloseLoginForm = function () {
		var nodeLoginForm = document.getElementById("SSOLogin");
		nodeLoginForm.style.visibility = "hidden";
	};
	
	
	//reads user info from cookie and returns a PortalUser object
	MainNavigationBar.prototype._ReadUserCookie = function () {
		var NavBar = this;
		var strUserName;
		var strPasswordHash;
		var strActive;
		var User = null;
	    var SSOCookie = null;
		
		//get the cookie
		try 
		{
		    SSOCookie = NavBar._GetCookie("SsoSessionCookie");
		    
		}
		catch(e) {
		    alert (e.description);
		}
		//if (!SSOCookie) alert("No Cookie...");
		
		if (SSOCookie == null) return null;
		
		
				
		var CookieVals = SSOCookie.split(/\&/);
		
		
				
		for (var i = 0; i < CookieVals.length; i++) {
			var Val = CookieVals[i].split(/\=/);
			//alert("cookie: " + CookieVals[i]);
			
			if (Val[0] == 'username') 			strUserName 	= (""+Val[1]).replace(/ /, "\\20");
			if (strUserName != "guest") {
				if (Val[0] == 'passwordhash') 	strPasswordHash = (""+Val[1]).replace(/\+/, "%2B") + "==";
				if (Val[0] == 'active') 		strActive 		= ""+Val[1];
			}
		}
		
		
		
		//alert("Active: " + strActive);
		if (strActive == "True") {
			User = new PortalUser(strUserName, strPasswordHash);
		}
		return User;
	}
	
		
	//"Public" methods
	
	//method for setting the active navigation node(s)
	MainNavigationBar.prototype.SetActiveNodes = function(strActiveNodeID1, strActiveNodeID2) {
		this.strActiveNodeID1 = strActiveNodeID1;
		this.strActiveNodeID2 = strActiveNodeID2;
	};
	
	
	//method to authenticate user
	MainNavigationBar.prototype.SSOAuthenticateUser = function(strUserName, strPassword, boolKeepLoggedIn) {
		var UseSoap = false;
		var NavBar = this;
		var Params = new SOAPClientParameters();
				
		//alert(strUserName + " " + strPassword + " " + boolKeepLoggedIn);
		
		Params.add("user", strUserName);
		Params.add("pass", strPassword);
		Params.add("bKeepLoggedIn", boolKeepLoggedIn);
		SOAPClient.invoke (UseSoap, MainNavigationCommon.strSSOWebServiceUrl, MainNavigationCommon.strSSOWebServiceAuthMethod, Params, false, NavBar._SSOAuthenticateUserCallback );
	}
	
	//method to authenticate user
	MainNavigationBar.prototype.SSOAuthenticateUser = function(strUserName, strPassword, boolKeepLoggedIn, errorMessageContainer) {
		var UseSoap = false;
		var NavBar = this;
		var Params = new SOAPClientParameters();
		MainNavigationCommon.errorMsgContainer = errorMessageContainer;
				
		//alert(strUserName + " " + strPassword + " " + boolKeepLoggedIn);
		
		Params.add("user", strUserName);
		Params.add("pass", strPassword);
		Params.add("bKeepLoggedIn", boolKeepLoggedIn);
		SOAPClient.invoke (UseSoap, MainNavigationCommon.strSSOWebServiceUrl, MainNavigationCommon.strSSOWebServiceAuthMethod, Params, false, NavBar._SSOAuthenticateUserCallback );
	}
	
	//callback method for authentication webservice (called when the service gave a response)
	MainNavigationBar.prototype._SSOAuthenticateUserCallback = function (xml) {
		var nodeSSOMessages 	=	document.getElementById("SSOMessages");
		while (nodeSSOMessages.firstChild)
			nodeSSOMessages.removeChild(nodeSSOMessages.firstChild);

		if (xml.getElementsByTagName("user")[0]) {
			//login successfull
			//alert (xml.getElementsByTagName("user-name")[0].firstChild.data);
			//refresh the page
			location.reload();
		}
		else {
			//login failed
			if (typeof MainNavigationCommon.errorMsgContainer == "undefined")
			{
			    nodeSSOMessages.className = "error";
			    nodeSSOMessages.appendChild(document.createTextNode(MainNavigationCommon.strSSOErrorMessage));
			    nodeSSOMessages.style.display = "block";
			}
			else
			{
			    var nodeSSOMessages 	=	document.getElementById(MainNavigationCommon.errorMsgContainer);
		        while (nodeSSOMessages.firstChild)
			        nodeSSOMessages.removeChild(nodeSSOMessages.firstChild);
			
			    nodeSSOMessages.className = "error";
			    nodeSSOMessages.appendChild(document.createTextNode(MainNavigationCommon.strSSOErrorMessage));
			    nodeSSOMessages.style.display = "block";
			    MainNavigationCommon.errorMsgContainer = "";
			}
		}
	}
	
	MainNavigationBar.prototype.SSOLogoutUser = function() {
	    var UseSoap = false;
		var NavBar = this;
		var Params = new SOAPClientParameters();
		SOAPClient.invoke (UseSoap, MainNavigationCommon.strSSOWebServiceUrl, MainNavigationCommon.strSSOWebServiceLogoutMethod, Params, false, NavBar._SSOLogoutUserCallback );
	}
	
	MainNavigationBar.prototype._SSOLogoutUserCallback = function (xml) {
	    
		if (xml.getElementsByTagName("*")[0].tagName.toLowerCase() == "snpewebservicemessage") {
			//logout successfull
			//alert ("logout!");
			//refresh the page
			//location.reload();
			
			window.location.href = window.location.href + " ";
			location.reload();
			
		}
		
		else {
			//logout failed (and now??? )
		}
	}
	
	
	//method to set the SSO state display (user logged-in or not etc..)
	MainNavigationBar.prototype.SetSSOFragment = function () {
		var NavBar				= this;
		var nodeSSOFragment 	= document.getElementById("SSOFragment");
		var	spanUserName		= document.createElement("span");
		var	aUserName			= document.createElement("a");
		var spanFade			= document.createElement("span");
		var	spanLoginRegister	= document.createElement("span");
		var	spanEmptyPane	    = document.createElement("span");
		var	aLogin				= document.createElement("a");
		var	aLogout				= document.createElement("a");
		var	aRegister			= document.createElement("a");
		var	aSetAsHomepage		= document.createElement("a");
		
		spanUserName.className		= "UserName";
		spanEmptyPane.className		= "EmptyPane";
		spanFade.className			= "Fade";
		spanLoginRegister.className	= "LoginRegister";
		aSetAsHomepage.className	= "SetAsHomepage";
				
		//clear the Fragment first...
		while (nodeSSOFragment.firstChild)
			nodeSSOFragment.removeChild(nodeSSOFragment.firstChild);
		
		aSetAsHomepage.appendChild(document.createTextNode(MainNavigationCommon.strAsHomepage1));
		aSetAsHomepage.appendChild(document.createElement("br"));
		aSetAsHomepage.appendChild(document.createTextNode(MainNavigationCommon.strAsHomepage2));
		aSetAsHomepage.href = "http://www.vol.at/features/vol-als-homepage";
		
		//do only if login-stuff should be visible
		if (this.boolShowLogin) {
							
		    //check if user is logged in...
		    if (this.User) {
			    //do something...
			    aUserName.appendChild(document.createTextNode(this.User.strUserName));
			    //link to user profile
			    aUserName.href= this.strProfileUrl.replace(/###username###/, encodeURI(this.User.strUserName));
			    spanUserName.appendChild(aUserName);
			    spanUserName.appendChild(spanFade);
			    spanUserName.appendChild(document.createElement("br"));
			    aLogout.appendChild(document.createTextNode(MainNavigationCommon.strLogout));
			    aLogout.title = MainNavigationCommon.strLogout;
			    if (this.strLogoutUrl) {
				    aLogout.href = this.strLogoutUrl;
			    }
			    else {
				    aLogout.href = "#";
				    aLogout.onclick = function () {NavBar.SSOLogoutUser(); return false; }
			    }	
    				
    			
			    spanUserName.appendChild(aLogout);
    			
			    nodeSSOFragment.appendChild(spanUserName);
		    }
    		
		    else {
			    //do something else :) ...
			    aLogin.appendChild(document.createTextNode(MainNavigationCommon.strLogin));
			    aLogin.href = this.strLoginUrl;	
			    //only append the onclick event if there is no override for the loginurl		
			    if (!this.strOverrideLoginUrl) {
				    aLogin.onclick = function () { NavBar._OpenLoginForm(); return false };
				    aLogin.href = this.strLoginUrl;
			    }
			    else {
				    aLogin.href = this.strOverrideLoginUrl;
				    aLogin.onclick = function (){};
			    }	
			    aRegister.appendChild(document.createTextNode(MainNavigationCommon.strRegister));
    			
			    aRegister.href = this.strRegisterUrl;
    						
			    spanLoginRegister.appendChild(aLogin);
			    spanLoginRegister.appendChild(document.createTextNode(" " + MainNavigationCommon.strOr + " "));
			    spanLoginRegister.appendChild(document.createElement("br"));
			    spanLoginRegister.appendChild(aRegister);
    			
			    nodeSSOFragment.appendChild(spanLoginRegister);
    			
			    //set stuff in login pane
			    var aRegisterLP 	= document.getElementById("SSOLinkRegister");
			    var formLogin		= document.forms["SSOLoginForm"];
			    var inputUserName	= formLogin["SSOUser"];
			    var inputPassword	= formLogin["SSOPassword"];
			    var aSubmitButton	= document.getElementById("SSOLinkSubmit");
    			
			    aRegisterLP.href 	= aRegister.href;
    			
			    //only use the formaction if there is one defined via the override method
			    // - otherwise we use a onclickevent which tries to login the user via a call
			    //	 to the SNPEWebservice.
			    if (this.strFormAction) {
				    formLogin.action 		= this.strFormAction; 
				    aSubmitButton.onclick	= function () { document.forms['SSOLoginForm'].submit(); return false; };
				    formLogin.onsubmit      = function () {};
			    }
			    else {
				    formLogin.onsubmit		= function () { NavBar.SSOAuthenticateUser(document.forms['SSOLoginForm']["SSOUser"].value, document.forms['SSOLoginForm']["SSOPassword"].value, document.forms['SSOLoginForm']["SSOKeepLoggedIn"].checked); return false; }; 
				    aSubmitButton.onclick 	= function () { NavBar.SSOAuthenticateUser(document.forms['SSOLoginForm']["SSOUser"].value, document.forms['SSOLoginForm']["SSOPassword"].value, document.forms['SSOLoginForm']["SSOKeepLoggedIn"].checked); return false; };
			    }
    			
			    inputUserName.name	= this.strUNameFieldName;
			    inputPassword.name	= this.strPWFieldName;
    						
		    }
		}
		//do only if login-stuff should not be visible
		else {
		    nodeSSOFragment.appendChild(spanEmptyPane);
		}
		nodeSSOFragment.appendChild(aSetAsHomepage);
		
	};
	
	//method: override settings of the navigation bar
	MainNavigationBar.prototype.OverrideSettings = function(strLoginUrl, strLogoutUrl, strRegisterUrl, strFormAction, strUNameFieldName, strPWFieldName, strProfileUrl, boolShowLogin) {
		if (strLoginUrl) 		    this.strOverrideLoginUrl 		= strLoginUrl;
		if (strLogoutUrl) 		    this.strLogoutUrl 				= strLogoutUrl;
		if (strRegisterUrl) 	    this.strRegisterUrl 			= strRegisterUrl;
		if (strFormAction) 		    this.strFormAction				= strFormAction;
		if (strUNameFieldName) 	    this.strUNameFieldName			= strUNameFieldName;
		if (strPWFieldName) 	    this.strPWFieldName				= strPWFieldName;
		if (strProfileUrl) 		    this.strProfileUrl				= strProfileUrl;
		if (boolShowLogin != null)  this.boolShowLogin				= boolShowLogin;
	}
	
	//method: override the user data
	MainNavigationBar.prototype.OverrideUser = function(strUsername, strPasswordHash) {
		if (strUsername) this.User = new PortalUser (strUsername, strPasswordHash);
		else this.User = null;
	}
		
		
	//initialize the navigation
	MainNavigationBar.prototype.Init = function() {
		this.ULNavigation = document.getElementById("MainNavigationBar");
		
		var boolFoundFirst 	= false;
		var boolFoundSecond	= false;
		
		//walk through tree
		var thisNavigationBar = this;
		var ActiveNode1 = this._FindActiveListNode(this.ULNavigation, 0, this.strActiveNodeID1, false);
		
		//if active first level node was found, try to get active second level node
		if (ActiveNode1) {
			var UL = ActiveNode1.firstChild;
			do {
				if (UL && UL.nodeName == "UL") this._FindActiveListNode(UL, 1, this.strActiveNodeID2, false);
				UL = UL.nextSibling;
			}
			while (UL);
		}
		
		//use standard tab(s) if first level node not found
		else {
			var ActiveNode1 = this._FindActiveListNode(this.ULNavigation, 0, "", true);
			if (ActiveNode1) {
				var UL = ActiveNode1.firstChild;
				do {
					if (UL && UL.nodeName == "UL") this._FindActiveListNode(UL, 1, "", true);
					UL = UL.nextSibling;
				}
				while (UL);
			}
		}
		this.SetSSOFragment();
	}
	
var bDebug = true;
function getBanmanSequence(zoneid,count) {
	if (typeof count == "undefined") count = 0;
	var rns = (new String (Math.random())).substring (2, 11);
	var aId = "sequence-" + zoneid + "-" + rns;
	var sURL = "/lassdichueberraschen/sequence2.aspx" + "?ZoneID=" + zoneid + "&CountImpressions=True&Total=" + count + "&SiteID=1" + "&Random=" + rns;
	document.write("<div id=\"" + aId + "\" style=\"margin:0;padding:0;\"></div>");
	ajaxAdvert(sURL, aId, true);
}
function getBanmanAd(zoneid) {
	var rns = (new String (Math.random())).substring (2, 11);
	var aId = "ad-" + zoneid + "-" + rns;
	var sURL = "/mehrueberraschungen/ad.aspx" + "?ZoneID=" + zoneid + "&Task=Get&Browser=NETSCAPE4&PageID=1205&Random="+rns;
	document.write("<div id=\"" + aId + "\" style=\"margin:0;padding:0;\"></div>");
	ajaxAdvert(sURL, aId, false);
}

function ajaxAdvert(url, containerid, isSequence) {
	var page_request = false;
	if (window.XMLHttpRequest) // if Mozilla, Safari etc
		page_request = new XMLHttpRequest()
	else if (window.ActiveXObject){ // if IE
		try {
			page_request = new ActiveXObject("Msxml2.XMLHTTP")
		} catch (e){
			try{
				page_request = new ActiveXObject("Microsoft.XMLHTTP")
			} catch (e){}
		}
	}
	else
		return false
	page_request.onreadystatechange=function(){
		loadAdvert(page_request, containerid, isSequence)
	}
	page_request.open("GET", url, true)
	page_request.send(null)
	return true
}

function loadAdvert(page_request, containerid, isSequence) {
	if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)) {
		var ajaxcontent = page_request.responseText;
		if(!ajaxcontent.match(/ISAPI/)) {
			if (isSequence) {
				ajaxcontent = ajaxcontent.replace(/document\.write\(\'/gi, "").replace(/([^\\])\'\);\s*/gi, "$1").replace(/\\\"/gi, "\"").replace(/\\\'/gi, "\'").replace(/\\r/g, "\r");
				var adCells = ajaxcontent.match(/<td>/gi);
				if (adCells) {
					for (var i = 0; i < adCells.length; ++i) {
						if ((i % 2) != 0)
							ajaxcontent = ajaxcontent.replace(/<td>/i, "<td class='even'>");
						else
							ajaxcontent = ajaxcontent.replace(/<td>/i, "<td class='odd'>");
					}
				}
			} else {
				ajaxcontent = ajaxcontent.replace(/document\.write\(\'/gi, "").replace(/([^\\])\'\);.*/gi, "$1").replace(/\\\"/gi, "\"").replace(/\\r/g, "\r");
			}
			document.getElementById(containerid).innerHTML = ajaxcontent;
		}
	}
}

//***SearchBox***
//prototype object: SearchBox
function SearchBox(sContainerNodeID) {
	this.ContainerNodeID = sContainerNodeID;
	this.nodeContainer = null;
	this.horTabs = null;
	this.verTabs = null;
	this.arrTabs = new Array();
	this.searchWord = ""; //use this if you want to fill the searchbox with any search word on startup
	this.lastActiveTab = 1;
	var SearchBox = this;
	
	//CSS definitions
	this.ActiveClass = "Active";
	this.LastClass = "Last";
	this.HorTabsID = "horTabs";
	this.VerTabsID = "morelist";
	this.NoSearchTabID = "NoSearchTab";
	this.HiddenDivID = "shadow_gray";
	this.ArrowName = "arrow";
	this.ArrowUp = "/SysRes/DotcomSkin/Img/SearchBox/Buttons/arrowUp.png";
	this.ArrowDown = "/SysRes/DotcomSkin/Img/SearchBox/Buttons/arrowDown.png";
	this.VerTabsItemID = "listitem";
	this.VerTabsSpaceholderItemID = "spaceholder";
	this.SearchFormID = "searchbox";
	this.PageBodyID = "Dotcom_Body";
	
	if (document.getElementById(sContainerNodeID))
		this.nodeContainer = document.getElementById(sContainerNodeID);
	
	if (this.nodeContainer != null)	
    {
        this.horTabs = document.getElementById(this.HorTabsID);
        this.verTabs = document.getElementById(this.VerTabsID);
        
        
        this.horLIs = this.horTabs.getElementsByTagName("li");
        this.verLIs = this.verTabs.getElementsByTagName("li");
        


        // Traverse through horizontal li elements
        for (var i = 0; i < this.horLIs.length; ++i) {
            this.horLIs[i].className = '';
            
            var TabTitle = this.FindFirstChild(this.horLIs[i], "H3");
            var Content = this.FindFirstChild(this.horLIs[i], "FORM");
            
            this.CleanUp(this.horLIs[i]);
             
            if (TabTitle != null && Content != null)
            {
                this.AddTab("HorTab" + i, TabTitle.innerHTML, TabTitle.className, Content);
                
                var a = document.createElement("a");
                
                if (this.horLIs[i].id != this.NoSearchTabID)
                {
                    var OnClickEvent = function () { SearchBox.CopySearchWord(); SearchBox.Activate(this.id, true); SearchBox.Visibility("off"); }; 
                }
                else
                {
                    var OnClickEvent = function () { 
                        SearchBox.Activate(this.id, false);
                        
                        if ("none" == document.getElementById(SearchBox.HiddenDivID).style.display || document.getElementById(SearchBox.HiddenDivID).style.display == "")
                        {
                            SearchBox.Visibility("on"); 
                        }
                        else
                        {
                            SearchBox.Visibility("off"); 
                        }
                    }; 
                }
                a.href = "javascript:void(0);";
                a.onclick = OnClickEvent;
                a.id = "HorTab" + i;
                a.style.cursor = "pointer";
                
                a.innerHTML = TabTitle.innerHTML;
                this.horLIs[i].appendChild(a);
            }
        }
        
        
        // Traverse through vertical li elements
        for (var i = 0; i < this.verLIs.length; ++i) {
            this.verLIs[i].className = '';
            
            var Tab = this.FindFirstChild(this.verLIs[i], "A");
            
            this.CleanUp(this.verLIs[i]);
            
            if (Tab != null)
            {
                this.verLIs[i].appendChild(Tab);
                
                if (this.verLIs[i].innerHTML != "")
                {
                    this.verLIs[i].className = this.VerTabsItemID;
                }
                else
                {
                    //blank LI is used as spaceholder for seperating list
                    this.verLIs[i].className = this.VerTabsSpaceholderItemID;
                }
            }
        }
        
    
        //define MouseEvents for Morelist
        var MoreListON = function () { 
            if (typeof moreListTimeout != "undefined")
                clearTimeout(moreListTimeout); 
            
            SearchBox.Visibility("on"); 
        };
        
        var MoreListOFF = function () { 
            if (typeof moreListTimeout != "undefined")
                clearTimeout(moreListTimeout);
                
            SearchBox.reactivateLastActiveTab();
            SearchBox.Visibility("off");
        };
        
        var delayedMoreListOFF = function () { 
            if (typeof moreListTimeout != "undefined")
                clearTimeout(moreListTimeout);
            
            moreListTimeout = setTimeout(function(){SearchBox.Visibility("off");SearchBox.reactivateLastActiveTab();},1500);     
        };
          
              
	    //event for click on SearchBox (either textBox or button)
        var searchFormular = document.getElementById(this.SearchFormID);
        searchFormular.onmouseup = MoreListOFF;  //close list immediately if there was a click on the searchbox
            
        //events for LIs in morelist
        var ULMorelist = document.getElementById(this.VerTabsID);
        ULMorelist.onmouseover = MoreListON; //if mouse is over Morelist, fire this event to prevent closing the list
        ULMorelist.onmouseout = delayedMoreListOFF; //do not close list immediately, give the user a second, perhaps he slipped out
        ULMorelist.onclick = MoreListOFF; //close list, although the page will be left...


        //events for the whole page
        var pageBody = document.getElementById(this.PageBodyID);
        pageBody.onmouseup = delayedMoreListOFF;
        
        //prevent, that the H3s and FORMs on load of page are visible -> set visibility to visible in order to make the A elements visible
        this.horTabs.style.visibility = 'visible';
    }
}



			//activate this tab including form an background onload
			SearchBox.prototype.ActivateOnLoad = function (iNumber)
			{
				if (this.nodeContainer != null)	
                {
				    TabIdByNumber = this.arrTabs[iNumber-1].sTabID;
    				
				    this.Activate(TabIdByNumber,true);				
				}
			}
			
			
			//method for finding the first child node with a certain node name
			SearchBox.prototype.FindFirstChild = function (nodeParent, sNodeName) {
				var nodeChild = nodeParent.firstChild;
				do {
					if (nodeChild && nodeChild.nodeName == sNodeName)
						return nodeChild;
					
					nodeChild = nodeChild.nextSibling;
				}
				while (nodeChild);
				return null;
			}
			
			
			//method for adding a Tab to Array
			SearchBox.prototype.AddTab = function(sTabID, sTabName, sBackgroundClass, ContentNode) {
					var newtab = new SearchBoxTab (sTabID, sTabName, sBackgroundClass, ContentNode);
					this.arrTabs.push(newtab);
			}
			
				
			//method for assigning a tab to class "Active"
			SearchBox.prototype.SetActiveTab = function(iNumber) {
			    //active tab is in class "Active"
			    for (var i = 0; i <= this.horLIs.length-1; i++)
			    {
			        this.horLIs[i].className = "";
			        
			        if (i == iNumber-1)
			        {
			            this.horLIs[iNumber-1].className = this.ActiveClass;
			        }
			    }
			    
			    //last tab is in class "Last"
			    this.horLIs[this.horLIs.length-1].className += " " + this.LastClass;
			}
			
			
			//method for reactivating the last active tab
			SearchBox.prototype.reactivateLastActiveTab = function() {
					TabIdByNumber = this.arrTabs[this.lastActiveTab-1].sTabID;
				    this.Activate(TabIdByNumber,false);	
			}
			
			
			//method for activating or deactivating the morelist
			SearchBox.prototype.Visibility = function(sOption) {
					var SearchBox = this;
	
					divChanger = document.getElementById(this.HiddenDivID); 
					arrowPicture = document.getElementsByName(this.ArrowName);
								
					if (sOption == "on")
					{
						divChanger.style.display = 'block';
						arrowPicture[0].src = this.ArrowUp;
					}
								 
					if (sOption == "off")
					{
						divChanger.style.display = 'none';
						arrowPicture[0].src = this.ArrowDown;
					}
			}
							
			
			//method for cleaning up the H3 and FORM elements which are replaced by an A element
			SearchBox.prototype.CleanUp = function(nodeContainer) {
			    //clean up and remove all childs in container
			    while (nodeContainer.firstChild)
			        nodeContainer.removeChild(nodeContainer.firstChild)
			}
			
			
			//if user clicks on a Tab, this method looks in array which tab has been clicked and sets the active tab and changes the background
			SearchBox.prototype.Activate = function(id, bDrawContent) {
			    this.id = id;
			    this.bDrawContent = bDrawContent;
			    
			    var iIndex = this.GetIndexOfTabID(this.id);
			    this.SetActiveTab(iIndex+1);
			    
			    //change background image
		        var searchBackground = document.getElementById(this.ContainerNodeID);
		        
		        bgClass = this.arrTabs[iIndex].sBackgroundClass;
		        searchBackground.className = bgClass;
			        
			    if (this.bDrawContent)
			    {
			        this.lastActiveTab = iIndex+1;
			        this.DrawContent(iIndex);
			    }
			}
			
			
			//this method puts the content of the FORM in an DIV (searchbox)
			SearchBox.prototype.DrawContent = function(iIndex) {
			    if (iIndex != null)
			    {
			        //includes the html elements for the new search 
			        newSearch = this.arrTabs[iIndex].nodeContent;
			            
			        var eSearchForm = document.getElementById(this.SearchFormID);
			        this.CleanUp(eSearchForm);
			        
			        //repleace the current search form
			        eSearchForm.appendChild(newSearch);
			        
			        //pastes the copy of the last active search to the new search
			        this.PasteSearchWord();
			    }
			}
			
			
			//this method finds the index of a Tab by TabID
			SearchBox.prototype.GetIndexOfTabID = function (sTabID) {
			    for (var i = 0; i <= this.arrTabs.length-1; i++)
			    {
			        var iIndex = this.arrTabs[i].sTabID == sTabID ? i : null;
			        
			        if(iIndex != null)
			            return iIndex;
			    }
			}
			
			
			//this method creates a copy of the last active search
			SearchBox.prototype.CopySearchWord = function () {
			    for (var i = 0; i < document.searchForm.length; ++i) {
                  if (document.searchForm.elements[i].type == "text")
                  {
                    this.searchWord = document.searchForm.elements[i].value;
                  }
                }
			}
			
			
			//this method pastes the copy of the last active search to the new search
			SearchBox.prototype.PasteSearchWord = function () {
			    for (var i = 0; i < document.searchForm.length; ++i) {
                  if (document.searchForm.elements[i].type == "text")
                  {
                    document.searchForm.elements[i].value = this.searchWord;
                  }
                }
			}
			




//object: SearchBoxTab
function SearchBoxTab(sTabID, sTabName, sBackgroundClass, nodeContent) {
    //properties & defaults
    this.sTabName = "New Tab";
    this.nodeContent = null;
    this.sTabID = null;
    this.sBackgroundClass = null;

    //set properties
    if (nodeContent)
	    this.nodeContent = nodeContent;
    if (sTabName)
	    this.sTabName = sTabName;
    if (sTabID)
	    this.sTabID = sTabID;
	if (sBackgroundClass)
	    this.sBackgroundClass = sBackgroundClass;
}




//prototype object: Banner
function Banner(divid) {
    this.DivID = divid;
    this.Height = 45;
    this.i = 0;
}

            //this method calls every 10ms the minimize method
			Banner.prototype.Animate = function() {
			    var Banner = this;
			    
			    //execute function every 10ms
			    setInterval(function() {Banner.Minimize();},10);
			}
			
			
			//this method reduces the height of the DIV and removes it out of DOM
			Banner.prototype.Minimize = function() {
			    this.i = this.i + 1;
			    height = 0 - this.i;
			    bannerdiv = this.DivID;
			
			    bannerNode = document.getElementById(bannerdiv);
			
			    if (bannerNode)
			    {
			        bannerNode.style.backgroundPosition = '0px ' + height + 'px';
			
			        if (height * -1 >= this.Height)
			        {
			            //remove div
			            var parentNode = bannerNode.parentNode;
			            var childNodes = parentNode.childNodes;
			            
			            for (var j = 0; j < childNodes.length; j++) {
			                var a = childNodes[j].id;
			                if (a && a==bannerdiv) {
			                    parentNode.removeChild(childNodes[j]);
			                }
			            }
			            return true;
			        }
			    }
			}
// javascripts.js
// Author: Alexander Aberer
// Date: 27.7.2000
// Last modified: 8.6.2001 (Andreas Ritter)
// Last modified: 2.7.2003 (Alexander Aberer)
// Last modified: 19.2.2004 (Stephan Schw&auml;rzler) - Opera
// Last modified: 10.12.2004 (Norbert Kujbus) - Google callback function
// Last modified: 15.01.2005 (Norbert Kujbus) - Remove Google callback function
// Last modified: 14.04.2005 (Csaba Mezo) - Introduce CountIt function
// Last modified: 11.10.2007 (Roland Fischl) - Added getOptimalTabBoxSize function

// !!!Wichtig!!! Die folgende Variable muß gesetzt werden wenn über open_window()
// Seiten auf externen/fremden Webservern geöffnet werden sollen.
if (document.domain.indexOf("vol.at") > -1) document.domain = "vol.at";
var blank_page = "about:blank"; 

function SwitchWebservice(switchform,formelement) {
	var fe, dummy;
	if(typeof formelement != "undefined") {
		fe = formelement;
	} else {
		fe = switchform.elements[0];
	}
	if (fe.selectedIndex != 0) {
		var pulldownindex = fe.selectedIndex;
		var url = fe.options[pulldownindex].value;
		locarray = url.split("|");
		if ( locarray.length > 1 ) {
			windata = locarray[0].split(",");
			dummy = open_window(locarray[1],windata[0],windata[1],windata[2],0,0,"scrollbars=" + windata[3] + ",location=no,toolbar=no,status=no,menubar=no,resizable=yes,dependent=yes");
		} else {
			dummy = open_window(url,"",700,480,10,10,"location=yes,toolbar=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,dependent=no");
		}
	}
}

function realmedia(path,name,content) {
	var datestr = new Date();
	url = 'http://apps.vol.at/tools/realaudio/embed.asp?cont=' + content + '&title=' + escape(name) + '&file=' + escape(path) + "&" + escape(datestr.toLocaleString());
	if (content=='video') {
		var rc_video=window.open(url,'rc_video','width=230,height=310,resizable=yes');
		rc_video.focus();
	} else {
		var rc_audio=window.open(url,'rc_audio','width=400,height=40');
		rc_audio.focus();
	}
}

function open_window(targetX,name,width,height,posx,posy,windowoptions,init_target) {
	var it, wo, px, py, host,target;
 
	it = targetX;
	wo = "location=no,toolbar=no,status=no,statusbar=no,scrollbars=no,resizable=no,dependent=yes";
	px = py = 0;
	target = targetX;
	
	if(typeof new_window != "undefined") {
		if(new_window.closed != true) {
			new_window.close();
		}
	}

	if (typeof posx != "undefined") px = posx;
	if (typeof posy != "undefined") py = posy;
	if ((typeof windowoptions != "undefined") && (windowoptions != "")) wo = windowoptions;
	
	
	if (typeof init_target != "undefined") {
		it = init_target;
	} else {
		if (targetX.indexOf("http://") != -1) {
			host = "http://" + window.location.hostname;
			if (navigator.appName != "Opera") {
				if (targetX.indexOf(host) == -1) it = blank_page;
			}
		}
	}
	new_window = window.open(it,name,"width=" + width + ",height=" + height + "," + wo);
	//new_window.moveTo(px,py);
	new_window.location.replace(targetX);
	new_window.focus();
	return false;
}

function setUrlForPrint() {
	sUrl = document.location.href;
	if ((document.all) || (document.layers)){
		sUrl = sUrl.replace(/\?/, "\\/");
		sUrl = sUrl.replace(/\&/, "//");
	}
	document.printform.url.value = sUrl;
}

//Script to invoke OEWA measurement on page events (click)
function CountIt(what)
{
	var OEWA1="http://austria.oewabox.at/cgi-bin/ivw/CP/"+what;
	var OEWA2="http://a-vol.oewabox.at/cgi-bin/ivw/CP/"+what;
	var counter1 = new Image;
	var counter2 = new Image;
	counter1.src = OEWA1+"?r="+escape(document.referrer);
	counter2.src = OEWA2+"?r="+escape(document.referrer);
}

// Function for URL (GET) Parameter
function getURLParam(name) {
	var q = document.location.search;
	var i = q.indexOf(name + '=');
	if (i == -1) {
		return false;
	}
	var r = q.substr(i + name.length + 1, q.length - i - name.length - 1);
	i = r.indexOf('&');
	if (i != -1) {
		r = r.substr(0, i);
	}
	return r.replace(/\+/g, ' ');
}

// resizes a window depending on its content and a given width to the optimal size
function resizeWindowToOptimalSize(oW,divId) {
    if( !document.getElementById ) return false;
    var oH = document.getElementById(divId); if( !oH ) { return false; }
    var oH = oH.clip ? oH.clip.height : oH.offsetHeight; if( !oH ) { return false; }
    window.resizeTo( oW, oH );
    var myW = 0, myH = 0, d = document.documentElement, b = document.body;
    if( window.innerWidth ) { myW = window.innerWidth; myH = window.innerHeight; }
    else if( d && d.clientWidth ) { myW = d.clientWidth; myH = d.clientHeight; }
    else if( b && b.clientWidth ) { myW = b.clientWidth; myH = b.clientHeight; }
    if( window.opera && !document.childNodes ) { myW += 16; }
    window.resizeTo( oW + ( oW - myW ), oH + ( oH - myH ) );
}

function open_window_astitle(target,name,width,height) { 
	void(open_window(target,name,width,height));
}

//get height of given divId
function getOptimalTabBoxSize(divId) {
    if( !document.getElementById ) return false;
    var oH = document.getElementById(divId); if( !oH ) { return false; }
    var oH = oH.clip ? oH.clip.height : oH.offsetHeight; if( !oH ) { return false; }
    return oH;
}
