Shadowbox.init({ 
	//skipSetup:true, 
	players: ['flv', 'html', 'iframe', 'img', 'qt', 'swf', 'wmp'],
	handleOversize: 'none',
	autoplayMovies: true,
	animate: true,
	displayNav: true
	});
	
Cufon.replace('h1', { fontFamily: 'Arial Narrow' });
Cufon.replace('h3', {fontFamily: 'copperplate' });
Cufon.now();

function showlarrytab(x){
	/*
	$(".larrytabs .buttons li").removeClass("sel");
	$(".larrytabs .buttons li."+x).addClass("sel");
	$(".larrytabs > div").hide();
	$(".larrytabs > div."+x).fadeIn();
	*/	
	
	// redirect instead (for now at least)
	window.location = 'pny/master-plan/' + x;

}



	
$(document).ready(function(){
	
	$('.justifyme').vjustify();
	//$('#homeflash').flash({ src: 'flash/homeflash.swf',width: 840,height: 246 }); 
	
	//==============================================
	//  Color fade animation for nav
	//==============================================
	
	$('.topleftnav li:not(.sel)').hover(
		function () { $(this).stop().animate({ backgroundColor: "#ABD8F4" }, 200); }, 
		function () { $(this).stop().animate({ backgroundColor: "#6CAEDF" }, 200); }
	).click( function() { window.location=$(this).find("a").attr("href"); return false; } );
	
	
	$('.bottomleftnav li:not(.sel)').hover(
		function () { $(this).stop().animate({ backgroundColor: "#033C66" }, {queue:false,duration:200}); }, 
		function () { $(this).stop().animate({ backgroundColor: "#004B8D" }, {queue:false,duration:500}); }
	).click( function() { window.location=$(this).find("a").attr("href"); return false; } );

	$('.rightnav li:not(.sel)').hover(
		function () { $(this).stop().animate({ backgroundColor: "#931602" }, {queue:false,duration:200}); }, 
		function () { $(this).stop().animate({ backgroundColor: "#BA1F00" }, {queue:false,duration:500}); }
	).click( function() { window.location=$(this).find("a").attr("href"); return false; } );
	
	
	var topcolors = ["#c1dff5","#f9bcb3","#f9df98","#b8edb4","#fff39d"];
	var last;
	 $(".topnav li").each(function(i){
	 	if($(this).hasClass("sel")){
			$(this).animate({ backgroundColor: topcolors[i] }, {queue:false,duration:10});
			
		}else{
			
			$(this)
			.mouseenter( function() { 
				$(this).stop().animate({ backgroundColor: topcolors[i] }, {queue:false,duration:200}); 
			})
			.mouseleave( function() { 
				$(this).stop().animate({ backgroundColor: "#FFFFFF" }, {queue:false,duration:500}); 
			})
			.click( function() { 
				window.location= $(this).find("a").attr("href"); return false; 
			});
		}
		
	} );



	
	//==============================================
	//  fix backround image not centering perfectly
	//  when browser window is odd number
	//==============================================
	//widthadjust();
	//$(window).bind("resize", widthadjust);
	
	
	//==================================
	//
	//   larry tabs
	//
	//==================================
	$(".larrytabs").each(function(i){
		
		var buttonlist = "";
		
		// just used for map thing:
		var hasflashmap = 0;
		if($(this).hasClass("flashmap")){ hasflashmap = 1; }
		
		var notfirst = 0; 
		var sel;
		var selclass;
		var thisclass;
		$(this).find("> div").each(function(i){
		$(this).hide();

			thisclass = $(this).attr('class').split(' ').slice(0,1);
			if(notfirst == 0){ 
				sel = this; 
				selclass = thisclass;

			}else{
				if($(this).hasClass("sel")){ sel = this; selclass = thisclass; }
			}
			buttonlist = buttonlist + "<li class='"+ thisclass +"' ><a href='#' >" + $(this).attr('rel') + "</a></li>";	
			notfirst = 1;
			
		});
		
		$(sel).fadeIn("medium");
		
		buttonlist = "<ul class='buttons'>"+buttonlist+"</ul>";
		$(this).prepend(buttonlist);
		$(this).find(".buttons").slideDown("normal");
		
		$(this).find(".buttons a").each(function(i){
			
			$(this).click( function() { 
				x = $(this).parent().attr('class');
				if(hasflashmap == 1){ callJavascript(x); }
				if( $(this).parent().hasClass("sel") ){ 
				}else{
					showlarrytab(x);
				}
				
				return false;
			});
			
			if($(this).parent().attr('class') == selclass){ 
				$(this).parent().addClass("sel"); 
			}

		});
		

		
	} );

});

