// remap jQuery to $
(function($){

	/* trigger when page is ready */
	$(document).ready(function (){
		// Menu
		$(".navigation").superfish({
			autoArrows: 	false,
			animation:  	{opacity:'show', height:'show'},
			dropShadows:   	false,
			delay:      	200,
			speed:     		"fast"
		}); 
		// Slide Home
		$("#slide-images").cycle({ 
		    fx:    		"scrollLeft", 
		    speed:  	1000,
		   	pager: 		"#slide-nav ul"
		});
		// Lightbox / Look book page 1e2 / Clipping
		$("#look-book ul li a[rel^='lookbook'], #clipping ul li a[rel^='clipping']").prettyPhoto({
			show_title: 	false,
			slideshow:		false,
			theme:			"facebook",
			allow_resize:	false,
			markup:			'<div class="pp_pic_holder"> \
								<div class="ppt">&nbsp;</div> \
								<div class="pp_content_container"> \
									<div class="pp_content"> \
										<div class="pp_loaderIcon"></div> \
										<div class="pp_fade"> \
											<a href="#" class="pp_expand" title="Expand the image">Expand</a> \
											{pp_social} \
											<div id="pp_full_res"></div> \
											<div class="pp_details"> \
											<p class="currentTextHolder">0/0</p> \
												<div class="pp_nav"> \
													<a href="#" class="pp_arrow_previous"><</a> \
													<a href="#" class="pp_arrow_next">></a> \
													<a class="pp_close" href="#">x</a> \
												</div> \
											</div> \
										</div> \
									</div> \
								</div> \
							</div> \
							<div class="pp_overlay"></div>',
			gallery_markup:	'',
			social_tools: 	''
		});
		// Lightbox / Campanha
		$("#campanha ul li a[rel^='campanha']").prettyPhoto({
			show_title: 	false,
			slideshow:		false,
			theme:			"facebook",
			allow_resize:	false,
			markup:			'<div class="pp_pic_holder"> \
								<div class="ppt">&nbsp;</div> \
								<div class="pp_content_container"> \
									<div class="pp_content"> \
										<div class="pp_loaderIcon"></div> \
										<div class="pp_fade"> \
											<a href="#" class="pp_expand" title="Expand the image">Expand</a> \
											{pp_social} \
											<div id="pp_full_res"></div> \
											<div class="pp_details"> \
											<p class="currentTextHolder">0/0</p> \
												<div class="pp_nav"> \
													<a href="#" class="pp_arrow_previous"><</a> \
													<a href="#" class="pp_arrow_next">></a> \
													<a class="pp_close" href="#">x</a> \
												</div> \
											</div> \
										</div> \
									</div> \
								</div> \
							</div> \
							<div class="pp_overlay"></div>',
			gallery_markup:	'',
			social_tools: 	'<div id="facebook"><span class="facebookButton">Button</span></div>'
		});
		// Twitter
		$("#twitter #tweets").getTwitter({
			userName: 			"ferroviejeans",
			numTweets: 			2,
			loaderText: 		"Carregando tweets...",
			slideIn: 			true,
			showHeading: 		false,
			headingText: 		"",
			showProfileLink:	false
		});
		// Campanha toggle
		$("#release-creditos h2").toggle( function() {
			$("#release-creditos h2 a").removeClass();
			$("#release-creditos h2 a:last-child").addClass("active");
			$("#release-creditos h2 a:first-child").addClass("hidden");
			
			$(".textos .release").fadeOut("fast", function() { $(".textos .creditos").fadeIn("fast"); });
		}, function() {
			$("#release-creditos h2 a").removeClass();
			$("#release-creditos h2 a:last-child").addClass("hidden");
			$("#release-creditos h2 a:first-child").addClass("active");
			
			$(".textos .creditos").fadeOut("fast", function() { $(".textos .release").fadeIn("fast"); });
		});
		// Contato toggle
		$("#contato #page-title h2").toggle( function() {
			$("#contato #page-title h2 a").removeClass();
			$("#contato #page-title h2 a:last-child").addClass("active");
			$("#contato #page-title h2 a:first-child").addClass("hidden");
			
			$("#contato #formulario").fadeOut("fast", function() { $("#contato #acessoria").fadeIn("fast"); });
		}, function() {
			$("#contato #page-title h2 a").removeClass();
			$("#contato #page-title h2 a:last-child").addClass("hidden");
			$("#contato #page-title h2 a:first-child").addClass("active");
			
			$("#contato #acessoria").fadeOut("fast", function() { $("#contato #formulario").fadeIn("fast"); });
		});
		// Look book pages / Next
		$("#look-book .look-next a").click ( function() {
			$("#look-book .firstPage").fadeOut("fast", function() { $("#look-book .secondPage").fadeIn("fast"); });
		});
		// Look book pages / Prev
		$("#look-book .look-prev a").click ( function() {
			$("#look-book .secondPage").fadeOut("fast", function() { $("#look-book .firstPage").fadeIn("fast"); });
		});
		// Page Campanha - Thumbs
		$("#campanha ul li:nth-child(4n), #clipping ul li:nth-child(5n), #look-book ul li:nth-child(5n), #acessoria-social ul li:nth-child(7), #acessoria-social ul li:nth-child(4)").css("margin-right","0");
		// Page Campanha - Textos
		$("#release-creditos .textos p:last-child").css("margin-bottom","0");
		// Thumbs look book
		$("#lookbook-thumb ul li:last-child, .marcaTexto p:last-child").css("margin","0");
		// Escondendo datas dos tweets
		$("#twitter #tweets ul li>a").css("display","none");
		// Scroll
		$(".textos .release").jScrollPane({
			showArrows: 	true,
			wheelSpeed:		1
		});
		$(".textos .creditos").jScrollPane({
			showArrows: 	true,
			wheelSpeed:		1
		});
		// Share Facebook
		$("#facebook .facebookButton").live("click", function(e){
			var shareURL = encodeURIComponent(window.location);
			window.location.href = 'http://www.facebook.com/sharer.php?u='+shareURL+'&t=Ferrovie Summer Collection 2012';
			e.preventDefault();
		});
		// Scroll Top
		$("#setas-topo a").click( function() {
			$("html,body").animate({scrollTop: 0},"slow");
		});
	});

})(window.jQuery);


/* optional triggers

$(window).load(function() {
	
});

$(window).resize(function() {
	
});

*/
