$(document).ready(function() {


// Main Navigation=================

	function megaHoverOver(){
		$(this).find(".sub").stop().fadeTo('fast', 1).show();
		}
	
	function megaHoverOut(){ 
	  $(this).find(".sub").stop().fadeTo('fast', 0, function() {
		  $(this).hide(); 
	  });
	}
	var config = {    
		 sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)    
		 interval: 100, // number = milliseconds for onMouseOver polling interval    
		 over: megaHoverOver, // function = onMouseOver callback (REQUIRED)    
		 timeout: 500, // number = milliseconds delay before onMouseOut    
		 out: megaHoverOut // function = onMouseOut callback (REQUIRED)    
	};

	$("ul#mainNav li .sub").css({'opacity':'0'});
	$("ul#mainNav li").hoverIntent(config);

// Home Page Slider Navigation=================

	// Implementation of Nivo Slider
    jQuery('#slider').nivoSlider({
		effect: 'random',
		pauseTime: '3000',
		startSlide:0,
        controlNavThumbs: true,
		controlNavThumbs:false,
        directionNav: false,
        directionNavHide: false,
        captionOpacity: false
	});

	jQuery('.nivo-control').each(function() {
		jQuery('<div class="overlay">').appendTo(this);
	});
	


// Tab setting =================


	$("a.tab").click(function () {
		// switch all tabs off
		$(".active").removeClass("active");
		// switch this tab on
		$(this).addClass("active");
		// slide all content up
		$(".content_text").slideUp();
		// slide this content up
		var content_show = $(this).attr("title");
		$("#"+content_show).slideDown();
	});


// Zoom Effeect  =================

 
 $('.portfolio-img').each(function() {
 $(this).hover(
	 function() {$(this).stop().animate({ opacity: 0.5 }, 400);},
	 function() {$(this).stop().animate({ opacity: 1.0 }, 400);})
 });
	

// Lightbox =================

 	 $("a[rel^='prettyPhoto']").prettyPhoto({
		animationSpeed:"normal", 
		padding: 40,
		opacity: 0.35, 
		showTitle: true, 
		allowresize: true
		//theme: "default"
	 });
	
});






