$(window).ready(
	function()
	{
		
		//redirect to classic theme if IE6 ...
		if($.browser.msie && $.browser.version<=6 && browserIsIE6 == false){
			
			$('div').css({'background' : '#ffffff'});
			$('body').hide();
			document.location = document.location + '?wptheme=WordPress%20Classic';
			return false;
		}
		
		
		$('#tabs').tabs({
			'fx': { height: 'toggle', opacity: 'toggle', duration: 'fast'  }
			
		});
		
		//fix accordion middle height container
		$('#accordion div.contents-middle ul.first').each(function(){
			var top       = $(this).css('top').replace(/px/, '');
			var container = $(this).parent('div');
			var height    = container.height() < eval(0-top) ? 0 : eval(container.height() + top);
			container.height(height);
		});
		
		$('#accordion').accordion({
									autoHeight: false,
									header: '.toggler',
									selectedClass: 'open', 
									navigation: true
								  });
		

		
		jQuery('.articles ul').jcarousel({
			scroll  : 3,
			visible : 3,
			auto    : 10,
			buttonNextCallback: function(carousel, control, state){
				if(state) {
					$(control).show();
				}
				else {
					$(control).hide();
				}
			},
			buttonPrevCallback: function(carousel, control, state){
				if(state) {
					$(control).show();
				}
				else {
					$(control).hide();
				}
				
			}
	    });

		
		jQuery('#diaporama ul').jcarousel({
			scroll  : 1,
			visible : 1,
			auto    : 5,
			buttonNextCallback: function(carousel, control, state){
				if(state) {
					$(control).show();
				}
				else {
					$(control).hide();
				}
			},
			buttonPrevCallback: function(carousel, control, state){
				if(state) {
					$(control).show();
				}
				else {
					$(control).hide();
				}
				
			}
	    });
		
	}
);
