$(document).ready(function(){
	
	$("#top1").hover(
		function () {
			$("#top1").css({'background-color':'#000000'});
		},
		function () {
			$("#top1").css({'background-color':''});
		}
	);
	
	$("#top2").hover(
		function () {
			$("#top2").css({'background-color':'#000000'});
			$("#sub2").fadeIn(150);
		},
		function () {
			$("#top2").css({'background-color':''});
			$("#sub2").fadeOut(150);
		}
	);
	
	$("#top3").hover(
		function () {
			$("#top3").css({'background-color':'#000000'});
			$("#sub3").fadeIn(150);
		},
		function () {
			$("#top3").css({'background-color':''});
			$("#sub3").fadeOut(150);
		}
	);
	
	$("#top4").hover(
		function () {
			$("#top4").css({'background-color':'#000000'});
			$("#sub4").fadeIn(150);
		},
		function () {
			$("#top4").css({'background-color':''});
			$("#sub4").fadeOut(150);
		}
	);
	
	$("#top5").hover(
		function () {
			$("#top5").css({'background-color':'#000000'});
			$("#sub5").fadeIn(150);
		},
		function () {
			$("#top5").css({'background-color':''});
			$("#sub5").fadeOut(150);
		}
	);
	
	$("a#tab1").click(function () {
		$("a#tab1").addClass("first");
		$("a#tab2").removeClass("first");
		$("a#tab3").removeClass("first");
		$("#tContent2,#tContent3").fadeOut(0,function () {
			$("#tContent1").fadeIn(1000);
		});
		return false;
	});
	
	$("a#tab2").click(function () {
		$("a#tab1").removeClass("first");
		$("a#tab2").addClass("first");
		$("a#tab3").removeClass("first");
		$("#tContent1,#tContent3").fadeOut(0,function () {
			$("#tContent2").fadeIn(1000);
		});
		return false;
	});
	
	$("a#tab3").click(function () {
		$("a#tab1").removeClass("first");
		$("a#tab2").removeClass("first");
		$("a#tab3").addClass("first");
		$("#tContent1,#tContent2").fadeOut(0,function () {
			$("#tContent3").fadeIn(1000);
		});
		return false;
	});
	
	$("tr.calHeader td a").toggle(
		function () {
			$("#cal").fadeOut(150);
			$("#cal").slideUp();
			$("#cal1").fadeOut(150,
				function () {
					$("#cal2").fadeIn(150);
				}
			);
		},
		function () {
			$("#cal").fadeIn(150);
			$("#cal").slideDown();
			$("#cal2").fadeOut(150,
				function () {
					$("#cal1").fadeIn(150);
				}
			);
		}
	);
	
	$("tr.msgHeader td a").toggle(
		function () {
			$("#mb").fadeOut(150);
			$("#mb").slideUp();
			$("#msg1").fadeOut(150,
				function () {
					$("#msg2").fadeIn(150);
				}
			);
		},
		function () {
			$("#mb").fadeIn(150);
			$("#mb").slideDown();
			$("#msg2").fadeOut(150,
				function () {
					$("#msg1").fadeIn(150);
				}
			);
		}
	);
	
	$("#collapse,#collapse2").click(
		function () {
			$(".lContent").fadeOut(150);
			$(".lContent").slideUp(150,
				function () {
					$(".rContent").fadeOut(200,
						function () {
							$(".rContent").width('985px');
							$(".rContent").fadeIn(500);
						}
					);
				}
			);
			$("#collapse").fadeOut(150,
				function () {
					$("#open").fadeIn(150);
				}
			);
			$("#collapse2").fadeOut(150,
				function () {
					$("#open2").fadeIn(150);
				}
			);
		}
	);
	
	$("#open,#open2").click(
		function () {
			$(".rContent").fadeOut(200,
				function () {
					$(".rContent").width('785px');
					$(".rContent").fadeIn(500,
						function () {
							$(".lContent").fadeIn(150);
							$(".lContent").slideDown(150);
						}
					);
				}
			);
			$("#open").fadeOut(150,
				function () {
					$("#collapse").fadeIn(150);
				}
			);
			$("#open2").fadeOut(150,
				function () {
					$("#collapse2").fadeIn(150);
				}
			);
		}
	);
	
	
});
