//tab effects

jQuery(document).ready(function () {   
     jQuery('#nav li').hover(  
         function () {  
             //show its submenu  
             jQuery('ul', this).slideDown(100);  
         },   
        function () {  
             //hide its submenu  
             jQuery('ul', this).slideUp(100);           
         }  
     );  
       
 });  

var TabbedContent = {
	init: function() {	
		jQuery(".tab_item").mouseover(function() {
		
			var background = jQuery(this).parent().find(".moving_bg");
			
			jQuery(background).stop().animate({
				left: jQuery(this).position()['left']
			}, {
				duration: 300
			});
			
			TabbedContent.slideContent(jQuery(this));
			
		});
	},
	
	slideContent: function(obj) {
		
		var margin = jQuery(obj).parent().parent().find(".slide_content").width();
		margin = margin * (jQuery(obj).prevAll().size() - 1);
		margin = margin * -1;
		
		jQuery(obj).parent().parent().find(".tabslider").stop().animate({
			marginLeft: margin + "px"
		}, {
			duration: 300
		});
	}
}

jQuery(document).ready(function() {
	TabbedContent.init();
});
ddaccordion.init({
	headerclass: "silverheader", //Shared CSS class name of headers group
	contentclass: "submenu", //Shared CSS class name of contents group
	revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click", "clickgo", or "mouseover"
	mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
	collapseprev: true, //Collapse previous content (so only one open at any time)? true/false 
	defaultexpanded: [], //index of content(s) open by default [index1, index2, etc] [] denotes no content
	onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
	animatedefault: false, //Should contents open by default be animated into view?
	persiststate: true, //persist state of opened contents within browser session?
	toggleclass: ["", ""], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
	togglehtml: ["suffix", "<img src='plus.gif' class='statusicon' />", "<img src='minus.gif' class='statusicon' />"], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
	animatespeed: "fast", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
	oninit:function(headers, expandedindices){ //custom code to run when headers have initalized
		//do nothing
	},
	onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
		//do nothing
	}
})


var defaultpanel=new ddpanel({
ids: ["mypanel", "mypanelcontent", "mypaneltab"], // id of main panel DIV, content DIV, and tab DIV
stateconfig: {initial: "5px", persiststate: true}, // initial: initial reveal amount in pixels (ie: 5px)
animate: {enabled: true, steps: 10}, //steps: number of animation steps. Int between 1-20. Smaller=faster.
pointerimage: {enabled: true, src: ["arrow-down.gif", "arrow-up.gif"]},
closepanelonclick: {enabled: true} // close panel when links or elements with CSS class="closepanel" within container is clicked on?
})


jQuery(
	function() {
		if (Liferay.Browser.isIe() && Liferay.Browser.getMajorVersion() < 7) {
			jQuery('#navigation > ul > li').hover(
				function(event) {
					jQuery(this).addClass('hover');
				},
				function(event) {
					jQuery(this).removeClass('hover');
				}
			);
		}
	}
);

 jQuery(function() {

                jQuery('#container-1').tabs();
                jQuery('#container-2').tabs(2);
                jQuery('#container-3').tabs({ fxSlide: true });
                jQuery('#container-4').tabs({ fxFade: true, fxSpeed: 'fast' });
                jQuery('#container-5').tabs({ fxSlide: true, fxFade: true, fxSpeed: 'normal' });
                jQuery('#container-6').tabs({
                    fxFade: true,
                    fxSpeed: 'fast',
                    onClick: function() {
                        alert('onClick');
                    },
                    onHide: function() {
                        alert('onHide');
                    },
                    onShow: function() {
                        alert('onShow');
                    }
                });
                jQuery('#container-7').tabs({ fxAutoHeight: true });
                jQuery('#container-8').tabs({ fxShow: { height: 'show', opacity: 'show' }, fxSpeed: 'normal' });
                jQuery('#container-9').tabs({ remote: true });
                jQuery('#container-10').tabs();
                jQuery('#container-11').tabs({ disabled: [3] });

                jQuery('<p><a href="#">Disable third tab<\/a><\/p>').prependTo('#fragment-28').find('a').click(function() {
                    jQuery(this).parents('div').eq(1).disableTab(3);
                    return false;
                });
                jQuery('<p><a href="#">Activate third tab<\/a><\/p>').prependTo('#fragment-28').find('a').click(function() {
                    jQuery(this).parents('div').eq(1).triggerTab(3);
                    return false;
                });
                jQuery('<p><a href="#">Enable third tab<\/a><\/p>').prependTo('#fragment-28').find('a').click(function() {
                    jQuery(this).parents('div').eq(1).enableTab(3);
                    return false;
                });

            });
