// JAVASCRIPT CODED BY FAZEDESIGNS //

$(document).ready(function() {
						   
	// MAIN MENU HOVER - PORTFOLIO SUBMENU //
	
	$(".portfolio-link").tooltip({
		position: ['bottom', 'center'],
		offset: [5, 100],
		opacity: 0.7,
		effect: 'slide', 
    	slideOffset: 10,
		slideInSpeed: 100,
		slideOutSpeed: 100,
		delay: 300
	});
	
	// PORTFOLIO IMAGE MENU //
	
	$(".portthumb").tooltip({
		position: ['top', 'left'],
		offset: [580, 170],
		delay: 200,
		effect: 'fade',
		slideInSpeed: 200,
		slideOutSpeed: 200
	});
	
	// LOGO ROLOVER MENU //
	
	$(".logo").tooltip({
		position: ['top', 'left'],
		offset: [13, 343],
		delay: 200,
		effect: 'fade',
		slideInSpeed: 100,
		slideOutSpeed: 100
	});
	
	// SHARE ROLLOVER //
	
	/*$(".facebook,.rss").tooltip({
		position: ['top', 'left'],
		offset: [35, 101],
		delay: 200,
		effect: 'fade',
		slideInSpeed: 200,
		slideOutSpeed: 200
	});*/
});

jQuery(function(){
				
	// BLOG RANDOM POST POPUP //
	
	jQuery(document).ready(function(){
		jQuery(".s-preview a").hover(function() {
			jQuery(this).next("em").animate({opacity: "show", top: "-155"}, "slow");
		}, function() {
			jQuery(this).next("em").animate({opacity: "hide", top: "-165"}, "fast");
		});
	});

});

// END OF FAZEDESIGNS TRICKS AND TIPS //



function slideSwitch() {
    var $active = $('#slide IMG.active');

    if ( $active.length == 0 ) $active = $('#slide IMG:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#slide IMG:first');

    // uncomment the 3 lines below to pull the images in random order
    
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setInterval( "slideSwitch()", 6000 );
});