$(window).load(function(){
	
	$("a[rel*=non-html],a[rel*=external]").attr("target","_blank");
	$("a[rel='popup']").click(function(){
		window.open($(this).attr("href"),"_blank", "status=0, height="+window.innerHeight*0.75+", innerWidth=820, resizable=1, scrollbars=1,location=0,menubar=0,toolbar=0");
		return false;
	});
	$("header nav a[href^='#']").colorbox({href:function(){ return $(this).attr('href'); }, innerWidth:"700px",innerHeight:"200px", opacity:0.5, scrolling:false, inline:true});
	$(".slide a[href^='#']").colorbox({href:function(){ return $(this).attr('href'); }, innerWidth:"600px",innerHeight:"300px", opacity:0.5, scrolling:false, inline:true});

	$("#introduction").slideDown(500);
	$("#globe").css({left:"576px",opacity:0}).animate({left:"0px",opacity:1},750);
	$("#default").delay(250).fadeIn(750,function(){ $(this).addClass("current"); });
	$("#introduction nav").delay(250).fadeIn(750);
	$("#introduction nav a,a[href='#']").click(function(){return false;});
	
	function resetSub() {
		$(".choose").show();
		$(".sub").hide();
	}
	
	$("#introduction nav a").mouseenter(function() {
		if(!$(this).hasClass("on") && !$("#default").is(":animated") && $(".current").length) {
			$(this).addClass("on").siblings().removeClass("on");
			resetSub();
			$(".current").css("opcaity","1").hide().removeClass("current");
			$($(this).attr("href")).hide().stop().fadeIn(100,function(){ $(this).addClass("current"); });
		}
		return false;
	});
	$("#introduction .hnav a").click(function(){
		sub = $(this).attr("href");
		$(this).parent().parent(".choose").fadeOut("fast",function(){
			$(sub).fadeIn("fast");
		});
		return false;
	});

});
