$(function() {
	$("#accordion-top").tabs("#accordion-top .pane", {
		tabs: 'img', 
		effect: 'horizontal'
	});
	$("#accordion-bottom").tabs("#accordion-bottom .pane", {
		tabs: 'img', 
		effect: 'horizontal'
	});
	$(".slidetabs").tabs("#slider > div", {
		effect: 'fade',
		fadeOutSpeed: "slow",
		rotate: true
	}).slideshow({
		autoplay: true
	});
	$(".scrollable").scrollable({items: ".itempage" });
	
    $('a[href*=#]').click(function() {
    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
        && location.hostname == this.hostname) {
            var $target = $(this.hash);
            $target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
            if ($target.length) {
                var targetOffset = $target.offset().top;
                $('html,body').animate({scrollTop: targetOffset}, 1000);
                return false;
            }
        }
    });
    
    $("a[rel]").overlay({

		mask: {

			// you might also consider a "transparent" color for the mask
			color: '#444',

			// load mask a little faster
			loadSpeed: 100,

			// very transparent
			opacity: 0.7
		},
		
		effect: 'default',
		
		top: 50,
		left: '30',

		onBeforeLoad: function() {

			// grab wrapper element inside content
			var wrap = this.getOverlay().find(".contentWrap");

			// load the page specified in the trigger
			wrap.load(this.getTrigger().attr("href"));
		}
	});

});
