// OPEN LINKS IN NEW WINDOW
//=================================================================================================================================

//$(function(){
//	$('a.external, #nav a:not([href*="makeupgeek.com"])').click(function(){
//		window.open(this.href);
//		return false;
//	});
//});

// HOMEPAGE SLIDER
//=================================================================================================================================

$(function() {
	$('#slides').slides({
		preload: true,
		preloadImage: '../images/loading.gif',
		play: 7000,
		hoverPause: true,
		fadeSpeed: 700,
		effect: 'fade',
		crossfade: true,
		generatePagination: false
	});
});

// ARCHIVE TABS STATE
//=================================================================================================================================

jQuery(document).ready(function() {
	$("#guides-nav div").click(function(){
	    $("#guides-nav div").removeClass("current").addClass("");
	    $(this).addClass("current");
	});
	$("#articles-nav div").click(function(){
	    $("#articles-nav div").removeClass("current").addClass("");
	    $(this).addClass("current");
	});
	$("#idea-gallery-nav div").click(function(){
	    $("#idea-gallery-nav div").removeClass("current").addClass("");
	    $(this).addClass("current");
	});
	$("#idea-gallery-tabs li a").click(function(){
	    $("#idea-gallery-tabs li a").removeClass("current").addClass("");
	    $(this).addClass("current");
	});
});

// ALTERNATE VIDEO EMBED TOGGLE
//=================================================================================================================================

jQuery(function($) {
	$("#video-embed-alt").hide();
	$('#video-embed-show a').click(function() {
		$("#video-embed-show").fadeOut('normal');
		$("#video-embed-alt").animate({ height: "show" }, 350, ""); return false;
	});
	$('#video-embed-hide a').click(function() {
		$("#video-embed-show").fadeIn('normal');
		$("#video-embed-alt").animate({ height: "hide" }, 350, ""); return false;
	});
});

// REVIEWS SCROLLABLE PANE
//=================================================================================================================================

jQuery(function($) {
	$('#reviews-recent').jScrollPane(
		{
			showArrows: true,
			animateScroll: true,
			animateDuration: 800,
			arrowButtonSpeed: 930,
			arrowRepeatFreq: 500
		}
	);
});

// WIDGET TAB CURRENT STATES
//=================================================================================================================================

jQuery(document).ready(function() {
	$(".toggle h4").click(function(){
	    $(this).toggleClass("expand");
	});
});

// IDEA GALLERY
//=================================================================================================================================

jQuery(document).ready(function() {
	$("#idea-gallery-hero").delay('150').fadeIn('normal');
	$("#idea-gallery-thumbnails").delay('150').fadeIn('normal');
	$("#idea-gallery-thumbnails a:eq(3)").attr('class', 'last');
	$("#idea-gallery-tabs").delay('150').fadeIn('normal');
	$("#idea-gallery-content").delay('150').fadeIn('normal');
	$("#idea-gallery-banner").delay('150').fadeIn('normal');
	$("#loading").fadeOut('fast');
	$(".archive .post").delay('150').fadeIn('normal');
	$("#idea-gallery .post").delay('150').fadeIn('normal');
	$("#swatches").delay('150').fadeIn('normal');
	$(".wp-pagenavi").delay('150').fadeIn('normal');
	$("#gallery-everyday h2, #gallery-dramatic h2, #gallery-holiday h2, #gallery-featured h2, #gallery-trending h2, #gallery-popular h2, #gallery-recent h2").delay('150').fadeIn('normal');
	$("#idea-gallery-description iframe").remove();
	$("#idea-gallery-description embed").remove();
	$("#idea-gallery-description p").remove(":has('a img')");
	$("#idea-gallery-description p").remove(":has('img')");
	$("#idea-gallery-description a img").remove();
	$("#idea-gallery-description img").remove();
});

// POST INDEX
//=================================================================================================================================

jQuery(function($) {
	$("#content.archive div.post:eq(2)").attr('class', 'post last');
	$("#content.archive div.post:eq(5)").attr('class', 'post last');
	$("#content.archive div.post:eq(8)").attr('class', 'post last');
	$("#content.archive div.post:eq(11)").attr('class', 'post last');
	$("#content.archive div.post:eq(14)").attr('class', 'post last');
	$("#content.archive div.post:eq(17)").attr('class', 'post last');
	$("#content.archive div.post:eq(20)").attr('class', 'post last');
	$("#content.archive div.post:eq(23)").attr('class', 'post last');
	$("#content.archive div.post:eq(26)").attr('class', 'post last');
	$("#content.archive div.post:eq(29)").attr('class', 'post last');
	$("#content.archive div.post:eq(32)").attr('class', 'post last');
	$("#content.archive div.post:eq(35)").attr('class', 'post last');
	$("#content.archive div.post:eq(38)").attr('class', 'post last');
	$("#content.archive div.post:eq(41)").attr('class', 'post last');
	$("#content.archive div.post:eq(3)").attr('class', 'post first');
	$("#content.archive div.post:eq(6)").attr('class', 'post first');
	$("#content.archive div.post:eq(9)").attr('class', 'post first');
	$("#content.archive div.post:eq(12)").attr('class', 'post first');
	$("#content.archive div.post:eq(15)").attr('class', 'post first');
	$("#content.archive div.post:eq(18)").attr('class', 'post first');
	$("#content.archive div.post:eq(21)").attr('class', 'post first');
	$("#content.archive div.post:eq(24)").attr('class', 'post first');
	$("#content.archive div.post:eq(27)").attr('class', 'post first');
	$("#content.archive div.post:eq(30)").attr('class', 'post first');
	$("#content.archive div.post:eq(33)").attr('class', 'post first');
	$("#content.archive div.post:eq(36)").attr('class', 'post first');
	$("#content.archive div.post:eq(39)").attr('class', 'post first');
	$("#content.archive div.post:eq(42)").attr('class', 'post first');
	$("#content.archive div.post:eq(6)").attr('class', 'post first');
	$("#gallery-featured div.post:eq(2)").attr('class', 'post last');
	$("#gallery-trending div.post:eq(2)").attr('class', 'post last');
	$("#gallery-trending div.post:eq(3)").attr('class', 'post first');
	$("#gallery-trending div.post:eq(5)").attr('class', 'post last');
	$("#gallery-popular div.post:eq(2)").attr('class', 'post last');
	$("#gallery-popular div.post:eq(3)").attr('class', 'post first');
	$("#gallery-popular div.post:eq(5)").attr('class', 'post last');
	$("#gallery-recent div.post:eq(2)").attr('class', 'post last');
	$("#gallery-recent div.post:eq(3)").attr('class', 'post first');
	$("#gallery-recent div.post:eq(5)").attr('class', 'post last');
	$("#gallery-archive div.post:eq(2)").attr('class', 'post last');
	$("#gallery-archive div.post:eq(5)").attr('class', 'post last');
	$("#gallery-archive div.post:eq(8)").attr('class', 'post last');
	$("#gallery-archive div.post:eq(11)").attr('class', 'post last');
	$("#gallery-archive div.post:eq(14)").attr('class', 'post last');
	$("#gallery-archive div.post:eq(17)").attr('class', 'post last');
	$("#gallery-archive div.post:eq(20)").attr('class', 'post last');
	$("#gallery-archive div.post:eq(23)").attr('class', 'post last');
	$("#gallery-archive div.post:eq(26)").attr('class', 'post last');
	$("#gallery-archive div.post:eq(29)").attr('class', 'post last');
	$("#gallery-archive div.post:eq(32)").attr('class', 'post last');
	$("#gallery-archive div.post:eq(35)").attr('class', 'post last');
	$("#gallery-archive div.post:eq(38)").attr('class', 'post last');
	$("#gallery-archive div.post:eq(41)").attr('class', 'post last');
	$("#gallery-archive div.post:eq(3)").attr('class', 'post first');
	$("#gallery-archive div.post:eq(6)").attr('class', 'post first');
	$("#gallery-archive div.post:eq(9)").attr('class', 'post first');
	$("#gallery-archive div.post:eq(12)").attr('class', 'post first');
	$("#gallery-archive div.post:eq(15)").attr('class', 'post first');
	$("#gallery-archive div.post:eq(18)").attr('class', 'post first');
	$("#gallery-archive div.post:eq(21)").attr('class', 'post first');
	$("#gallery-archive div.post:eq(24)").attr('class', 'post first');
	$("#gallery-archive div.post:eq(27)").attr('class', 'post first');
	$("#gallery-archive div.post:eq(30)").attr('class', 'post first');
	$("#gallery-archive div.post:eq(33)").attr('class', 'post first');
	$("#gallery-archive div.post:eq(36)").attr('class', 'post first');
	$("#gallery-archive div.post:eq(39)").attr('class', 'post first');
	$("#gallery-archive div.post:eq(42)").attr('class', 'post first');
	// $("img[src$='5lips8.jpg']").attr('class', 'plain');
});

// GALLERY TABS
//=================================================================================================================================

jQuery(document).ready(function() {
	$('#idea-gallery-tabs-description a').click(function() {
		$("#idea-gallery-products").hide();
		$("#idea-gallery-author").hide();
		$("#idea-gallery-description").fadeIn('slow'); return false;
	});
	$('#idea-gallery-tabs-products a').click(function() {
		$("#idea-gallery-description").hide();
		$("#idea-gallery-author").hide();
		$("#idea-gallery-products").fadeIn('slow'); return false;
	});
	$('#idea-gallery-tabs-author a').click(function() {
		$("#idea-gallery-description").hide();
		$("#idea-gallery-products").hide();
		$("#idea-gallery-author").fadeIn('slow'); return false;
	});
});

// MOSAIC
//=================================================================================================================================

jQuery(function($) {
	$('.fade').mosaic({
		speed : 300
	})
});

