$(document).ready(function(){
        
        
        if($.cookie('animation')){
          $('body#home').addClass("noeffect");
          $('body.international').addClass("noeffect");		
          }
        else{         
		  $('html').splashScreen();
		  
        }        
        
                 
        });
    
    
// A self-executing anonymous function,
// standard technique for developing jQuery plugins.

(function($){
	
	$.fn.splashScreen = function(){
		var splashScreen = $('<div>', {
			id: 'splashScreen',
			css: {
				backgroundPosition: 'center ' + '0' + 'px'
			}
		});
		$('body#home').prepend(splashScreen);
		$('body.international').prepend(splashScreen);

		function page_load(){
	      /*$('#nav_global').delay(2200).fadeIn(200);
			$('#nav_global ul').delay(2200).fadeIn(200);
			$('#header').delay(2200).css("display","block");
			$('#overallwrappermock').delay(2350).fadeIn(200);
			$('#home #fdbk_tab').delay(2350).fadeIn(200);
			*/
			
			$('#header h2 a').delay(700).css("display","block");
			$('#header').delay(2200).fadeIn('slow');
			$('#nav_global').delay(2200).fadeIn('slow');		
			
			$('.international #header .dummy_wrapper').delay(2200).fadeIn('slow');
			$('#home #header .dummy_wrapper').delay(2200).fadeIn('slow');
			$('.international #header .dummy_wrapper1').delay(2200).fadeIn('slow');
			$('#home #header .dummy_wrapper1').delay(2200).fadeIn('slow');
			$('.international #header .dummy_wrapper2').delay(2200).fadeIn('slow');	
			$('#home #header .dummy_wrapper2').delay(2200).fadeIn('slow');			
			
			$('#nav_global ul#PFRSubNav').delay(2200).fadeOut('slow');
			$('#nav_global ul#internationalSubNav').delay(2200).fadeOut('slow');
			$('#nav_global #nav_member .hello ul').delay(2200).fadeOut('slow');
						
			$('#extra_wrapper').delay(2200).fadeIn('slow');
			$('#home #nav_main-294563.nav_main').delay(2650).fadeIn('slow');
			$('.international #nav_main-294563.nav_main').delay(2650).fadeIn('slow');
			$('#wrapper').delay(2650).fadeIn('slow');
			$('#footer').delay(2650).fadeIn('slow');
			$('#home #fdbk_tab').delay(2650).fadeIn('slow');
			$('.international #fdbk_tab').delay(2650).fadeIn('slow');
			return;
		}
		
		// Extracting the functionality as a 
		// separate function for convenience.
		function showText(){
				
			var image = new Array();
			
			image[0] = $('<img class="img1" src="http://static.global.ciscoeos.com/1314892463/zipupload/c59/776/34547c753cde6fa066395b3102/images/splash/bruno_image1.png"/>').hide();
			image[1] = $('<img class="img2" src="http://static.global.ciscoeos.com/1314892463/zipupload/c59/776/34547c753cde6fa066395b3102/images/splash/bruno_image2.png"/>').hide();
			image[2] = $('<img class="img3" src="http://static.global.ciscoeos.com/1314892463/zipupload/c59/776/34547c753cde6fa066395b3102/images/splash/bruno_image3.png"/>').hide();
			
			if ( $.browser.msie ) {
				image[1] = $('<div class="img2" style="display: none; filter:Alpha(Opacity=50);opacity:0.5;"> \
						<div style="display:block;width:496px;height:888px;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,sizingMethod=crop,src=http://static.global.ciscoeos.com/1314892463/zipupload/c59/776/34547c753cde6fa066395b3102/images/splash/bruno_image2.png);"></div> \
				    </div>');
				image[2] = $('<div class="img3" style="display: none; filter:Alpha(Opacity=50);opacity:0.5;"> \
						<div style="display:block;width:479px;height:879px;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,sizingMethod=crop,src=http://static.global.ciscoeos.com/1314892463/zipupload/c59/776/34547c753cde6fa066395b3102/images/splash/bruno_image3.png);"></div> \
				</div>');
			}
			
			
			
			image[0].load(function(){
				
				//$('.img1').delay(650).fadeIn(450);
				//$('.img2').delay(1400).fadeIn(550);
				//$('.img3').delay(1600).fadeIn(550);
				
				$('#home #header .dummy_wrapper').css("display","none");
				$('#home #header .dummy_wrapper1').css("display","none");
				$('#home #header .dummy_wrapper2').css("display","none");
				$('#home #nav_global').css("display","none");
				$('#home #wrapper').fadeOut();
				$('#home #footer').fadeOut();
				
				$('.international #header .dummy_wrapper').css("display","none");
				$('.international #header .dummy_wrapper1').css("display","none");
				$('.international #header .dummy_wrapper2').css("display","none");
				$('.international #nav_global').css("display","none");
				$('.international #wrapper').fadeOut();
				$('.international #footer').fadeOut();
				
				
				$('#splashScreen').fadeIn('slow', function() {
					$('.img1').fadeIn('slow' , function() {
						$('.img2').fadeIn('slow', function() {
							$('.img3').fadeIn('slow', function() {
								$('#nav_global > ul ').delay(2200).fadeIn('slow');
								page_load();
							});
						});
					});
				});
			});
			splashScreen.append('<img class="img_logo" src="http://static.global.ciscoeos.com/1313768500/zipupload/716/1ba/4863229cfffa96adb1e34e56c0/images/bg_bruno_logo.png">');
			splashScreen.append(image[0], image[1], image[2]);
			
		}
		showText();
		
	}
	
	
})(jQuery);
