$(document).ready(function() {

/********************************************************************
Hide Everything and fade 
*********************************************************************/

$(".word").hide();
$('#nav').hide();
$('#shadowName').hide();
$('#shadowLinks').hide();

// Bug fix: Special shout out to IE for forcing developers to put all of the child elements of #container *ABOVE* #container in this here section of the script. With #container hide() and fadeIn() above any of its children, it will fade in the children when that fires, instead of when the children are explicitly called to fadeIn() (or otherwise) later.
// ar-2010.01.25 http://stackoverflow.com/questions/1419198/jquery-child-element-disappears-with-parentclass-opacity-effects-in-ie/1419879#1419879
$('#container').hide(); // IE!!?!?!!
$('#container').delay(400).fadeIn(400); // IE!??!?!?

/********************************************************************
Navigation Animation
*********************************************************************/


// Browser detection.
// I know, I know... jquery.support()
// http://api.jquery.com/jQuery.browser/
jQuery.each(jQuery.browser, function(i) {
   if($.browser.msie){
		
	// This is some hacked ass shit.
	// IE is really specific about what it will/won't animate via jquery, depending on the selector
	// There should be a better way to do this.
	// ar-2010.01.24
	$('#nav a').hide();
	$('#nav').show();
	
	// $('#nav').delay(1000).fadeIn();
	$('#nav a').delay(1300).fadeIn('slow');	
	$('#shadowName').delay(1000).fadeIn();
	$('#shadowLinks').delay(1000).fadeIn();

   }else{

	// slow	
	$('#shadowName').delay(1700).css({'background-position': '0 60px', 'opacity': 1, 'display': 'block'}).animate({ 'background-position': '0 0', 'opacity': 1}, 600);
	$('#shadowLinks').delay(1900).css({'background-position': '0 -40px', 'opacity': 1, 'display': 'block'}).animate({ 'background-position': '0 0', 'opacity': 1}, 600);
	$('#nav').delay(3000).css({'top': '92px', 'opacity': 0, 'display': 'block'}).animate({ 'top': '89px', 'opacity': 1}, 200);

   } // end msie if/else
}); // end jQuery.each(jQuery.browser, function(i)




// allows "jquery.biancasapetto.com.js" to be cached
// while cancelling out the events in it.
$('#header').mouseenter().unbind();
$('#header').mouseleave().unbind();




/********************************************************************
 "Performer" "Choreographer" show/hide
*********************************************************************/

$('.word').delay(5000).fadeIn();
$('.word').delay(8000).fadeOut();

// http://tinyurl.com/yfumbpm

// var timer;
// $(document).mousemove(function() {
//     if (timer) {
//         clearTimeout(timer);
//         timer = 0;
//     }
// 
//     $('.word').fadeIn();
//     timer = setTimeout(function() {
//         $('.word').fadeOut()
//     }, 1000)
// });		


// $("#container").mouseenter(function() {
// 	$(".word").fadeIn('600')				
// });
// 
// $("#container").mouseleave(function() {
// 	$(".word").fadeOut('fast')				
// });


/********************************************************************
Footer
*********************************************************************/

$('#footer').delay(3000).css({'opacity': 0}).animate({'opacity': 1}, 300);

/********************************************************************
Preload
*********************************************************************/

// http://flesler.blogspot.com/2008/01/jquerypreload.html
// Delays the firing of the preload so it doesn't slow down the loading of the content on the front page.
// Would be nice to use the new delay() in jquery 1.4.0 instead of setTimeout.

setTimeout(function() {
	$.preload([ 'cross_legged_looking', 'cross_legged', 'flying_wings', 'flying', 'leap', 'upside_down', 'bottom-bent_back', 'bottom-vertical_smiling' ], {
	    base:'sitewide/images/bg_img-',
	    ext:'.png'
	});
}, 3000);


/********************************************************************
Final
*********************************************************************/
});