$(function(){
	$('ul.sf-menu').superfish();
	
	$('ul li:first-child').addClass('first');
	$('ul li:last-child').addClass('last');
	
	/*
	$('.sf-menu li').hover(
		function () {
			$(this).addClass('sfHover');
		}, 
		function () {
			$(this).removeClass('sfHover');
		}
	);
	*/
	if ($('#datetimepicker').length >= 1){
		$('#datetimepicker').datetimepicker({
			ampm: true,
			timeFormat: 'h:m',
			separator: ' @ ',
			stepMinute: 15,
			hourMin: 4,
			hourMax: 20, 
			timeFormat: 'hh:mm'
		});
	}

	
	if ($('#accordion div').length > 1) {
		$('#accordion').accordion({ 
			autoHeight: false, 
			collapsible: true, 
			active: false 
		});
	}
	
	if ($('#tabs div').length >= 1) {
		$('#tabs').tabs({autoHeight:true}).addClass('ui-tabs-vertical ui-helper-clearfix');
		$('#tabs li').removeClass('ui-corner-top').addClass('ui-corner-left');
		var tabsHeight = ($('.ui-tabs-vertical .ui-tabs-nav').height())+50;
		$('#tabs').each(function() {
			$('.ui-tabs-panel').css({'min-height':tabsHeight}).wrapInner('<div class="pad" />');
		});
}

    if ($('.slideshow div').length >= 1) {
        $('.slideshow div:first-child').addClass('first');
        $('.slideshow')
		    .wrap('<div id="slideshow-container">')
		    .after('<div id="slideshow-nav">')
		    .cycle({
		        fx: 'scrollLeft',
		        speed: '2000',
		        timeout: 8000,
		        pause: 1,
		        easing: 'easeInOutQuart',
		        pager: '#slideshow-nav',
		        autostop: 1,
		        end: function () {
		            $('.slideshow').cycle(0);
		            return false;
		        }
		    });
	}

});

$(document).ready(function() {
	$('a.infoLink').qtip({
		content: {
			attr: 'alt',
			title: {
				text: function(api) {
					return $(this).attr('title');
				}
			}
		},
		position: { 
			my: 'bottom  center',
			at: 'top center'
		},
			style: { 
			classes: 'ui-tooltip-shadow ui-tooltip-blue'
		}
	});
});
