$(document).ready(function() {

$('#financial-slides').livequery(function(){
	    $(this).cycle({
	        fx:     'fade',
	        speed:  '1500',
	        timeout: 0,
	        easing:	'easeOutExpo',
	        requeueOnImageNotLoaded: true,
	        pager:  '.charts',
	        pagerAnchorBuilder: function(idx, slide) {
	            // return sel string for existing anchor
	            return '.charts li:eq(' + (idx) + ') a';
	        }
		  });
  }, function() { 
        // unbind cycle 
        $(this) 
 	       .cycle('stop')
           .unbind('cycle'); 
    }); 

 $('#home-flash').livequery(function(){
   $(this).flash({
    src: './swf/home_load.swf',
/*     src: './swf/nike_frontpage.swf', */
    width: 920,
    height: 510,
    version: 9
});
  }, function() { 
        // unbind flash 
        $(this) 
           .unbind('flash'); 
    }); 

 $('#folio-flash').livequery(function(){
   $(this).flash({
    src: './swf/folio_load.swf',
/*     src: './swf/nike_folio_02.swf', */
    width: 920,
    height: 510,
    version: 9
});
  }, function() { 
        // unbind flash 
        $(this) 
           .unbind('flash'); 
    }); 
						   
	$('#pageWrap').wrap('<div id="content-wrapper"></div>');
						   
	function pageload(hash) {
		if(hash) {
			$("#content-wrapper").load(hash + ".html #pageWrap",'',function(){
				$('#content-wrapper').slideDown('normal');
				$('#load').fadeOut('normal');												   
			});
		} else {
			$("#content-wrapper").load("index.html #pageWrap"); //default
		}
	}
	$.historyInit(pageload);			   


	$('#nav li a').click(function(){
								  
		$('#nav li a').removeClass('active'); 

		var hash = $(this).attr('href');
		hash = hash.replace(/^.*#/, '');
		hash = hash.substr(0,hash.length-5);

		$('#content-wrapper').slideUp('fast',function(){$.historyLoad(hash)});
 		$(this).addClass('active');
		return false;
		
	});


});