// JavaScript Document
$("#textContent2a").css({
	opacity: 0
});
$(function() {
	$('#textContent2a').click(

	function() {
		var $this = '#textContent2a, #emailRand';
		'#textContent2a, #emailRand'.$this.stop().animate({
			'opacity': '0.6'
		}, {
			duration: 500,
			easing: 'easeOutQuad'
		});
	}, function() {
		var $this = $(this);
		$this.stop().animate({
			'opacity': '1.0'
		});
	});
});


$(function() {
	$('#textContent1a, #textContent1').click(function() {
		$('#noteFromRand').fadeToggle('slow');
		$('#rrAesthetics').fadeOut('slow');
		$('#rushToBeauty').fadeOut('slow');
		$('#prettyHurtsContent').fadeOut('slow');
	});
	$('#textContent2a, #textContent2').click(function() {
		$('#noteFromRand').fadeOut('slow');
		$('#rrAesthetics').fadeToggle('slow');
		$('#rushToBeauty').fadeOut('slow');
		$('#prettyHurtsContent').fadeOut('slow');
	});
	$('#textContent3a, #textContent3').click(function() {
		$('#noteFromRand').fadeOut('slow');
		$('#rrAesthetics').fadeOut('slow');
		$('#rushToBeauty').fadeToggle('slow');
		$('#prettyHurtsContent').fadeOut('slow');
	});
	$('#textContent4a, #textContent4').click(function() {
		$('#noteFromRand').fadeOut('slow');
		$('#rrAesthetics').fadeOut('slow');
		$('#rushToBeauty').fadeOut('slow');
		$('#prettyHurtsContent').fadeToggle('slow');
	});

	//fade all out
	$('.overlayclose').click(function() {
		$('#noteFromRand').fadeOut('slow');
		$('#rrAesthetics').fadeOut('slow');
		$('#rushToBeauty').fadeOut('slow');
		$('#prettyHurtsContent').fadeOut('slow');
	});
});

//slide phone number
$(function() {
 $('.phoneToggle').click(function () {
 //alert("hola");
 $('.phoneHolder').fadeToggle("slow");
 });
  $('.addressToggle').click(function () {
 //alert("hola");
 $('.addressHolder').fadeToggle("slow");
 });
 });

/*$(document).ready(function()
{
   $(".phoneHolder").hide();

   $('.phoneToggle').toggle(
   function()
   {
	    //$(".phoneHolder").show();
      $('.phoneHolder').animate({width: "120"}, 1500);
   },
   function()
   {
      $('.phoneHolder').animate({width: "0"}, 1500);
   });
});*/

//hover effect
$(function() {
	$('#container img').hover(

	function() {
		var $this = $(this);
		$this.stop().animate({
			'opacity': '0.6'
		}, {
			duration: 500,
			easing: 'easeOutQuad'
		});
	}, function() {
		var $this = $(this);
		$this.stop().animate({
			'opacity': '1.0'
		});
	});
});

$(function() {
	$('.header li a, .inlineWrapper a, #emailRand').hover(

	function() {
		var $this = $(this);
		$this.stop().animate({
			'opacity': '0.6'
		}, {
			duration: 500,
			easing: 'easeOutQuad'
		});
		
		//$(this).siblings().slideToggle(500);
		
		var $this = $(this);
		$(this).siblings().stop().animate({
			'opacity': '1'
		}, {
			duration: 500,
			easing: 'easeOutQuad'
		});
		
		
	}, function() {
		var $this = $(this);
		$this.stop().animate({
			'opacity': '1.0'
		});
			var $this = $(this);
		$(this).siblings().stop().animate({
			'opacity': '0'
		}, {
			duration: 500,
			easing: 'easeOutQuad'
		});
	});
});

$(function() {
	$('.header li a').hover(

	function() {
		var $this = $(this);
		$this.stop().animate({
			//alert($($this).attr('class'));
			'opacity': '0.6'
		}, {
			duration: 500,
			easing: 'easeOutQuad'
		});
	}, function() {
		var $this = $(this);
		$this.stop().animate({
			'opacity': '1.0'
		});
	});
});

$(document).ready(function() {
	$(function() {
		fade_in_next();
	});

	function fade_in_next() {
		$("ul.fadein > li:hidden:first").fadeIn("slow", function() {
			setTimeout(fade_in_next, 500);
		});
	}
	var items = $("ul.wrapHolder > li.wrap").css({
		opacity: 0
	});;
	shuffle(items);


	// Start the fade-in queue
	nextItemFade(items);

	// Animation callback to start next fade-in

	function nextItemFade(items) {
		// Fade in the first element in the collection
		items.eq(0).animate({
			opacity: 1
		}, 'easeInOutCubic', function() {
			// Recurse, but without the first element
			nextItemFade(items.slice(1));
		});
	}





	$("a.imgThumb").fancybox({
		'overlayShow': true,
		'transitionIn': 'elastic',
		'transitionOut': 'elastic',
		'opacity': true,
		'hideOnOverlayClick': true,
		'hideOnContentClick': true,
		'speedIn': 500,
		'speedOut': 500
	});

	/*					$("#prettyHurts,#prettyHurtsa ").fancybox({
	 $("#textContent1, #textContent2, #textContent3, #textContent4, #textContent1a, #textContent2a, #textContent3a, #textContent4a").fancybox({
	 'width'				: '90%',
	 'height'			: '90%',
	 'overlayShow'	: true,
	 'transitionIn'	: 'elastic',
	 'transitionOut'	: 'elastic',
	 'speedIn' : 500,
	 'speedOut' : 500
	 });
	 'width'				: '95%',
	 'height'			: '95%',
	 'overlayShow'	: true,
	 'transitionIn'	: 'elastic',
	 'transitionOut'	: 'elastic',
	 'speedIn' : 500,
	 'speedOut' : 500,
	 'type'				: 'iframe'
	 });*/
});

function shuffle(a) {
	var j, // Random position
	x, // Last item
	i = a.length; // Iterator
	// Loop through the array
	while (i) {
		// Select a random position
		j = (Math.random() * i) | 0;
		// Get the last item in the array
		x = a[--i];
		// Swap the last item with the item at the selected position
		a[i] = a[j];
		a[j] = x;
	}
	return a;
}

$("#animate").click(function() {
	$("#content").animate({
		"width": "350px"
	}, "fast");
});
