$(document).ready(function(){	
	// Menu
	$('ul#menu').superfish({ 
		animation: {height:'show'},   // slide-down effect without fade-in 
	  delay:     1200               // 1.2 second delay on mouseout 
	}); 

	// Nav Link
	$("#nav li").hover(function(){
		$(this).find("a").stop(true, true).animate({ backgroundColor: "#fff" }, 500);
	}, function() {
		$(this).find("a").stop(true, true).animate({ backgroundColor: "#292929"  }, 500);
	});		
		
	// Tooltip
	$("a[rel^='tipsy'], .tooltips").tipsy({gravity: 's'});

	// Client Logo Image Hover
	$('.es-carousel img').css({opacity: 0.4});
	$(".es-carousel li").hover(function(){
		$(this).find("img").stop(true, true).animate({ opacity: 1 }, 500);
	}, function() {
		$(this).find("img").stop(true, true).animate({ opacity: 0.4 }, 500);
	});


	// Portfolio Images Hover Efect
	$('.image_block img').css({opacity: 1.0});
	$('.image_hover a').css({opacity: 0.0});
	$(".image_block").hover(function(){
		$(this).stop().animate({backgroundColor: "#69aaba"}, 800);
		$(this).find("img").stop(true, true).animate({ opacity: 0.5 }, 800);
		$(this).find("h3").stop(true, true).animate({ color: "#fff" }, 800);
		$(this).find("p").stop(true, true).animate({ color: "#fff" }, 800);
		$(this).find(".image_hover a").stop(true, true).animate({ opacity: 1.0 }, 800);
	}, function() {
		$(this).stop().animate({backgroundColor: "#fff"}, 800);	
		$(this).find("img").stop(true, true).animate({ opacity: 1.0 }, 800);
		$(this).find("h3").stop(true, true).animate({ color: "#606060" }, 800);
		$(this).find("p").stop(true, true).animate({ color: "#7a7a7a" }, 800);
		$(this).find(".image_hover a").stop(true, true).animate({ opacity: 0.0 }, 800);
	});

	// Team
	$(".team_block").hover(function(){	
		$(this).find("img").stop(true, true).animate({ opacity: 0.5 }, 800);
		$(this).find(".image_hover a").stop(true, true).animate({ opacity: 1.0 }, 800);
	}, function() {
		$(this).find("img").stop(true, true).animate({ opacity: 1.0 }, 800);
		$(this).find(".image_hover a").stop(true, true).animate({ opacity: 0.0 }, 800);
	});

	// Blog
	$('.post_col3, .post_col2, .post_col1').css({opacity: 0.85});
	$(".post_col3, .post_col2, .post_col1").hover(function(){
		$(this).stop(true, true).animate({ opacity: 1 }, 500);
	}, function() {
		$(this).stop(true, true).animate({ opacity: 0.85 }, 500);
	});

	// Comments Reply
	$(".comments a.reply").css({opacity: 0.0});
	$(".comments").hover(function(){
		$(this).find("a.reply").stop(true, true).animate({ opacity: 1.0 }, 800);
	}, function() {
		$(this).find("a.reply").stop(true, true).animate({ opacity: 0.0 }, 800);
	});
	
	// prettyPhoto
	$("a[rel^='pretty']").prettyPhoto();

	// Flickr 
	$('ul.flickr').jflickrfeed({
		limit: 9,
		qstrings: {
			id: '28792094@N04'
		},
		itemTemplate: 
		'<li>' + '<a href="{{image_b}}" rel="pretty"><img src="{{image_s}}" alt="{{title}}" class="image" /></a>' + '</li>'
	});

	$('.sidebar_flickr ul').jflickrfeed({
		limit: 9,
		qstrings: {
			id: '28792094@N04'
		},
		itemTemplate: 
		'<li>' + '<a href="{{image_b}}" rel="pretty"><img src="{{image_s}}" alt="{{title}}" class="image" /></a>' + '</li>'
	});

	// Latest Twitter
	$("#twitter").getTwitter({
		userName: "aldo_delgado",
		numTweets: 3,
		loaderText: "Loading tweets...",
		slideIn: true,
		showHeading: true,
		headingText: "",
		showProfileLink: true
	});

	// Pricing Box
	$('.pricing-box ul li:even').addClass('even');	
	$(".pricing-box").hover(function () {						 
		$(this).stop().animate({marginTop: "-10px" }, 500);
	}, function() {
		$(this).stop().animate({marginTop: "0" }, 500);
	});
		
	// Toggle
	$(".close").click(function(){$("#seting").toggle("fast");
	$(this).toggleClass("openpanel");return false});
	$(".toggle-block, .toggle-block2").hide(); 
	$("p.toggle, p.toggle2").click(function(){
		$(this).toggleClass("active").next().slideToggle(500);
		return false; 
	});
	
	// Accordion
	$('.acc-block').hide();
	$('.acc-header:first').addClass('active').next().show();
	$('.acc-header').click(function(){
		if( $(this).next().is(':hidden') ) {
			$('.acc-header').removeClass('active').next().slideUp();
			$(this).toggleClass('active').next().slideDown();
		}
		return false;
	});
	
	// Tab
	$('ul.tabs').each(function() {
		$(this).find('li').each(function(i) {
	  	$(this).click(function(){
	    	$(this).addClass('active').siblings().removeClass('active').parents('div.tab_block').find('div.tab').hide().end().find('div.tab:eq('+i+')').fadeIn(2000);
			});
		});
	});
});

$(window).load(function() {
	// Image Hover Efect
	$(".image, #sidebar .social a, #footer .social a").hover(function () {						 
		$(this).stop().animate({opacity: 0.60}, 800);
	}, function() {
		$(this).stop().animate({opacity: 1 }, 800);
	}); 	
});
