/* Cappen - Agencia Digital
 * @author Guga Carvalho - http://www.gugacarvalho.com
 * @version 1.0
 * @date September 10, 2010
 * @copyright (c) 2010 Guga Carvalho - http://www.gugacarvalho.com
 */

/** ************************** BANNER ******************************** */

// http://www.gruponove.com.br -- $$$$$
// http://www.supermaenagem.com.br/ -- @@@@@
// http://mobile.shoppingrecife.com.br/ -- #####
// http://apps.facebook.com/flybabyfly/ - &&&&
$('#prev-button').hover(function() {
	$('#div-prev-button').css('background-position', '0 -223px');
}, function() {
	$('#div-prev-button').css('background-position', '0 0');
});
$('#next-button').hover(function() {
	$('#div-next-button').css('background-position', '0 -669px');
}, function() {
	$('#div-next-button').css('background-position', '0 -446px');
});
$('.infiniteCarousel img').each(function(i) {
	if (i == 0) {
		this.style.display = 'block';
	} else {
		this.style.display = 'none'
	}
});
var slidePlay = false;
$('#next-button')
		.click(
				function() {
					if (slidePlay == false) {
						$('#bt-banner-topo').css('display', 'none');
						slidePlay = true;
						var exibeTopo = false;
						var exibeTopo2 = true;
						var final = $('.infiniteCarousel img').length - 1;
						$('.infiniteCarousel img')
								.each(
										function(i) {
											if (exibeTopo == true) {
												$('#div_slider').width('0px');
												this.style.display = 'block';
												$('#div_slider').animate({
													width : '575px'
												}, 1500);
												setTimeout(function() {
													slidePlay = false;
												}, 1500);
												if (this.className == 'link3') {
													$('#bt-banner-topo')
															.attr('href',
																	'http://www.eduardofeitosa.com.br/');
													$('#bt-banner-topo').css(
															'display', 'block');
												} else if (this.className == 'link4') {
													$('#bt-banner-topo')
															.attr('href',
																	'http://vimeo.com/26778574');
													$('#bt-banner-topo').css(
															'display', 'block');
												} else if (this.className == 'link1') {
													$('#bt-banner-topo')
															.attr('href',
																	'http://apps.facebook.com/aminhalista/');
													$('#bt-banner-topo').css(
															'display', 'block');
												} else if (this.className == 'link5') {
													$('#bt-banner-topo')
															.attr('href',
																	'http://www.gruponove.com.br');
													$('#bt-banner-topo').css(
															'display', 'block');
												} else {
													$('#bt-banner-topo').css(
															'display', 'none');
												}
												$('#div-atalho-button a')
														.removeClass('active');
												$('#div-atalho-button a')[i].className = $('#div-atalho-button a')[i].className
														+ ' active';
												exibeTopo2 = false;
												exibeTopo = false;
											} else if (exibeTopo2 == true) {
												if (this.style.display == 'block') {
													$('#bt-banner-topo').css(
															'display', 'none');
													this.style.display = 'none';
													exibeTopo = true;
													if (i == final) {
														$('#div_slider').width(
																'0px');
														$('.infiniteCarousel img')[0].style.display = 'block';
														$('#div_slider')
																.animate(
																		{
																			width : '575px'
																		}, 1500);
														setTimeout(function() {
															slidePlay = false;
														}, 1500);
														$('#bt-banner-topo')
																.css('display',
																		'block');
														if ($('.infiniteCarousel img')[0].className == 'link3') {
															$('#bt-banner-topo')
																	.attr(
																			'href',
																			'http://www.eduardofeitosa.com.br/');
															$('#bt-banner-topo')
																	.css(
																			'display',
																			'block');
														} else if ($('.infiniteCarousel img')[0].className == 'link4') {
															$('#bt-banner-topo')
																	.attr(
																			'href',
																			'http://vimeo.com/26778574');
															$('#bt-banner-topo')
																	.css(
																			'display',
																			'block');
														} else if ($('.infiniteCarousel img')[0].className == 'link1') {
															$('#bt-banner-topo')
																	.attr(
																			'href',
																			'http://apps.facebook.com/aminhalista/');
															$('#bt-banner-topo')
																	.css(
																			'display',
																			'block');
														} else if ($('.infiniteCarousel img')[0].className == 'link5') {
															$('#bt-banner-topo')
															.attr(
																	'href',
															'http://www.gruponove.com.br');
															$('#bt-banner-topo')
															.css(
																	'display',
															'block');
														} else {
															$('#bt-banner-topo')
																	.css(
																			'display',
																			'none');
														}
														$(
																'#div-atalho-button a')
																.removeClass(
																		'active');
														$('#div-atalho-button a')[0].className = $('#div-atalho-button a')[0].className
																+ ' active';
													}
												}
											}
										});
					}
				});
$('#prev-button')
		.click(
				function() {
					if (slidePlay == false) {
						$('#bt-banner-topo').css('display', 'none');
						var exibeTopo = false;
						var exibeTopo2 = true;
						var final = $('.infiniteCarousel img').length - 1;
						$('.infiniteCarousel img')
								.each(
										function(i) {
											if (exibeTopo2 == true) {
												if (this.style.display == 'block') {
													if (i != 0) {
														slidePlay = true;
														this.style.display = 'none';
														$('#div_slider').width(
																'0px');
														$('.infiniteCarousel img')[i - 1].style.display = 'block';
														$('#div_slider')
																.animate(
																		{
																			width : '575px'
																		}, 1500);
														setTimeout(function() {
															slidePlay = false;
														}, 1500);
														if ($('.infiniteCarousel img')[i - 1].className == 'link3') {
															$('#bt-banner-topo')
																	.attr(
																			'href',
																			'http://www.eduardofeitosa.com.br/');
															$('#bt-banner-topo')
																	.css(
																			'display',
																			'block');
														} else if ($('.infiniteCarousel img')[i - 1].className == 'link4') {
															$('#bt-banner-topo')
																	.attr(
																			'href',
																			'http://vimeo.com/26778574');
															$('#bt-banner-topo')
																	.css(
																			'display',
																			'block');
														} else if ($('.infiniteCarousel img')[i - 1].className == 'link1') {
															$('#bt-banner-topo')
																	.attr(
																			'href',
																			'http://apps.facebook.com/aminhalista/');
															$('#bt-banner-topo')
																	.css(
																			'display',
																			'block');
														} else if ($('.infiniteCarousel img')[i - 1].className == 'link5') {
															$('#bt-banner-topo')
															.attr(
																	'href',
															'http://www.gruponove.com.br');
															$('#bt-banner-topo')
															.css(
																	'display',
															'block');
														} else {
															$('#bt-banner-topo')
																	.css(
																			'display',
																			'none');
														}
														$(
																'#div-atalho-button a')
																.removeClass(
																		'active');
														$('#div-atalho-button a')[i - 1].className = $('#div-atalho-button a')[i - 1].className
																+ ' active';
														exibeTopo2 = false;
														exibeTopo = false;
													}
												}
											}
										});
						exibeTopo2 = false;
						exibeTopo = false;
					}
				});
var total_banner = $('.infiniteCarousel img').length;
$('.infiniteCarousel img').each(
		function(i) {
			if (i == 0) {
				$('#div-atalho-button').html(
						$('#div-atalho-button').html()
								+ '<a href="javascript:;" class="bt-b' + i
								+ ' active"> </a>');
			} else {
				$('#div-atalho-button').html(
						$('#div-atalho-button').html()
								+ '<a href="javascript:;" class="bt-b' + i
								+ '"> </a>');
			}
		});
$('#div-atalho-button a')
		.click(
				function() {
					if (slidePlay == false) {
						slidePlay = true;
						$('#div-atalho-button a').removeClass('active');
						var num = this.className.substr(this.className
								.indexOf('-') + 2);
						$('.infiniteCarousel img').hide();
						$('#div_slider').width('0px');
						$('.infiniteCarousel img')[num].style.display = 'block';
						$('#div_slider').animate({
							width : '575px'
						}, 1500);
						setTimeout(function() {
							slidePlay = false;
						}, 1500);
						$(this).addClass('active');
						if ($('.infiniteCarousel img')[num].className == 'link3') {
							$('#bt-banner-topo').attr('href',
									'http://www.eduardofeitosa.com.br/');
							$('#bt-banner-topo').css('display', 'block');
						} else if ($('.infiniteCarousel img')[num].className == 'link4') {
							$('#bt-banner-topo').attr('href',
									'http://vimeo.com/26778574');
							$('#bt-banner-topo').css('display', 'block');
						} else if ($('.infiniteCarousel img')[num].className == 'link1') {
							$('#bt-banner-topo').attr('href',
									'http://apps.facebook.com/aminhalista/');
							$('#bt-banner-topo').css('display', 'block');
						} else if ($('.infiniteCarousel img')[num].className == 'link5') {
							$('#bt-banner-topo').attr('href',
							'http://www.gruponove.com.br');
							$('#bt-banner-topo').css('display', 'block');
						} else {
							$('#bt-banner-topo').css('display', 'none');
						}
					}
				});

/** ************************** WHO EFFECTS *************************** */
$("#content-top").css("position", "relative");
$("#content-top").css("top", "0px");
setTimeout(function() {
	$("#content-top").css("top", "0");
}, 1000);

if ($.browser.msie) {
	$("#our-stars").css("top", "0");
	$("#who").css("display", "none");
	$("#nav-content-top-who").removeClass('active');
	$("#nav-content-top-our-stars").addClass('active');
	$("#our-stars").css("display", "block");

} else {
	setTimeout(function() {
		$("#our-stars").css("top", "0");
		setTimeout(function() {
			$("#our-stars").css("display", "none");
		}, 500);
	}, 1000);
}

$('#our-stars-carousel img').css("opacity", "0.2");

$('#our-stars-carousel img').hover(function() {
	$(this).css("opacity", "1");
}, function() {
	$(this).css("opacity", "0.2");
});

$('#nav-content-top-offerings')
		.click(
				function() {
					if ($(this).hasClass('click-active')) {

						// tira o evento de click dos outros links do menu
						$(
								'#nav-content-top-who, #nav-content-top-our-stars, #nav-content-top-life-at-cappen')
								.removeClass('click-active');

						$('#who, #our-stars, #life-at-cappen').fadeOut(500);
						$(
								'#nav-content-top-who, #nav-content-top-our-stars, #nav-content-top-life-at-cappen')
								.removeClass('active');
						setTimeout(
								function() {
									$('#offerings').fadeIn(700);
									$('#nav-content-top-offerings').addClass(
											'active');

									// adiciona o evento de click dos outros
									// links do menu
									setTimeout(
											function() {
												$(
														'#nav-content-top-who, #nav-content-top-our-stars, #nav-content-top-life-at-cappen')
														.addClass(
																'click-active');
											}, 900);
								}, 700);
					} else {
					}
				});

$('#nav-content-top-who')
		.click(
				function() {
					if ($(this).hasClass('click-active')) {

						// tira o evento de click dos outros links do menu
						$(
								'#nav-content-top-offerings, #nav-content-top-our-stars, #nav-content-top-life-at-cappen')
								.removeClass('click-active');

						$('#offerings, #our-stars, #life-at-cappen').fadeOut(
								500);
						$(
								'#nav-content-top-offerings, #nav-content-top-our-stars, #nav-content-top-life-at-cappen')
								.removeClass('active');
						setTimeout(
								function() {
									$('#who').fadeIn(700);
									$('#nav-content-top-who')
											.addClass('active');

									// adiciona o evento de click dos outros
									// links do menu
									setTimeout(
											function() {
												$(
														'#nav-content-top-offerings, #nav-content-top-our-stars, #nav-content-top-life-at-cappen')
														.addClass(
																'click-active');
											}, 900);
								}, 700);
					} else {
					}
				});

$('#nav-content-top-our-stars')
		.click(
				function() {
					if ($(this).hasClass('click-active')) {

						// tira o evento de click dos outros links do menu
						$(
								'#nav-content-top-who, #nav-content-top-offerings, #nav-content-top-life-at-cappen')
								.removeClass('click-active');

						$('#who, #offerings, #life-at-cappen').fadeOut(500);
						$(
								'#nav-content-top-who, #nav-content-top-offerings, #nav-content-top-life-at-cappen')
								.removeClass('active');
						setTimeout(
								function() {
									$('#our-stars').fadeIn(700);
									$('#nav-content-top-our-stars').addClass(
											'active');

									// adiciona o evento de click dos outros
									// links do menu
									setTimeout(
											function() {
												$(
														'#nav-content-top-who, #nav-content-top-offerings, #nav-content-top-life-at-cappen')
														.addClass(
																'click-active');
											}, 900);
								}, 700);
					} else {
					}
				});

$('#nav-content-top-game').click(function() {
	window.open('http://apps.facebook.com/flybabyfly/', 'flybabyfly');
});

$('#nav-content-top-life-at-cappen')
		.click(
				function() {
					if ($(this).hasClass('click-active')) {

						// tira o evento de click dos outros links do menu
						$(
								'#nav-content-top-who, #nav-content-top-our-stars, #nav-content-top-offerings')
								.removeClass('click-active');

						$('#who, #our-stars, #offerings').fadeOut(500);
						$(
								'#nav-content-top-who, #nav-content-top-our-stars, #nav-content-top-offerings')
								.removeClass('active');
						setTimeout(
								function() {
									$('#life-at-cappen').fadeIn(700);
									$('#nav-content-top-life-at-cappen')
											.addClass('active');

									// adiciona o evento de click dos outros
									// links do menu
									setTimeout(
											function() {
												$(
														'#nav-content-top-who, #nav-content-top-our-stars, #nav-content-top-offerings')
														.addClass(
																'click-active');
											}, 900);
								}, 700);
					} else {
					}
				});
/** ************************** WHO EFFECTS *************************** */

/** ************************** NAV WHO EFFECTS *************************** */
$(function() {
	$("#nav-who, #nav-quem, #back-who").click(function() {
		if ($("#content-top").hasClass("active")) {
			$("#content-top").slideUp(1000);
			$("#back-who").fadeOut(500);
			$("#content-top").removeClass("active");
			$("#setas-carousel").fadeIn(1800);

		} else {
			$("#content-top").slideDown(1000);
			setTimeout(function() {
				$("#back-who").fadeIn(500);
			}, 1000);
			$("#content-top").addClass("active");
			$("#setas-carousel").fadeOut(500);
			// carregaSlider();
		}
	});
});
/** ************************** NAV WHO EFFECTS *************************** */

/** ************************** SHOWREEL EFFECTS *************************** */
$(function() {
	$(
			"#effect-play-showreel, #nav-showreel, #showreel a, #link-showreel, #link-showreel-pt")
			.click(function() {
				if ($("#showreel").hasClass('active')) {
					$("#showreel").removeClass('active');
					$("#showreel").animate({
						left : "-905px"
					}, 1200);
					$("#layer").css("display", "none");
					setTimeout(function() {
						$("#layer").css("background", "#00ffa8");
						$("#showreel div").css("display", "none");
						setTimeout(function() {
							$("#showreel div").css("display", "block");
						}, 100);
					}, 400);

				} else {
					$("#showreel").addClass('active');
					$("#layer").css("display", "block");
					$("#layer").css("background", "#fff");
					$("#showreel").animate({
						left : 0
					}, 1200);
					/*
					 * $("#showreel div").css("display","block");
					 */
				}
			});
});
/** ************************** SHOWREEL EFFECTS *************************** */

/** ************************** RELEASES EFFECTS *************************** */
$(function() {
	$("#content-releases article").hover(function() {
		if ($.browser.msie && $.browser.version == 7.0) {
		} else {
			$(this).addClass('active');
			$("#layer").css("display", "block");
		}
	}, function() {
		if ($.browser.msie && $.browser.version == 7.0) {
		} else {
			$(this).removeClass('active');
			$("#layer").css("display", "none");
		}
	});

	$("a.ver-mais-releases-home").hover(
			function() {
				$(this).parents("article").find(".hover-articles-releases")
						.fadeIn(300);
			},
			function() {
				$(this).parents("article").find(".hover-articles-releases")
						.fadeOut(300);
			});
});

// hover img collection item
$(".figure-area-releases").hover(function() {
	$(this).find("figure").animate({
		top : "-180px"
	}, 300);
}, function() {
	$(this).find("figure").animate({
		top : "0px"
	}, 300);
});
/** ************************** RELEASES EFFECTS *************************** */

/** ************************** NAV EFFECTS *************************** */
function rollover(target, from, to) {
	target.mouseenter(function() {
		$(this).stop();
		$(this).animate({
			backgroundPosition : '0 -' + to + 'px'
		}, 100, 'easeOutQuad');
	});
	target.mouseleave(function() {
		$(this).stop();
		$(this).animate({
			backgroundPosition : '0 -' + from + 'px'
		}, 100, 'easeInQuad');
	});
}

$(document).ready(function() {
	$('nav a').mouseenter(function() {
		var span = $(this).find('span');
		span.stop();
		span.animate({
			width : $(this).width()
		}, 250);
	});
	$('nav a').mouseleave(function() {
		var span = $(this).find('span');
		span.stop();
		span.animate({
			width : 0
		}, 250);
	});
});

$(document).ready(function() {
	$('#link-showreel-pt').mouseenter(function() {
		var span = $(this).find('span');
		span.stop();
		span.animate({
			width : $(this).width()
		}, 250);
	});
	$('#link-showreel-pt').mouseleave(function() {
		var span = $(this).find('span');
		span.stop();
		span.animate({
			width : 0
		}, 250);
	});
});

$(document).ready(function() {
	$('#link-showreel').mouseenter(function() {
		var span = $(this).find('span');
		span.stop();
		span.animate({
			width : $(this).width()
		}, 250);
	});
	$('#link-showreel').mouseleave(function() {
		var span = $(this).find('span');
		span.stop();
		span.animate({
			width : 0
		}, 250);
	});
});
/** ************************** NAV EFFECTS *************************** */

/** ************************** FIXED BAR *************************** */
// close bar
$("#fixed-bar").animate({
	"bottom" : "0px"
}, 1500);
$("#bt-fechar-fixed-bar2").click(function() {
	$("#fixed-bar").animate({
		"bottom" : "-45px"
	}, 400);
	setTimeout(function() {
		$("#open-fixed-bar").animate({
			"bottom" : "-0px"
		}, 400);
	}, 401);
});

// open bar
$("#open-fixed-bar a").click(function() {
	$("#open-fixed-bar").animate({
		"bottom" : "-40px"
	}, 400);
	setTimeout(function() {
		$("#fixed-bar").animate({
			"bottom" : "-0px"
		}, 400);
	}, 401);
});
/** ************************** FIXED BAR *************************** */

/** ************************** COLLECTION *************************** */
$(function() {
	$(
			"#nav-collection, #veja-mais-gallery, #nav-colecao, #view-other-projects, .focus-releases a, #veja-mais-gallery")
			.click(function() {
				$("#layer2").css("display", "block");
				$("#collection").fadeIn(1000);
				$("#collection").addClass('active');
				$("#layer2").removeClass('collection-project');
				$("#layer2").removeClass('contact');
				$("#layer2").addClass('collection');

				window.scrollTo(0, 0);
			});

	$("#go-back-footer-collection, #go-back-footer-collection-pt").click(
			function() {
				$("#layer2").css("display", "none");
				$("#collection").fadeOut(1000);
				$("#collection").removeClass('active');
				$("#layer2").removeClass('collection');
			});

	$("#go-back-collection-project, #go-back-collection-project-pt").click(
			function() {

				if ($("#collection").hasClass('back-collection')) {
					$("#collection-project").fadeOut(500);
					setTimeout(function() {
						$("#collection").fadeIn(500);
						$("#collection").addClass('active');
						$("#collection").removeClass('back-collection');
						$("#layer2").removeClass('collection-project');
						$("#layer2").addClass('collection');
					}, 550);
				} else {
					$("#collection-project").css("display", "none");
					$("#layer2").removeClass('collection-project');
					$("#layer2").css("display", "none");
					$("#collection").removeClass('back-release');
				}
			});
});

/*
 * $(".ver-mais-collection").click(function(){
 * if($("#collection").hasClass('active')){ $("#collection").fadeOut(500);
 * setTimeout(function(){ $("#collection-project").fadeIn(500);
 * $("#collection").addClass('back-collection'); },550); } else{
 * $("#layer2").css("display","block"); $("#collection-project").fadeIn(500);
 * $("#collection").addClass('back-collection'); } });
 */

/*
 * $(".ver-mais-releases-home").click(function(){
 * if($("#collection").hasClass('active')){ $("#collection").fadeOut(500);
 * setTimeout(function(){ $("#collection-project").fadeIn(500);
 * $("#collection").addClass('back-release'); },550); } else{
 * $("#layer2").css("display","block"); $("#collection-project").fadeIn(500);
 * $("#collection").addClass('back-release'); } });
 */

// hover img collection item
$(".figure-area").hover(function() {
	$(this).find("figure").animate({
		top : "-180px"
	}, 300);
}, function() {
	$(this).find("figure").animate({
		top : "0px"
	}, 300);
});

// carousel collection
var qntd_collection = $("#content-collection ul").children().length;
var pagination_collection = $("#pagination-collection").html();

// pagination
/*
 * var i = 0; while(i < qntd_collection){ var pagination_collection =
 * pagination_collection+"<a href='javascript:;' title='Page "+(i+1)+"'
 * class='pag-collection-"+(i+1)+"'>Page "+(i+1)+"</a>"; i++; }
 * $("#pagination-collection").html(pagination_collection);
 */

// loading effect
var contLoading = 1;
var p1 = "Loading.";
var p2 = "Loading..";
var p3 = "Loading...";
setInterval(function() {
	if (contLoading == 4) {
		contLoading = 1;
	}
	if (contLoading == 1) {
		$("#loading-collection p").html(p1);
	}
	if (contLoading == 2) {
		$("#loading-collection p").html(p2);
	}
	if (contLoading == 3) {
		$("#loading-collection p").html(p3);
	}
	contLoading++;
}, 700);

// loading box
$("#pagination-collection #paginacao2 a").click(function() {
	$("#content-collection article img").animate({
		"opacity" : "0.4"
	}, 700);
	$(".box-1").animate({
		"top" : "145px",
		"left" : "220px"
	}, 800);
	$(".box-2").animate({
		"top" : "145px",
		"left" : "220px"
	}, 800);
	$(".box-3").animate({
		"top" : "145px",
		"left" : "220px"
	}, 800);
	$(".box-4").animate({
		"top" : "145px",
		"left" : "220px"
	}, 800);
	$(".box-5").animate({
		"top" : "145px",
		"left" : "220px"
	}, 800);
	$(".box-6").animate({
		"top" : "145px",
		"left" : "220px"
	}, 800);
	$("#loading-collection").fadeIn(700);
});

function distribuirElementos() {
	$("#loading-collection").fadeOut(500);
	$(".box-1").animate({
		"top" : "0px",
		"left" : "0px"
	}, 900);
	$(".box-2").animate({
		"top" : "0px",
		"left" : "220px"
	}, 900);
	$(".box-3").animate({
		"top" : "0px",
		"left" : "440px"
	}, 900);
	$(".box-4").animate({
		"top" : "270px",
		"left" : "0px"
	}, 900);
	$(".box-5").animate({
		"top" : "270px",
		"left" : "220px"
	}, 900);
	$(".box-6").animate({
		"top" : "270px",
		"left" : "440px"
	}, 900);
	$("#content-collection article img").animate({
		"opacity" : "1"
	}, 1100);
}

/** ************************** COLLECTION *************************** */

/** ************************** SELECTBOX *************************** */
$("#demo-default-usage .demoControls").find('.replace').bind('click',
		function() {
			$(".default-usage-select").selectbox();
		});
$("#demo-default-usage .demoControls").find('.undo').bind('click', function() {
	$(".default-usage-select").parents('.jquery-selectbox').unselectbox();
});

$(".default-usage-select").selectbox().bind(
		'change',
		function() {
			$(
					'<div>Value of .default-usage-select changed to: '
							+ $(this).val() + '</div>').appendTo(
					'#demo-default-usage .demoTarget').fadeOut(5000,
					function() {
						$(this).remove();
					});
		});

$("#collection").css("display", "none");
$("#collection").css("top", "50%");
/** ************************** SELECTBOX *************************** */

/** ************************** COLLECTION PROJECTS *************************** */
if ((screen.height) >= 1000) {
	$("#collection-project").css("top", "50%");
	var topCollection = $("#collection-project").height() / 2;
	$("#collection-project").css("marginTop", -topCollection);
} else {
	$("#collection-project").css("top", "20px");
}
/** ************************** COLLECTION PROJECTS *************************** */

/** ************************** COLLECTION *************************** */
if ((screen.height) >= 900) {
	$("#collection").css("top", "50%");
	var topCollection = $("#collection").height() / 2;
	$("#collection").css("marginTop", -topCollection);
} else {
	$("#collection").css("top", "20px");
}
/** ************************** COLLECTION *************************** */

/** ************************** CONTACT *************************** */
$(function() {
	$("#nav-contact, #nav-contato").click(function() {
		$("#layer2").css("display", "block");
		$("#contact").fadeIn(500);
		$("#contact").addClass('active');
		$("#layer2").addClass('contact');
	});

	$("#back-contact, #back-contact-pt").click(function() {
		$("#layer2").css("display", "none");
		$("#contact").fadeOut(300);
		$("#contact").removeClass('active');
		$("#layer2").removeClass('contact');
	});
});
/** ************************** CONTACT *************************** */

/** ************************** LAYER *************************** */
$("#layer2, #contact").click(function() {
	if ($("#layer2").hasClass('contact')) {
		$("#layer2").css("display", "none");
		$("#contact").fadeOut(300);
		$("#layer2").removeClass('collection');
		$("#layer2").removeClass('collection-project');
		$("#layer2").removeClass('contact');

	} else if ($("#layer2").hasClass('collection')) {
		$("#layer2").css("display", "none");
		$("#collection").fadeOut(500);
		$("#collection").removeClass('active');
		$("#collection").removeClass('back-collection');
		$("#layer2").removeClass('collection');
		$("#layer2").removeClass('collection-project');
		$("#layer2").removeClass('contact');

	} else if ($("#layer2").hasClass('collection-project')) {
		$("#layer2").css("display", "none");
		$("#collection-project").fadeOut(500);
		$("#collection").removeClass('active');
		$("#collection").removeClass('back-release');
		$("#layer2").removeClass('collection');
		$("#layer2").removeClass('collection-project');
		$("#layer2").removeClass('contact');

	}
});
/** ************************** LAYER *************************** */

/** ************************** BY CAPPEN EFFECTS *************************** */
$(function() {
	$("#nav-gallery ul li a.active").find("span").css("color", "#fff");
	$(".image-gallery-2").fadeOut(100);
	$(".image-gallery-3").fadeOut(100);
	$(".image-gallery-1").fadeIn(100);

	$("#nav-gallery ul li a").hover(function() {
		$("#nav-gallery ul li a").find("span").css("color", "#b2b3b3");
		$(this).find("span").css("color", "#fff");
		$("#nav-gallery ul li a").removeClass("active");
		$(this).addClass("active");

		if ($(this).hasClass('nav-gallery-1')) {
			$(".image-gallery-2").fadeOut(400);
			$(".image-gallery-3").fadeOut(400);
			$(".image-gallery-1").fadeIn(500);

		} else if ($(this).hasClass('nav-gallery-2')) {
			$(".image-gallery-1").fadeOut(400);
			$(".image-gallery-3").fadeOut(400);
			$(".image-gallery-2").fadeIn(500);

		} else if ($(this).hasClass('nav-gallery-3')) {
			$(".image-gallery-1").fadeOut(400);
			$(".image-gallery-2").fadeOut(400);
			$(".image-gallery-3").fadeIn(500);

		}
	});
});
/** ************************** BY CAPPEN EFFECTS *************************** */

/** ************************** SOCIAL NETWORKS EFFECTS ********************* */
$(function() {
	$("#twitter").hover(function() {
		$("#vimeo").css("opacity", "0.3");
		$("#facebook").css("opacity", "0.3");
		$("#linked-in").css("opacity", "0.3");

	}, function() {
		$("#twitter").css("opacity", "1");
		$("#vimeo").css("opacity", "1");
		$("#facebook").css("opacity", "1");
		$("#linked-in").css("opacity", "1");
	});

	$("#vimeo").hover(function() {
		$("#twitter").css("opacity", "0.3");
		$("#facebook").css("opacity", "0.3");
		$("#linked-in").css("opacity", "0.3");

	}, function() {
		$("#twitter").css("opacity", "1");
		$("#vimeo").css("opacity", "1");
		$("#facebook").css("opacity", "1");
		$("#linked-in").css("opacity", "1");
	});

	$("#facebook").hover(function() {
		$("#twitter").css("opacity", "0.3");
		$("#vimeo").css("opacity", "0.3");
		$("#linked-in").css("opacity", "0.3");

	}, function() {
		$("#twitter").css("opacity", "1");
		$("#vimeo").css("opacity", "1");
		$("#facebook").css("opacity", "1");
		$("#linked-in").css("opacity", "1");
	});

	$("#linked-in").hover(function() {
		$("#twitter").css("opacity", "0.3");
		$("#vimeo").css("opacity", "0.3");
		$("#facebook").css("opacity", "0.3");

	}, function() {
		$("#twitter").css("opacity", "1");
		$("#vimeo").css("opacity", "1");
		$("#facebook").css("opacity", "1");
		$("#linked-in").css("opacity", "1");
	});
});
/** ************************** SOCIAL NETWORKS EFFECTS ********************* */

$(function() {
	$("#veja-mais-gallery").click(function() {
		setTimeout(function() {
			$.scrollTo('#top-scroll', 1500, {
				easing : 'elasout'
			});
		}, 600);
	});
});

