/**
 * @author hk
 */

/*
 * Menü Scrip
 */
 var listMenu = new FSMenu('listMenu', true, 'display', 'block', 'none');
 listMenu.hideDelay = 100;
 listMenu.animations[listMenu.animations.length] = FSMenu.animFade;
 listMenu.animations[listMenu.animations.length] = FSMenu.animSwipeDown;

 var arrow = null;
 if (document.createElement && document.documentElement)
 {
 	arrow = document.createElement('span');
 	arrow.appendChild(document.createTextNode('>'));
 	// Feel free to replace the above two lines with these for a small arrow image...
 	//arrow = document.createElement('img');
 	//arrow.src = 'arrow.gif';
 	//arrow.style.borderWidth = '0';
 	arrow.className = 'subind';
 }
 addEvent(window, 'load', new Function('listMenu.activateMenu("listMenuRoot", arrow)'));
 
 /*
  * Tab Script
  */
 
 /*-----------------------------------------------------------
    Toggles element's display value
    Input: any number of element id's
    Output: none 
    ---------------------------------------------------------*/
function toggleDisp() {
    for (var i=0;i<arguments.length;i++){
        var d = $(arguments[i]);
        if (d.style.display == 'none')
            d.style.display = 'block';
        else
            d.style.display = 'none';
    }
}
/*-----------------------------------------------------------
    Toggles tabs - Closes any open tabs, and then opens current tab
    Input:     1.The number of the current tab
                    2.The number of tabs
                    3.(optional)The number of the tab to leave open
                    4.(optional)Pass in true or false whether or not to animate the open/close of the tabs
    Output: none 
    ---------------------------------------------------------*/
function toggleTab(num,numelems,opennum,animate,roottab) {
    if ($('tabContent'+num).style.display == 'none')
	{
        for (var i=1;i<=numelems;i++)
		{
            if ((opennum == null) || (opennum != i)){
                var temph = 'tabHeader'+i;
                var h = $(temph);
				
                if(!h){
                    var h = $('tabHeaderActive'+i);
					if (!h) {
						continue;
					}
					h.id = temph;
					h.className = '';
                }
                var tempc = 'tabContent'+i;
                var c = $(tempc);
                if(c.style.display != 'none'){
                    if (animate || typeof animate == 'undefined')
                        Effect.toggle(tempc,'appear',{duration:0.2, queue:{scope:'menus', limit: 3}});
                    else
                        toggleDisp(tempc);
                }
            }
        }
        var h = $('tabHeader'+num);
        if (h)
            h.id = 'tabHeaderActive'+num;
			h.className = 'tabHeaderActive';
        h.blur();
        var c = $('tabContent'+num);
        //c.style.marginTop = '2px';
        if (animate || typeof animate == 'undefined'){
            Effect.toggle('tabContent'+num,'appear',{duration:0.2, queue:{scope:'menus', position:'end', limit: 3}});
        }else{
            toggleDisp('tabContent'+num);
        }
		
		if(typeof roottab != 'undefined')
		{
			var elm_height = parseInt(c.style.height);

			//$(roottab).setStyle({ height: h.getStyle('height')+32 });
			elm_height = elm_height +16;
			$(roottab).style.height = elm_height+'px';
			//$(roottab).setAttribute('height',h.getHeight()+32);
		}
    }
}

// Other Tab Script
function SelectTab(event, ui)
{
	var $tabs;
	var count = $('#Home_Tab').tabs('length');
	var i;
	
	/*for(i=0;i<count;i++)
	{
		$tabs = $('#Home_Tab').tabs();
		$('#'+ui.panel.id).stop();
  		$('#'+ui.panel.id).animate({opacity: "hide", top: "-85"}, "fast");
	}*/
	//alert(ui.panel.id);
	//$('#Home_Tab').tabs('select', '#' + ui.panel.id);
	//$('#Home_Tab').tabs( 'abort' );

	//return false;
}
 
//$(document).ready(function()
//{
    /*$("#Home_Tab").tabs();*/
	//$('#Home_Tab').tabs({ event: 'mouseover', fx: { opacity: 'toggle', duration: 'fast' }, select: SelectTab, collapsible: true}).addClass('ui-tabs-vertical ui-helper-clearfix');
	//$("#Home_Tab li").removeClass('ui-corner-top').addClass('ui-corner-left');
	
	/*if ($("#Home_Tab")) 
	{
		$("#Home_Tab").show();
		$("#Home_Tab").tabs({
			event: 'mouseover',
			fx: {
				opacity: 'toggle',
				duration: 200
			}
		}).addClass('ui-tabs-vertical ui-helper-clearfix');
		$("#Home_Tab li").removeClass('ui-corner-top').addClass('ui-corner-left');
	}
	
	if ($("#Produkt_Tab")) 
	{
		$("#Produkt_Tab").show();
		$("#Produkt_Tab").tabs();
	}*/

//});
